pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Conflict between regression tests namespace & transactions due to recent changes
12+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2023-05-19 b973f93b6c cf9de891ba 6f1cf2efbd 7d3c0b1f8f 89f5eb26f6 4cdda71d4d  Avoid naming conflict between transactions.sql and namespace.sql.
* Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-15 15:27  Marina Polyakova <m.polyakova@postgrespro.ru>
  0 siblings, 1 reply; 12+ messages in thread

From: Marina Polyakova @ 2023-05-15 15:27 UTC (permalink / raw)
  To: pgsql-hackers; exclusion@gmail.com

Hello, hackers!

When running tests for version 15, we found a conflict between 
regression tests namespace & transactions due to recent changes [1].

diff -w -U3 .../src/test/regress/expected/transactions.out 
.../src/bin/pg_upgrade/tmp_check/results/transactions.out
inline patch 1: .../src/bin/pg_upgrade/tmp_check/results/transactions.out ... (+3/-0 lines) download inline-1.patch--- .../src/test/regress/expected/transactions.out ... +++ .../src/bin/pg_upgrade/tmp_check/results/transactions.out ... @@ -899,6 +899,9 @@ RESET default_transaction_read_only; DROP TABLE abc; +ERROR: cannot drop table abc because other objects depend on it +DETAIL: view test_ns_schema_2.abc_view depends on table abc +HINT: Use DROP ... CASCADE to drop the dependent objects too. -- Test assorted behaviors around the implicit transaction block
created -- when multiple SQL commands are sent in a single Query message. These -- tests rely on the fact that psql will not break SQL commands apart at a ... IIUC the conflict was caused by +SET search_path to public, test_ns_schema_1; +CREATE SCHEMA test_ns_schema_2 + CREATE VIEW abc_view AS SELECT a FROM abc; because the parallel regression test transactions had already created the table abc and was trying to drop it. ISTM the patch diff.patch fixes this problem... [1] https://github.com/postgres/postgres/commit/dbd5795e7539ec9e15c0d4ed2d05b1b18d2a3b09 -- Marina Polyakova Postgres Professional: http://www.postgrespro.com The Russian Postgres Company Patches and attachments: download all (2 files, .tar.gz)
diff.patch (text/x-diff, 2.0K) download diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out index a62fd8ded015e6ee56784e4341e5ac1a4ed5621f..bcb6a75cf230fdc30f728201c2a2baef1838ed18 100644 --- a/src/test/regress/expected/namespace.out +++ b/src/test/regress/expected/namespace.out @@ -35,10 +35,15 @@ SHOW search_path; -- verify that the correct search_path preserved -- after creating the schema and on commit +-- create your table to not use the same table from transactions test BEGIN; SET search_path to public, test_ns_schema_1; CREATE SCHEMA test_ns_schema_2 - CREATE VIEW abc_view AS SELECT a FROM abc; + CREATE VIEW abc_view AS SELECT a FROM abc + CREATE TABLE abc ( + a serial, + b int UNIQUE + ); SHOW search_path; search_path -------------------------- @@ -53,7 +58,9 @@ SHOW search_path; (1 row) DROP SCHEMA test_ns_schema_2 CASCADE; -NOTICE: drop cascades to view test_ns_schema_2.abc_view +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table test_ns_schema_2.abc +drop cascades to view test_ns_schema_2.abc_view -- verify that the objects were created SELECT COUNT(*) FROM pg_class WHERE relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1'); diff --git a/src/test/regress/sql/namespace.sql b/src/test/regress/sql/namespace.sql index 3474f5ecf4215068fd89ec52f9ee8b95ddff36bb..95b9ed7b00807222e94e30221348f58039c63257 100644 --- a/src/test/regress/sql/namespace.sql +++ b/src/test/regress/sql/namespace.sql @@ -28,10 +28,16 @@ SHOW search_path; -- verify that the correct search_path preserved -- after creating the schema and on commit +-- create your table to not use the same table from transactions test BEGIN; SET search_path to public, test_ns_schema_1; CREATE SCHEMA test_ns_schema_2 - CREATE VIEW abc_view AS SELECT a FROM abc; + CREATE VIEW abc_view AS SELECT a FROM abc + + CREATE TABLE abc ( + a serial, + b int UNIQUE + ); SHOW search_path; COMMIT; SHOW search_path;
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-15 16:16  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Marina Polyakova <m.polyakova@postgrespro.ru>
  0 siblings, 2 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-15 16:16 UTC (permalink / raw)
  To: Marina Polyakova <m.polyakova@postgrespro.ru>; +Cc: pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

Marina Polyakova <m.polyakova@postgrespro.ru> writes:
> IIUC the conflict was caused by

> +SET search_path to public, test_ns_schema_1;
> +CREATE SCHEMA test_ns_schema_2
> +       CREATE VIEW abc_view AS SELECT a FROM abc;

> because the parallel regression test transactions had already created 
> the table abc and was trying to drop it.

Hmm.  I'd actually fix the blame on transactions.sql here.  Creating
a table named as generically as "abc" is horribly bad practice in
a set of concurrent tests.  namespace.sql is arguably okay, since
it's creating that table name in a private schema.

I'd be inclined to fix this by doing s/abc/something-else/g in
transactions.sql.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-15 20:23  Marina Polyakova <m.polyakova@postgrespro.ru>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 12+ messages in thread

From: Marina Polyakova @ 2023-05-15 20:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On 2023-05-15 19:16, Tom Lane wrote:
> Marina Polyakova <m.polyakova@postgrespro.ru> writes:
>> IIUC the conflict was caused by
> 
>> +SET search_path to public, test_ns_schema_1;
>> +CREATE SCHEMA test_ns_schema_2
>> +       CREATE VIEW abc_view AS SELECT a FROM abc;
> 
>> because the parallel regression test transactions had already created
>> the table abc and was trying to drop it.
> 
> Hmm.  I'd actually fix the blame on transactions.sql here.  Creating
> a table named as generically as "abc" is horribly bad practice in
> a set of concurrent tests.  namespace.sql is arguably okay, since
> it's creating that table name in a private schema.
> 
> I'd be inclined to fix this by doing s/abc/something-else/g in
> transactions.sql.
> 
> 			regards, tom lane

Maybe use a separate schema for all new objects in the transaction 
test?.. See diff_set_tx_schema.patch.

-- 
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

diff_set_tx_schema.patch (text/x-diff, 1.1K) download diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out index 2b2cff7d9120a139532d1a6a2f2bc79e463bc4fa..6a3758bafb54327fbe341dfd89457e53ffce47dd 100644 --- a/src/test/regress/expected/transactions.out +++ b/src/test/regress/expected/transactions.out @@ -1,6 +1,10 @@ -- -- TRANSACTIONS -- +-- Use your schema to avoid conflicts with objects with the same names in +-- parallel tests. +CREATE SCHEMA test_tx_schema; +SET search_path TO test_tx_schema,public; BEGIN; CREATE TABLE xacttest (a smallint, b real); INSERT INTO xacttest VALUES diff --git a/src/test/regress/sql/transactions.sql b/src/test/regress/sql/transactions.sql index 7ee5f6aaa55a686f5484664c3fae224c08bde42a..0e6d6453edaa776425524d43abf5ae3cfca3ac45 100644 --- a/src/test/regress/sql/transactions.sql +++ b/src/test/regress/sql/transactions.sql @@ -2,6 +2,11 @@ -- TRANSACTIONS -- +-- Use your schema to avoid conflicts with objects with the same names in +-- parallel tests. +CREATE SCHEMA test_tx_schema; +SET search_path TO test_tx_schema,public; + BEGIN; CREATE TABLE xacttest (a smallint, b real);
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-15 23:19  Michael Paquier <michael@paquier.xyz>
  parent: Marina Polyakova <m.polyakova@postgrespro.ru>
  0 siblings, 1 reply; 12+ messages in thread

From: Michael Paquier @ 2023-05-15 23:19 UTC (permalink / raw)
  To: Marina Polyakova <m.polyakova@postgrespro.ru>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On Mon, May 15, 2023 at 11:23:18PM +0300, Marina Polyakova wrote:
> On 2023-05-15 19:16, Tom Lane wrote:
>> Hmm.  I'd actually fix the blame on transactions.sql here.  Creating
>> a table named as generically as "abc" is horribly bad practice in
>> a set of concurrent tests.  namespace.sql is arguably okay, since
>> it's creating that table name in a private schema.
>> 
>> I'd be inclined to fix this by doing s/abc/something-else/g in
>> transactions.sql.
>
> Maybe use a separate schema for all new objects in the transaction test?..
> See diff_set_tx_schema.patch.

Sure, you could do that to bypass the failure (without the "public"
actually?), leaving non-generic names around.  Still I'd agree with
Tom here and just rename the objects to something more in line with
the context of the test to make things a bit more greppable.  These
could be renamed as transaction_tab or transaction_view, for example.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-16 05:03  Noah Misch <noah@leadboat.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 12+ messages in thread

From: Noah Misch @ 2023-05-16 05:03 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Marina Polyakova <m.polyakova@postgrespro.ru>; pgsql-hackers; exclusion@gmail.com

On Mon, May 15, 2023 at 12:16:08PM -0400, Tom Lane wrote:
> Marina Polyakova <m.polyakova@postgrespro.ru> writes:
> > IIUC the conflict was caused by
> 
> > +SET search_path to public, test_ns_schema_1;
> > +CREATE SCHEMA test_ns_schema_2
> > +       CREATE VIEW abc_view AS SELECT a FROM abc;
> 
> > because the parallel regression test transactions had already created 
> > the table abc and was trying to drop it.
> 
> Hmm.  I'd actually fix the blame on transactions.sql here.  Creating
> a table named as generically as "abc" is horribly bad practice in
> a set of concurrent tests.  namespace.sql is arguably okay, since
> it's creating that table name in a private schema.
> 
> I'd be inclined to fix this by doing s/abc/something-else/g in
> transactions.sql.

For the record, I'm fairly sure s/public, test_ns_schema_1/test_ns_schema_1/
on the new namespace tests would also solve things.  Those tests don't need
"public" in the picture.  Nonetheless, +1 for your proposal.





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-16 05:19  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 12+ messages in thread

From: Tom Lane @ 2023-05-16 05:19 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Marina Polyakova <m.polyakova@postgrespro.ru>; pgsql-hackers; exclusion@gmail.com

Noah Misch <noah@leadboat.com> writes:
> For the record, I'm fairly sure s/public, test_ns_schema_1/test_ns_schema_1/
> on the new namespace tests would also solve things.  Those tests don't need
> "public" in the picture.  Nonetheless, +1 for your proposal.

Hmm, I'd not read the test case all that closely, but I did think
that including "public" in the search path was an important part
of it.  If it is not, maybe the comments could use adjustment.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-16 08:02  Marina Polyakova <m.polyakova@postgrespro.ru>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 12+ messages in thread

From: Marina Polyakova @ 2023-05-16 08:02 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On 2023-05-16 02:19, Michael Paquier wrote:
> On Mon, May 15, 2023 at 11:23:18PM +0300, Marina Polyakova wrote:
>> Maybe use a separate schema for all new objects in the transaction 
>> test?..
>> See diff_set_tx_schema.patch.
> 
> Sure, you could do that to bypass the failure (without the "public"
> actually?), leaving non-generic names around.  Still I'd agree with
> Tom here and just rename the objects to something more in line with
> the context of the test to make things a bit more greppable.  These
> could be renamed as transaction_tab or transaction_view, for example.
> --
> Michael

It confuses me a little that different methods are used for the same 
purpose. But the namespace test checks schemas. So see 
diff_abc_to_txn_table.patch which replaces abc with txn_table in the 
transaction test.

-- 
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

diff_abc_to_txn_table.patch (text/x-diff, 15.3K) download diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out index 2b2cff7d9120a139532d1a6a2f2bc79e463bc4fa..21efb900ef1bc30338f1102f6a40f1d25be0db9c 100644 --- a/src/test/regress/expected/transactions.out +++ b/src/test/regress/expected/transactions.out @@ -609,10 +609,10 @@ drop function inverse(int); -- performed in the aborted subtransaction begin; savepoint x; -create table abc (a int); -insert into abc values (5); -insert into abc values (10); -declare foo cursor for select * from abc; +create table txn_table (a int); +insert into txn_table values (5); +insert into txn_table values (10); +declare foo cursor for select * from txn_table; fetch from foo; a --- @@ -625,11 +625,11 @@ fetch from foo; ERROR: cursor "foo" does not exist commit; begin; -create table abc (a int); -insert into abc values (5); -insert into abc values (10); -insert into abc values (15); -declare foo cursor for select * from abc; +create table txn_table (a int); +insert into txn_table values (5); +insert into txn_table values (10); +insert into txn_table values (15); +declare foo cursor for select * from txn_table; fetch from foo; a --- @@ -698,7 +698,7 @@ COMMIT; DROP FUNCTION create_temp_tab(); DROP FUNCTION invert(x float8); -- Tests for AND CHAIN -CREATE TABLE abc (a int); +CREATE TABLE txn_table (a int); -- set nondefault value so we have something to override below SET default_transaction_read_only = on; START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; @@ -720,8 +720,8 @@ SHOW transaction_deferrable; on (1 row) -INSERT INTO abc VALUES (1); -INSERT INTO abc VALUES (2); +INSERT INTO txn_table VALUES (1); +INSERT INTO txn_table VALUES (2); COMMIT AND CHAIN; -- TBLOCK_END SHOW transaction_isolation; transaction_isolation @@ -741,11 +741,11 @@ SHOW transaction_deferrable; on (1 row) -INSERT INTO abc VALUES ('error'); +INSERT INTO txn_table VALUES ('error'); ERROR: invalid input syntax for type integer: "error" -LINE 1: INSERT INTO abc VALUES ('error'); - ^ -INSERT INTO abc VALUES (3); -- check it's really aborted +LINE 1: INSERT INTO txn_table VALUES ('error'); + ^ +INSERT INTO txn_table VALUES (3); -- check it's really aborted ERROR: current transaction is aborted, commands ignored until end of transaction block COMMIT AND CHAIN; -- TBLOCK_ABORT_END SHOW transaction_isolation; @@ -766,7 +766,7 @@ SHOW transaction_deferrable; on (1 row) -INSERT INTO abc VALUES (4); +INSERT INTO txn_table VALUES (4); COMMIT; START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; SHOW transaction_isolation; @@ -788,10 +788,10 @@ SHOW transaction_deferrable; (1 row) SAVEPOINT x; -INSERT INTO abc VALUES ('error'); +INSERT INTO txn_table VALUES ('error'); ERROR: invalid input syntax for type integer: "error" -LINE 1: INSERT INTO abc VALUES ('error'); - ^ +LINE 1: INSERT INTO txn_table VALUES ('error'); + ^ COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING SHOW transaction_isolation; transaction_isolation @@ -811,7 +811,7 @@ SHOW transaction_deferrable; on (1 row) -INSERT INTO abc VALUES (5); +INSERT INTO txn_table VALUES (5); COMMIT; START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; SHOW transaction_isolation; @@ -873,7 +873,7 @@ SHOW transaction_deferrable; off (1 row) -INSERT INTO abc VALUES (6); +INSERT INTO txn_table VALUES (6); ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING SHOW transaction_isolation; transaction_isolation @@ -893,10 +893,10 @@ SHOW transaction_deferrable; off (1 row) -INSERT INTO abc VALUES ('error'); +INSERT INTO txn_table VALUES ('error'); ERROR: invalid input syntax for type integer: "error" -LINE 1: INSERT INTO abc VALUES ('error'); - ^ +LINE 1: INSERT INTO txn_table VALUES ('error'); + ^ ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END SHOW transaction_isolation; transaction_isolation @@ -922,7 +922,7 @@ COMMIT AND CHAIN; -- error ERROR: COMMIT AND CHAIN can only be used in transaction blocks ROLLBACK AND CHAIN; -- error ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks -SELECT * FROM abc ORDER BY 1; +SELECT * FROM txn_table ORDER BY 1; a --- 1 @@ -932,7 +932,7 @@ SELECT * FROM abc ORDER BY 1; (4 rows) RESET default_transaction_read_only; -DROP TABLE abc; +DROP TABLE txn_table; -- Test assorted behaviors around the implicit transaction block created -- when multiple SQL commands are sent in a single Query message. These -- tests rely on the fact that psql will not break SQL commands apart at a @@ -1090,21 +1090,21 @@ SHOW transaction_read_only; off (1 row) -CREATE TABLE abc (a int); +CREATE TABLE txn_table (a int); -- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN -INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error +INSERT INTO txn_table VALUES (7)\; COMMIT\; INSERT INTO txn_table VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error WARNING: there is no transaction in progress ERROR: COMMIT AND CHAIN can only be used in transaction blocks -INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error +INSERT INTO txn_table VALUES (9)\; ROLLBACK\; INSERT INTO txn_table VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error WARNING: there is no transaction in progress ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks -- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK -INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached +INSERT INTO txn_table VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO txn_table VALUES (12)\; COMMIT; -- 11 error, 12 not reached ERROR: COMMIT AND CHAIN can only be used in transaction blocks -INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached +INSERT INTO txn_table VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO txn_table VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks -- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (15)\; COMMIT AND CHAIN; -- 15 ok SHOW transaction_isolation; -- transaction is active at this point transaction_isolation ----------------------- @@ -1112,7 +1112,7 @@ SHOW transaction_isolation; -- transaction is active at this point (1 row) COMMIT; -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok SHOW transaction_isolation; -- transaction is active at this point transaction_isolation ----------------------- @@ -1122,7 +1122,7 @@ SHOW transaction_isolation; -- transaction is active at this point ROLLBACK; SET default_transaction_isolation = 'read committed'; -- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (17)\; COMMIT\; INSERT INTO txn_table VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error ERROR: COMMIT AND CHAIN can only be used in transaction blocks SHOW transaction_isolation; -- out of transaction block transaction_isolation @@ -1130,7 +1130,7 @@ SHOW transaction_isolation; -- out of transaction block read committed (1 row) -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (19)\; ROLLBACK\; INSERT INTO txn_table VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks SHOW transaction_isolation; -- out of transaction block transaction_isolation @@ -1139,7 +1139,7 @@ SHOW transaction_isolation; -- out of transaction block (1 row) RESET default_transaction_isolation; -SELECT * FROM abc ORDER BY 1; +SELECT * FROM txn_table ORDER BY 1; a ---- 7 @@ -1147,7 +1147,7 @@ SELECT * FROM abc ORDER BY 1; 17 (3 rows) -DROP TABLE abc; +DROP TABLE txn_table; -- Test for successful cleanup of an aborted transaction at session exit. -- THIS MUST BE THE LAST TEST IN THIS FILE. begin; diff --git a/src/test/regress/sql/transactions.sql b/src/test/regress/sql/transactions.sql index 7ee5f6aaa55a686f5484664c3fae224c08bde42a..fd1b645403868da18f9f79b4ba8a03a3f7d1da6b 100644 --- a/src/test/regress/sql/transactions.sql +++ b/src/test/regress/sql/transactions.sql @@ -378,10 +378,10 @@ drop function inverse(int); begin; savepoint x; -create table abc (a int); -insert into abc values (5); -insert into abc values (10); -declare foo cursor for select * from abc; +create table txn_table (a int); +insert into txn_table values (5); +insert into txn_table values (10); +declare foo cursor for select * from txn_table; fetch from foo; rollback to x; @@ -391,11 +391,11 @@ commit; begin; -create table abc (a int); -insert into abc values (5); -insert into abc values (10); -insert into abc values (15); -declare foo cursor for select * from abc; +create table txn_table (a int); +insert into txn_table values (5); +insert into txn_table values (10); +insert into txn_table values (15); +declare foo cursor for select * from txn_table; fetch from foo; @@ -441,7 +441,7 @@ DROP FUNCTION invert(x float8); -- Tests for AND CHAIN -CREATE TABLE abc (a int); +CREATE TABLE txn_table (a int); -- set nondefault value so we have something to override below SET default_transaction_read_only = on; @@ -450,19 +450,19 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; -INSERT INTO abc VALUES (1); -INSERT INTO abc VALUES (2); +INSERT INTO txn_table VALUES (1); +INSERT INTO txn_table VALUES (2); COMMIT AND CHAIN; -- TBLOCK_END SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; -INSERT INTO abc VALUES ('error'); -INSERT INTO abc VALUES (3); -- check it's really aborted +INSERT INTO txn_table VALUES ('error'); +INSERT INTO txn_table VALUES (3); -- check it's really aborted COMMIT AND CHAIN; -- TBLOCK_ABORT_END SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; -INSERT INTO abc VALUES (4); +INSERT INTO txn_table VALUES (4); COMMIT; START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; @@ -470,12 +470,12 @@ SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; SAVEPOINT x; -INSERT INTO abc VALUES ('error'); +INSERT INTO txn_table VALUES ('error'); COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; -INSERT INTO abc VALUES (5); +INSERT INTO txn_table VALUES (5); COMMIT; START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE; @@ -494,12 +494,12 @@ START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE; SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; -INSERT INTO abc VALUES (6); +INSERT INTO txn_table VALUES (6); ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING SHOW transaction_isolation; SHOW transaction_read_only; SHOW transaction_deferrable; -INSERT INTO abc VALUES ('error'); +INSERT INTO txn_table VALUES ('error'); ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END SHOW transaction_isolation; SHOW transaction_read_only; @@ -510,11 +510,11 @@ ROLLBACK; COMMIT AND CHAIN; -- error ROLLBACK AND CHAIN; -- error -SELECT * FROM abc ORDER BY 1; +SELECT * FROM txn_table ORDER BY 1; RESET default_transaction_read_only; -DROP TABLE abc; +DROP TABLE txn_table; -- Test assorted behaviors around the implicit transaction block created @@ -579,39 +579,39 @@ SHOW transaction_read_only; SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error SHOW transaction_read_only; -CREATE TABLE abc (a int); +CREATE TABLE txn_table (a int); -- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN -INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error -INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error +INSERT INTO txn_table VALUES (7)\; COMMIT\; INSERT INTO txn_table VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error +INSERT INTO txn_table VALUES (9)\; ROLLBACK\; INSERT INTO txn_table VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error -- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK -INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached -INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached +INSERT INTO txn_table VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO txn_table VALUES (12)\; COMMIT; -- 11 error, 12 not reached +INSERT INTO txn_table VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO txn_table VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached -- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (15)\; COMMIT AND CHAIN; -- 15 ok SHOW transaction_isolation; -- transaction is active at this point COMMIT; -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok SHOW transaction_isolation; -- transaction is active at this point ROLLBACK; SET default_transaction_isolation = 'read committed'; -- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (17)\; COMMIT\; INSERT INTO txn_table VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error SHOW transaction_isolation; -- out of transaction block -START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error +START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO txn_table VALUES (19)\; ROLLBACK\; INSERT INTO txn_table VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error SHOW transaction_isolation; -- out of transaction block RESET default_transaction_isolation; -SELECT * FROM abc ORDER BY 1; +SELECT * FROM txn_table ORDER BY 1; -DROP TABLE abc; +DROP TABLE txn_table; -- Test for successful cleanup of an aborted transaction at session exit.
^ permalink raw reply [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-17 05:39  Michael Paquier <michael@paquier.xyz>
  parent: Marina Polyakova <m.polyakova@postgrespro.ru>
  0 siblings, 1 reply; 12+ messages in thread

From: Michael Paquier @ 2023-05-17 05:39 UTC (permalink / raw)
  To: Marina Polyakova <m.polyakova@postgrespro.ru>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On Tue, May 16, 2023 at 11:02:45AM +0300, Marina Polyakova wrote:
> It confuses me a little that different methods are used for the same
> purpose. But the namespace test checks schemas. So see
> diff_abc_to_txn_table.patch which replaces abc with txn_table in the
> transaction test.

Looks OK seen from here.  Thanks!
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-19 06:03  Michael Paquier <michael@paquier.xyz>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 12+ messages in thread

From: Michael Paquier @ 2023-05-19 06:03 UTC (permalink / raw)
  To: Marina Polyakova <m.polyakova@postgrespro.ru>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On Wed, May 17, 2023 at 02:39:10PM +0900, Michael Paquier wrote:
> On Tue, May 16, 2023 at 11:02:45AM +0300, Marina Polyakova wrote:
>> It confuses me a little that different methods are used for the same
>> purpose. But the namespace test checks schemas. So see
>> diff_abc_to_txn_table.patch which replaces abc with txn_table in the
>> transaction test.
> 
> Looks OK seen from here.  Thanks!

FYI, the buildfarm is seeing some spurious failures as well:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-19 04%3A29%3A42
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-19 06:39  Marina Polyakova <m.polyakova@postgrespro.ru>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 12+ messages in thread

From: Marina Polyakova @ 2023-05-19 06:39 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On 2023-05-19 09:03, Michael Paquier wrote:
> On Wed, May 17, 2023 at 02:39:10PM +0900, Michael Paquier wrote:
>> On Tue, May 16, 2023 at 11:02:45AM +0300, Marina Polyakova wrote:
>>> It confuses me a little that different methods are used for the same
>>> purpose. But the namespace test checks schemas. So see
>>> diff_abc_to_txn_table.patch which replaces abc with txn_table in the
>>> transaction test.
>> 
>> Looks OK seen from here.  Thanks!
> 
> FYI, the buildfarm is seeing some spurious failures as well:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-19
> 04%3A29%3A42
> --
> Michael

Yes, it is the same error. Here's another one in version 13:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-18%2022:37:49

-- 
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-19 14:59  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Marina Polyakova <m.polyakova@postgrespro.ru>
  0 siblings, 1 reply; 12+ messages in thread

From: Tom Lane @ 2023-05-19 14:59 UTC (permalink / raw)
  To: Marina Polyakova <m.polyakova@postgrespro.ru>; +Cc: Michael Paquier <michael@paquier.xyz>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

Marina Polyakova <m.polyakova@postgrespro.ru> writes:
> On 2023-05-19 09:03, Michael Paquier wrote:
>> FYI, the buildfarm is seeing some spurious failures as well:
>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-1904%3A29%3A42

> Yes, it is the same error. Here's another one in version 13:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-18%2022:37:49

Right.  I went ahead and pushed the fix in hopes of stabilizing things.
(I went with "trans_abc" as the new table name, for consistency with
some other nearby names.)

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 12+ messages in thread

* Re: Conflict between regression tests namespace & transactions due to recent changes
@ 2023-05-19 16:34  Marina Polyakova <m.polyakova@postgrespro.ru>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 12+ messages in thread

From: Marina Polyakova @ 2023-05-19 16:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael@paquier.xyz>; pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>; exclusion@gmail.com

On 2023-05-19 17:59, Tom Lane wrote:
> Marina Polyakova <m.polyakova@postgrespro.ru> writes:
>> On 2023-05-19 09:03, Michael Paquier wrote:
>>> FYI, the buildfarm is seeing some spurious failures as well:
>>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-1904%3A29%3A42
> 
>> Yes, it is the same error. Here's another one in version 13:
>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=schnauzer&dt=2023-05-18%2022:37:49
> 
> Right.  I went ahead and pushed the fix in hopes of stabilizing things.
> (I went with "trans_abc" as the new table name, for consistency with
> some other nearby names.)
> 
> 			regards, tom lane

Thank you! I missed the same changes in version 11 :(

-- 
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company





^ permalink  raw  reply  [nested|flat] 12+ messages in thread


end of thread, other threads:[~2023-05-19 16:34 UTC | newest]

Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 15:27 Conflict between regression tests namespace & transactions due to recent changes Marina Polyakova <m.polyakova@postgrespro.ru>
2023-05-15 16:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-05-15 20:23   ` Marina Polyakova <m.polyakova@postgrespro.ru>
2023-05-15 23:19     ` Michael Paquier <michael@paquier.xyz>
2023-05-16 08:02       ` Marina Polyakova <m.polyakova@postgrespro.ru>
2023-05-17 05:39         ` Michael Paquier <michael@paquier.xyz>
2023-05-19 06:03           ` Michael Paquier <michael@paquier.xyz>
2023-05-19 06:39             ` Marina Polyakova <m.polyakova@postgrespro.ru>
2023-05-19 14:59               ` Tom Lane <tgl@sss.pgh.pa.us>
2023-05-19 16:34                 ` Marina Polyakova <m.polyakova@postgrespro.ru>
2023-05-16 05:03   ` Noah Misch <noah@leadboat.com>
2023-05-16 05:19     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox