Missing example for SAVEPOINT using the same savepoint name

Поиск
Список
Период
Сортировка
От PG Doc comments form
Тема Missing example for SAVEPOINT using the same savepoint name
Дата
Msg-id 164969280899.834802.7458840197227864320@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: Missing example for SAVEPOINT using the same savepoint name  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-docs
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-savepoint.html
Description:

The "Compatibility" section deserves some code example to illustrate the
behavior when reusing the same savepoint name.

Maybe this could help:

CREATE TABLE tab1 ( pk INT, name VARCHAR(50) );
BEGIN;
INSERT INTO tab1 VALUES (101,'aaa');
SAVEPOINT mysp; /* mysp #1 */
UPDATE tab1 SET name = 'bbb' WHERE pk = 101;
SAVEPOINT mysp; /* mysp #2 */
UPDATE tab1 SET name = 'ccc' WHERE pk = 101;
ROLLBACK TO SAVEPOINT mysp; /* rolls back to mysp #2 */
SELECT * FROM tab1 ORDER BY pk;
RELEASE SAVEPOINT mysp; /* releases mysp #2 */
ROLLBACK TO SAVEPOINT mysp; /* rolls back to mysp #1 */
SELECT * FROM tab1 ORDER BY pk;
COMMIT;
DROP TABLE tab1;

First SELECT will show 101/bbb, second will show 101/aaa ....

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: 41.3. Materialized Views: Create table should be create view?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Update wording of INSERT ON CONFLICT "rows proposed for insertion"