Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP

Поиск
Список
Период
Сортировка
От Christophe Pettus
Тема Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Дата
Msg-id 80B77102-84D3-4AD8-B138-1C0C3341855B@thebuild.com
обсуждение исходный текст
Ответ на Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP  (Ravi Krishna <s_ravikrishna@aol.com>)
Ответы Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP  (gogala.mladen@gmail.com)
Список pgsql-general

> On Oct 18, 2022, at 14:29, Ravi Krishna <s_ravikrishna@aol.com> wrote:
>
> > You can commit in a loop, but not in BEGIN / END block that has an exception handler:
> > that creates a subtransaction for the duration of the BEGIN / END.
>
> The reason I have to deal with error exception is that I want to ignore failure on a table and move on to next table.


Rather than have a loop inside the BEGIN / END, you could put the BEGIN EXCEPTION END inside the loop, catch the error,
storethe important parts of the exception in a variable, and then do the COMMIT after the END statement but before the
nextiteration of the loop.  A bit messier, but it gets the job done. 


В списке pgsql-general по дате отправления:

Предыдущее
От: Ravi Krishna
Дата:
Сообщение: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP
Следующее
От: Tom Lane
Дата:
Сообщение: Re: COMMIT IN STORED PROCEDURE WHILE IN A LOOP