Re: rollback to savepoint issue

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: rollback to savepoint issue
Дата
Msg-id 1341766181.156278.1693831501720@office.mailbox.org
обсуждение исходный текст
Ответ на rollback to savepoint issue  (Lorusso Domenico <domenico.l76@gmail.com>)
Ответы Re: rollback to savepoint issue  (Dominique Devienne <ddevienne@gmail.com>)
Re: rollback to savepoint issue  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On 04/09/2023 11:51 CEST Lorusso Domenico <domenico.l76@gmail.com> wrote:

> I can't use the savepoint and rollback to savepoint clause.
> I've found some similar problems around on the web, but I can't catch the
> good way to proceed.
>
> What I'm trying to do is:
>   * compare new set of attribute with older
>   * if some attributes are part of old set and not in the new one: delete
>     the old
>   * but if parameter "on_misisng_delete" is false rollback delete command
>     and rais exception
> The original code in embedded in a function, but the problem is the same:

Transaction control is not possible in functions.  Only in procedures (CALL)
and DO blocks.

> ERROR: syntax error at or near "to"
> LINE 41: rollback to savepoint deleteAttribute;

Use BEGIN ... EXCEPTION ... END instead of manual savepoints. [1]

[1] https://www.postgresql.org/docs/current/plpgsql-porting.html#PLPGSQL-PORTING-EXCEPTIONS

--
Erik



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

Предыдущее
От: wheels
Дата:
Сообщение: Efficient Partitioning Strategies for PostgreSQL Table with KSUID and High Volume
Следующее
От: Dominique Devienne
Дата:
Сообщение: Re: rollback to savepoint issue