Re: REVIEW: Extensions support for pg_dump

Anssi Kääriäinen <anssi.kaariainen@thl.fi>

From: Anssi Kääriäinen <anssi.kaariainen@thl.fi>
To: Dimitri Fontaine <dimitri@2ndQuadrant.fr>, Alvaro Herrera <alvherre@commandprompt.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-01-18T08:37:51Z
Lists: pgsql-hackers
On 01/17/2011 07:58 PM, Kääriäinen Anssi wrote:
> The issue I saw was this: assume you have an extension foo, containing one function, test().
>
> CREATE EXTENSION foo;
> DROP FUNCTION test();
> -- restricted due to dependency
>
> ALTER FUNCTION test() RENAME TO test2;
> DROP FUNCTION test2();
> -- not restricted!
>
> The same can be done using CREATE OR REPLACE.
>
> I hope this is not an error on my part. It is possible because I had a lot of schemas and my search_path might have been wrong...
The rename is an error on my part, sorry for that. Renaming can be done, 
but dropping is not possible even after rename. But a function in a 
package can be CREATE OR REPLACEd, and after that the function can be 
dropped. COR should be restricted in the same way as DROP is. I will 
check if this is still a problem with the latest patch.

Another problem is that you can ALTER FUNCTION  test() SET SCHEMA = 
something_else, and you can alter the functions search_path, which could 
be a problem for non-relocatable extensions. Even if the schema is 
changed, dropping extension / altering extension will work as expected. 
The function is just in different schema than the extension. But, both 
of these IMO fall in the category "don't do that".

  - Anssi