ALTER EXTENSION DROP FUNCTION not working ?

Started by Sandro Santillialmost 10 years ago3 messages
#1Sandro Santilli
strk@keybit.net

I'm seeing an issue with ALTER EXTENSION DROP FUNCTION
not fully unregistering the dependency of the function
on the extension. Commands to reproduce described here:
https://trac.osgeo.org/postgis/ticket/3450#comment:23

Basically I'm getting:

ERROR: cannot drop function pgis_twkb_accum_finalfn(internal) because other objects depend on it
DETAIL: extension postgis depends on function pgis_twkb_accum_finalfn(internal)

Right after successfully running:

ALTER EXTENSION postgis DROP FUNCTION pgis_twkb_accum_finalfn(internal);

Is it a bug in PostgreSQL ? (9.3.6 running on the test machine).

--strk;

() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Sandro Santilli
strk@keybit.net
In reply to: Sandro Santilli (#1)
Re: ALTER EXTENSION DROP FUNCTION not working ?

On Tue, Feb 09, 2016 at 10:33:42AM +0100, Sandro Santilli wrote:

https://trac.osgeo.org/postgis/ticket/3450#comment:23

Basically I'm getting:

ERROR: cannot drop function pgis_twkb_accum_finalfn(internal) because other objects depend on it
DETAIL: extension postgis depends on function pgis_twkb_accum_finalfn(internal)

Figured: the "pgis_twkb_accum_finalfn(internal)" function is not
a _direct_ dependency of extension "postgis", but is needed for
an aggregate which is still registered.

So this is more an annoyance than a bug, being the non-clear error
message about what's the direct dependent object that prevents
the drop.

--strk;

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Sandro Santilli (#2)
Re: ALTER EXTENSION DROP FUNCTION not working ?

Sandro Santilli <strk@keybit.net> writes:

On Tue, Feb 09, 2016 at 10:33:42AM +0100, Sandro Santilli wrote:

https://trac.osgeo.org/postgis/ticket/3450#comment:23

Basically I'm getting:
ERROR: cannot drop function pgis_twkb_accum_finalfn(internal) because other objects depend on it
DETAIL: extension postgis depends on function pgis_twkb_accum_finalfn(internal)

Figured: the "pgis_twkb_accum_finalfn(internal)" function is not
a _direct_ dependency of extension "postgis", but is needed for
an aggregate which is still registered.

So this is more an annoyance than a bug, being the non-clear error
message about what's the direct dependent object that prevents
the drop.

I believe this is an intentional design decision: if you try to drop
something that an extension member object depends on, we complain about
the extension, not about the member object. This is on the grounds
that a user of an extension likely doesn't know or care exactly what
all the extension members are, and would rather think of the extension
as a unit. Consider for example that if you'd said CASCADE, the command
would have led to dropping the whole extension; would you want each
member object of the extension to be called out explicitly as a drop
cascade target?

I agree that it's a bit unintuitive when you're the developer of the
extension, but I doubt we're going to revisit this choice.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers