Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodeID as function arg: would be good to accept the pk data type directly #469

Open
benjie opened this issue Aug 11, 2023 · 0 comments
Open
Labels
💅 enhancement New feature or request
Milestone

Comments

@benjie
Copy link
Member

benjie commented Aug 11, 2023

A function like:

CREATE FUNCTION public.delete_block_by_id(block_id uuid)
RETURNS public.block
AS $$
  DELETE FROM public.block
  WHERE id = block_id
  RETURNING *;
$$ LANGUAGE sql VOLATILE STRICT SECURITY DEFINER;

Should be able to be labelled to use a NodeID, but to do so we need to indicate which type that NodeID is to be of. In the case of an @interface mode:relational type, we should accept NodeIDs for each of the concrete types, and extract the relevant PK from these.

This will not work with composite primary keys, I don't think that's a big deal.

Maybe something like:

comment on function delete_block_by_id is E'@arg0variant nodeId:Block';

Indicating that it's a nodeId for the "Block" type. If it turns out Block is a union/interface we'd go from there to figure out the concrete types.

Context: https://discord.com/channels/489127045289476126/498852330754801666/1139032627345621033

Related: #468

Reported by @sgrove

@benjie benjie added the 💅 enhancement New feature or request label Aug 11, 2023
@benjie benjie added this to the V5 RC milestone Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💅 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant