The SAVEPOINT documentation says that a new savepoint created with the
same name as an existing savepoint masks but does not destroy the old
savepoint, and rolling back to the savepoint will then make the old
savepoint available for RELEASE SAVEPOINT and ROLLBACK TO SAVEPOINT
calls. 8.3.5 and my 8.4devel (built a few days ago) don't follow this
behavior, as demonstrated with the attached script. Unless, of course,
I'm missing something.

- Josh / eggyknap
CREATE TEMPORARY TABLE test (id INTEGER);
BEGIN;
INSERT INTO test (id) VALUES (1);
SAVEPOINT svpt;
INSERT INTO test (id) VALUES (2);
SAVEPOINT svpt;
INSERT INTO test (id) VALUES (3);
SAVEPOINT svpt;
INSERT INTO test (id) VALUES (4);
SAVEPOINT svpt;
INSERT INTO test (id) VALUES (5);
SELECT * FROM test;
SELECT 'Should show values 1..5';
ROLLBACK TO SAVEPOINT svpt;
SELECT * FROM test;
SELECT 'Should show values 1..4';
ROLLBACK TO SAVEPOINT svpt;
SELECT * FROM test;
SELECT 'Per docs, should show values 1..3, but it doesn''t';
COMMIT;
SELECT * FROM test;
SELECT 'Per docs, should show values 1..3, but it doesn''t';

Attachment: signature.asc
Description: Digital signature

Reply via email to