Alvaro Herrera <alvherre@commandprompt.com> writes:
> Excerpts from Anssi Kääriäinen's message of lun ene 17 12:41:25 -0300 2011:
>
>> While it is not possible to drop functions in extensions, it is possible
>> to rename a function, and also to CREATE OR REPLACE a function in an
>> extension. After renaming or CORing a function, it is possible to drop
>> the function.
>
> Hmm, this seems a serious problem. I imagine that what's going on is
> that the function cannot be dropped because the extension depends on it;
> but after the rename, the dependencies of the function are dropped and
> recreated, but the dependency that relates it to the extension is
> forgotten.
Well I'm not seeing that here:
~:5490=# drop function utils.lo_manage_d();
ERROR: cannot drop function utils.lo_manage_d() because extension lo requires it
HINT: You can drop extension lo instead.
src/backend/commands/functioncmds.c
/* rename */namestrcpy(&(procForm->proname), newname);simple_heap_update(rel, &tup->t_self,
tup);CatalogUpdateIndexes(rel,tup);
But here:
src/backend/catalog/pg_proc.c
/* * Create dependencies for the new function. If we are updating an * existing function, first delete any existing
pg_dependentries. * (However, since we are not changing ownership or permissions, the * shared dependencies do *not*
needto change, and we leave them alone.) */if (is_update) deleteDependencyRecordsFor(ProcedureRelationId, retval);
[ ... adding all dependencies back ... ]
/* dependency on extension */if (create_extension){ recordDependencyOn(&myself, &CreateExtensionAddress,
DEPENDENCY_INTERNAL);}
Will investigate some more later.
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support