From: Pavan Deolasee Date: Fri, 25 Aug 2017 13:04:47 +0000 (+0530) Subject: Fix prepared_xacts test case X-Git-Tag: XL_10_R1BETA1~148 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=14ac8efb29efb78b13f8e2155bdf69fe0ef36462;p=postgres-xl.git Fix prepared_xacts test case Remove a SAVEPOINT statement, which otherwise fails. Once that is removed, a few other test cases work fine and the associated expected output changes are accepted. --- diff --git a/src/test/regress/expected/prepared_xacts.out b/src/test/regress/expected/prepared_xacts.out index ff804e1341..50d4ca0765 100644 --- a/src/test/regress/expected/prepared_xacts.out +++ b/src/test/regress/expected/prepared_xacts.out @@ -179,16 +179,11 @@ DROP TABLE pxtest1; BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; CREATE TABLE pxtest2 (a int); INSERT INTO pxtest2 VALUES (1); - SAVEPOINT a; -ERROR: SAVEPOINT is not yet supported. - INSERT INTO pxtest2 VALUES (2); -ERROR: current transaction is aborted, commands ignored until end of transaction block - ROLLBACK TO a; -ERROR: no such savepoint - SAVEPOINT b; -ERROR: current transaction is aborted, commands ignored until end of transaction block +-- SAVEPOINT a; +-- INSERT INTO pxtest2 VALUES (2); +-- ROLLBACK TO a; +-- SAVEPOINT b; INSERT INTO pxtest2 VALUES (3); -ERROR: current transaction is aborted, commands ignored until end of transaction block PREPARE TRANSACTION 'regress-one'; CREATE TABLE pxtest3(fff int); -- Test shared invalidation @@ -218,15 +213,17 @@ LINE 1: SELECT * FROM pxtest2; SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ------------- + regress-one regress-two -(1 row) +(2 rows) -- Check prepared transactions in the cluster SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1; pgxc_prepared_xact -------------------- + regress-one regress-two -(1 row) +(2 rows) -- pxtest3 should be locked because of the pending DROP begin; @@ -239,15 +236,17 @@ rollback; SELECT gid FROM pg_prepared_xacts ORDER BY gid; gid ------------- + regress-one regress-two -(1 row) +(2 rows) -- Check prepared transactions in the cluster SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1; pgxc_prepared_xact -------------------- + regress-one regress-two -(1 row) +(2 rows) -- pxtest3 should still be locked because of the pending DROP begin; @@ -256,7 +255,6 @@ ERROR: could not obtain lock on relation "pxtest3" rollback; -- Commit table creation COMMIT PREPARED 'regress-one'; -ERROR: prepared transaction with identifier "regress-one" does not exist \d pxtest2 Table "public.pxtest2" Column | Type | Collation | Nullable | Default @@ -264,9 +262,12 @@ ERROR: prepared transaction with identifier "regress-one" does not exist a | integer | | | SELECT * FROM pxtest2; -ERROR: relation "pxtest2" does not exist -LINE 1: SELECT * FROM pxtest2; - ^ + a +--- + 1 + 3 +(2 rows) + -- There should be one prepared transaction SELECT gid FROM pg_prepared_xacts ORDER BY 1; gid @@ -301,7 +302,6 @@ SELECT pgxc_prepared_xact FROM pgxc_prepared_xacts ORDER by 1; -- Clean up DROP TABLE pxtest2; -ERROR: table "pxtest2" does not exist DROP TABLE pxtest3; -- will still be there if prepared xacts are disabled ERROR: table "pxtest3" does not exist DROP TABLE pxtest4; diff --git a/src/test/regress/sql/prepared_xacts.sql b/src/test/regress/sql/prepared_xacts.sql index bb6e4eba40..3d9e966163 100644 --- a/src/test/regress/sql/prepared_xacts.sql +++ b/src/test/regress/sql/prepared_xacts.sql @@ -103,10 +103,10 @@ DROP TABLE pxtest1; BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; CREATE TABLE pxtest2 (a int); INSERT INTO pxtest2 VALUES (1); - SAVEPOINT a; - INSERT INTO pxtest2 VALUES (2); - ROLLBACK TO a; - SAVEPOINT b; +-- SAVEPOINT a; +-- INSERT INTO pxtest2 VALUES (2); +-- ROLLBACK TO a; +-- SAVEPOINT b; INSERT INTO pxtest2 VALUES (3); PREPARE TRANSACTION 'regress-one';