graphile / crystal-pre-merge

Repository moved
https://github.com/graphile/crystal
39 stars 10 forks source link

NodeID as function arg: doesn't work with relational polymorphic type #468

Closed benjie closed 10 months ago

benjie commented 11 months ago

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

Reported by @sgrove

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

comment on function public.super_custom_delete_block_by_id(block_id public.block) is E'@arg0variant nodeId';

block here is an @interface mode:relational type; so the nodeId argument should accept ids from any of the concrete types of this, and then pass through the root table record. Currently I'm not sure what it does (need to try and reproduce it) but I'm guessing it fails to find a suitable handler for the type and thus gives up.

benjie commented 11 months ago

Solve https://github.com/benjie/crystal/issues/473 first!