Chapman Flack <jcflack@acm.org> writes:
> Only slightly tangentially: what things count as "objects that depend
> on the transform" for purposes of DROP TRANSFORM ... CASCADE / RESTRICT ?
> I just now dropped (in 17.4) a transform named in an existing routine's
> declaration, with nary a peep.
Hmm, really? ProcedureCreate() certainly looks like it creates
necessary dependencies, and when I tried it just now, I got the
expected failure:
regression=# create extension hstore_plperl;
CREATE EXTENSION
regression=# create function foo(f1 hstore) returns hstore language plperl
as 'return f1' transform for type hstore;
CREATE FUNCTION
regression=# drop extension hstore_plperl;
ERROR: cannot drop extension hstore_plperl because other objects depend on it
DETAIL: function foo(hstore) depends on transform for hstore language plperl
HINT: Use DROP ... CASCADE to drop the dependent objects too.
But wait a minute ... if I recreate the function with no
TRANSFORM clause, I *still* can't drop the transform:
regression=# drop function foo(f1 hstore);
DROP FUNCTION
regression=# create function foo(f1 hstore) returns hstore language plperl
as 'return f1';
CREATE FUNCTION
regression=# drop extension hstore_plperl;
ERROR: cannot drop extension hstore_plperl because other objects depend on it
DETAIL: function foo(hstore) depends on transform for hstore language plperl
HINT: Use DROP ... CASCADE to drop the dependent objects too.
Looking more closely at ProcedureCreate(), it makes a dependency
if a transform *exists* for the argument or result type, whether
a TRANSFORM clause is present or not. Surely this is completely
bogus? We should be depending on the OIDs mentioned in protrftypes,
not more nor less.
I'm not quite sure if that somehow explains your results, but
it does look like a bug to me.
regards, tom lane