Christopher Browne cbbrowne at ca.afilias.info
Wed Oct 21 19:21:54 PDT 2009
Quoting Vick Khera <vivek at khera.org>:

> On Wed, Oct 21, 2009 at 11:25 AM, Christopher Browne
> <cbbrowne at ca.afilias.info> wrote:
>> And I need to think about that a little further; "DROP FUNCTION IF EXISTS"
>> wasn't introduced until, I believe, PostgreSQL 8.2.  (It's not in 8.1.)
>>
>> So that strategy won't work for 1.2 :-(.
>
> can you wrap it inside a SAVEPOINT, and then rollback to the savepoint
> if it fails?  not sure how you'd do that in a simple SQL script,
> though :-(

I don't think we had SAVEPOINT in 7.4, which is still supported...

I have a patch with a strategy for this; basically just creating a  
little stored procedure which simulates the aspect of "DROP FUNCTION  
IF EXISTS" that we need.

That is, the SP looks in information_schema to see if there's a  
function in the cluster's schema with the given name, and drops it, if  
there.

It's not very smart; there's a scenario where it'll blow up, but I  
think that scenario corresponds to someone having hacked things up  
dramatically enough that they can't *realistically* expect UPDATE  
FUNCTIONS to work out well for them.

Patch is sitting in a mailbox waiting for me to try it out...




More information about the Slony1-general mailing list