Skip to content

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

@benjie

Description

@benjie

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    🦥 Sloth

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions