force command execution - Mailing list pgsql-sql

From drdani@mazsola.iit.uni-miskolc.hu
Subject force command execution
Date
Msg-id Pine.LNX.4.61.0504151018380.13607@mazsola.iit.uni-miskolc.hu
Whole thread Raw
In response to Re: order by question  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
List pgsql-sql
Hi,

Let's suppose I have a plpgsql function like:

...
begin    alter ...      ...;    insert ...      ...;    create ...      ...;    drop ...;    and lot of such commands
inany order...
 
end;
...

(There is no "perform" keyword.)

Sometimes "ALTER" failes becouse it is already done. Sometimes 
"INSERT" failes becouse record already exists. Sometimes "DROP" 
failes bacouse object is already dropped by earlier execution of this 
function. When any of the command fails function has no effect at all 
becouse everything is rolled back.

Is it possible to run this function without rollback effect and just 
skip failures? (Server is 8.0.0-rc1.)

If the only way is putting each command in

begin    perform command;
exception    when others then        NULL;
end;

then I'm looking for a text processing tool which can do this 
"wrapping" automaticaly. I've too much functions and commands in them, 
so hand work is not an option.

Daniel



pgsql-sql by date:

Previous
From: "Rizal"
Date:
Subject: Salam Kenal
Next
From: Stephen Quinney
Date:
Subject: Combining values in a column