File tree Expand file tree Collapse file tree 2 files changed +162
-0
lines changed Expand file tree Collapse file tree 2 files changed +162
-0
lines changed Original file line number Diff line number Diff line change @@ -5179,3 +5179,102 @@ List of access methods
51795179 pg_catalog | && | anyarray | anyarray | boolean | overlaps
51805180(1 row)
51815181
5182+ -- AUTOCOMMIT
5183+ CREATE TABLE ac_test (a int);
5184+ \set AUTOCOMMIT off
5185+ INSERT INTO ac_test VALUES (1);
5186+ COMMIT;
5187+ SELECT * FROM ac_test;
5188+ a
5189+ ---
5190+ 1
5191+ (1 row)
5192+
5193+ COMMIT;
5194+ INSERT INTO ac_test VALUES (2);
5195+ ROLLBACK;
5196+ SELECT * FROM ac_test;
5197+ a
5198+ ---
5199+ 1
5200+ (1 row)
5201+
5202+ COMMIT;
5203+ BEGIN;
5204+ INSERT INTO ac_test VALUES (3);
5205+ COMMIT;
5206+ SELECT * FROM ac_test;
5207+ a
5208+ ---
5209+ 1
5210+ 3
5211+ (2 rows)
5212+
5213+ COMMIT;
5214+ BEGIN;
5215+ INSERT INTO ac_test VALUES (4);
5216+ ROLLBACK;
5217+ SELECT * FROM ac_test;
5218+ a
5219+ ---
5220+ 1
5221+ 3
5222+ (2 rows)
5223+
5224+ COMMIT;
5225+ \set AUTOCOMMIT on
5226+ DROP TABLE ac_test;
5227+ SELECT * FROM ac_test; -- should be gone now
5228+ ERROR: relation "ac_test" does not exist
5229+ LINE 1: SELECT * FROM ac_test;
5230+ ^
5231+ -- ON_ERROR_ROLLBACK
5232+ \set ON_ERROR_ROLLBACK on
5233+ CREATE TABLE oer_test (a int);
5234+ BEGIN;
5235+ INSERT INTO oer_test VALUES (1);
5236+ INSERT INTO oer_test VALUES ('foo');
5237+ ERROR: invalid input syntax for type integer: "foo"
5238+ LINE 1: INSERT INTO oer_test VALUES ('foo');
5239+ ^
5240+ INSERT INTO oer_test VALUES (3);
5241+ COMMIT;
5242+ SELECT * FROM oer_test;
5243+ a
5244+ ---
5245+ 1
5246+ 3
5247+ (2 rows)
5248+
5249+ BEGIN;
5250+ INSERT INTO oer_test VALUES (4);
5251+ ROLLBACK;
5252+ SELECT * FROM oer_test;
5253+ a
5254+ ---
5255+ 1
5256+ 3
5257+ (2 rows)
5258+
5259+ BEGIN;
5260+ INSERT INTO oer_test VALUES (5);
5261+ COMMIT AND CHAIN;
5262+ INSERT INTO oer_test VALUES (6);
5263+ COMMIT;
5264+ SELECT * FROM oer_test;
5265+ a
5266+ ---
5267+ 1
5268+ 3
5269+ 5
5270+ 6
5271+ (4 rows)
5272+
5273+ DROP TABLE oer_test;
5274+ \set ON_ERROR_ROLLBACK off
5275+ -- ECHO errors
5276+ \set ECHO errors
5277+ ERROR: relation "notexists" does not exist
5278+ LINE 1: SELECT * FROM notexists;
5279+ ^
5280+ STATEMENT: SELECT * FROM notexists;
Original file line number Diff line number Diff line change @@ -1241,3 +1241,66 @@ drop role regress_partitioning_role;
12411241\dfa bit * small*
12421242\do - pg_catalog .int4
12431243\do && anyarray *
1244+
1245+ -- AUTOCOMMIT
1246+
1247+ CREATE TABLE ac_test (a int );
1248+ \set AUTOCOMMIT off
1249+
1250+ INSERT INTO ac_test VALUES (1 );
1251+ COMMIT ;
1252+ SELECT * FROM ac_test;
1253+ COMMIT ;
1254+
1255+ INSERT INTO ac_test VALUES (2 );
1256+ ROLLBACK ;
1257+ SELECT * FROM ac_test;
1258+ COMMIT ;
1259+
1260+ BEGIN ;
1261+ INSERT INTO ac_test VALUES (3 );
1262+ COMMIT ;
1263+ SELECT * FROM ac_test;
1264+ COMMIT ;
1265+
1266+ BEGIN ;
1267+ INSERT INTO ac_test VALUES (4 );
1268+ ROLLBACK ;
1269+ SELECT * FROM ac_test;
1270+ COMMIT ;
1271+
1272+ \set AUTOCOMMIT on
1273+ DROP TABLE ac_test;
1274+ SELECT * FROM ac_test; -- should be gone now
1275+
1276+ -- ON_ERROR_ROLLBACK
1277+
1278+ \set ON_ERROR_ROLLBACK on
1279+ CREATE TABLE oer_test (a int );
1280+
1281+ BEGIN ;
1282+ INSERT INTO oer_test VALUES (1 );
1283+ INSERT INTO oer_test VALUES (' foo' );
1284+ INSERT INTO oer_test VALUES (3 );
1285+ COMMIT ;
1286+ SELECT * FROM oer_test;
1287+
1288+ BEGIN ;
1289+ INSERT INTO oer_test VALUES (4 );
1290+ ROLLBACK ;
1291+ SELECT * FROM oer_test;
1292+
1293+ BEGIN ;
1294+ INSERT INTO oer_test VALUES (5 );
1295+ COMMIT AND CHAIN;
1296+ INSERT INTO oer_test VALUES (6 );
1297+ COMMIT ;
1298+ SELECT * FROM oer_test;
1299+
1300+ DROP TABLE oer_test;
1301+ \set ON_ERROR_ROLLBACK off
1302+
1303+ -- ECHO errors
1304+ \set ECHO errors
1305+ SELECT * FROM notexists;
1306+ \set ECHO none
You can’t perform that action at this time.
0 commit comments