Hi,

Let's suppose I have a plpgsql function like:

...
begin
        alter ...
          ...;
        insert ...
          ...;
        create ...
          ...;
        drop ...;
        and lot of such commands in any 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


---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend

Reply via email to