Re: FmgrInfo allocation patterns (and PL handling as staged programming) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: FmgrInfo allocation patterns (and PL handling as staged programming)
Date
Msg-id 3112950.1743984111@sss.pgh.pa.us
Whole thread Raw
In response to Re: FmgrInfo allocation patterns (and PL handling as staged programming)  (Chapman Flack <jcflack@acm.org>)
Responses Re: FmgrInfo allocation patterns (and PL handling as staged programming)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Mihail Nikalayeu
Date:
Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Next
From: Fujii Masao
Date:
Subject: Re: Use XLOG_CONTROL_FILE macro everywhere?