force command execution

Поиск
Список
Период
Сортировка
От drdani@mazsola.iit.uni-miskolc.hu
Тема force command execution
Дата
Msg-id Pine.LNX.4.61.0504151018380.13607@mazsola.iit.uni-miskolc.hu
обсуждение исходный текст
Ответ на Re: order by question  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список 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 по дате отправления:

Предыдущее
От: "Rizal"
Дата:
Сообщение: Salam Kenal
Следующее
От: Stephen Quinney
Дата:
Сообщение: Combining values in a column