SAVEPOINT Table "save.sample"
testdb=# BEGIN;
BEGIN
testdb=# CREATE TABLE sample(id integer);
CREATE TABLE
testdb=# INSERT INTO sample VALUES(1);
INSERT 0 1
testdb=# INSERT INTO sample VALUES(2);
INSERT 0 1
testdb=# SAVEPOINT sp;
SAVEPOINT
testdb=# INSERT INTO sample VALUES(3);
INSERT 0 1
testdb=# SAVEPOINT sp;
SAVEPOINT
testdb=# INSERT INTO sample VALUES(4);
INSERT 0 1
testdb=# RELEASE SAVEPOINT sp;
testdb=# ROLLBACK TO sp;
ROLLBACK
testdb=# SELECT * FROM sample;
id
----
1
2
(2 rows)
testdb=# \d sample
Table "save.sample"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
id | integer | | |