Skip to content

Commit 4cdda71

Browse files
committed
Avoid naming conflict between transactions.sql and namespace.sql.
Commits 681d9e4 et al added a test case in namespace.sql that implicitly relied on there not being a table "public.abc". However, the concurrently-run transactions.sql test creates precisely such a table, so with the right timing you'd get a failure. Creating a table named as generically as "abc" in a common schema seems like bad practice, so fix this by changing the name of transactions.sql's table. (Compare 2cf8c7a.) Marina Polyakova Discussion: https://postgr.es/m/80d0201636665d82185942e7112257b4@postgrespro.ru
1 parent e725802 commit 4cdda71

File tree

2 files changed

+70
-70
lines changed

2 files changed

+70
-70
lines changed

src/test/regress/expected/transactions.out

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,10 @@ drop function inverse(int);
571571
-- performed in the aborted subtransaction
572572
begin;
573573
savepoint x;
574-
create table abc (a int);
575-
insert into abc values (5);
576-
insert into abc values (10);
577-
declare foo cursor for select * from abc;
574+
create table trans_abc (a int);
575+
insert into trans_abc values (5);
576+
insert into trans_abc values (10);
577+
declare foo cursor for select * from trans_abc;
578578
fetch from foo;
579579
a
580580
---
@@ -587,11 +587,11 @@ fetch from foo;
587587
ERROR: cursor "foo" does not exist
588588
commit;
589589
begin;
590-
create table abc (a int);
591-
insert into abc values (5);
592-
insert into abc values (10);
593-
insert into abc values (15);
594-
declare foo cursor for select * from abc;
590+
create table trans_abc (a int);
591+
insert into trans_abc values (5);
592+
insert into trans_abc values (10);
593+
insert into trans_abc values (15);
594+
declare foo cursor for select * from trans_abc;
595595
fetch from foo;
596596
a
597597
---
@@ -660,7 +660,7 @@ COMMIT;
660660
DROP FUNCTION create_temp_tab();
661661
DROP FUNCTION invert(x float8);
662662
-- Tests for AND CHAIN
663-
CREATE TABLE abc (a int);
663+
CREATE TABLE trans_abc (a int);
664664
-- set nondefault value so we have something to override below
665665
SET default_transaction_read_only = on;
666666
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
@@ -682,8 +682,8 @@ SHOW transaction_deferrable;
682682
on
683683
(1 row)
684684

685-
INSERT INTO abc VALUES (1);
686-
INSERT INTO abc VALUES (2);
685+
INSERT INTO trans_abc VALUES (1);
686+
INSERT INTO trans_abc VALUES (2);
687687
COMMIT AND CHAIN; -- TBLOCK_END
688688
SHOW transaction_isolation;
689689
transaction_isolation
@@ -703,11 +703,11 @@ SHOW transaction_deferrable;
703703
on
704704
(1 row)
705705

706-
INSERT INTO abc VALUES ('error');
706+
INSERT INTO trans_abc VALUES ('error');
707707
ERROR: invalid input syntax for type integer: "error"
708-
LINE 1: INSERT INTO abc VALUES ('error');
709-
^
710-
INSERT INTO abc VALUES (3); -- check it's really aborted
708+
LINE 1: INSERT INTO trans_abc VALUES ('error');
709+
^
710+
INSERT INTO trans_abc VALUES (3); -- check it's really aborted
711711
ERROR: current transaction is aborted, commands ignored until end of transaction block
712712
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
713713
SHOW transaction_isolation;
@@ -728,7 +728,7 @@ SHOW transaction_deferrable;
728728
on
729729
(1 row)
730730

731-
INSERT INTO abc VALUES (4);
731+
INSERT INTO trans_abc VALUES (4);
732732
COMMIT;
733733
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
734734
SHOW transaction_isolation;
@@ -750,10 +750,10 @@ SHOW transaction_deferrable;
750750
(1 row)
751751

752752
SAVEPOINT x;
753-
INSERT INTO abc VALUES ('error');
753+
INSERT INTO trans_abc VALUES ('error');
754754
ERROR: invalid input syntax for type integer: "error"
755-
LINE 1: INSERT INTO abc VALUES ('error');
756-
^
755+
LINE 1: INSERT INTO trans_abc VALUES ('error');
756+
^
757757
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
758758
SHOW transaction_isolation;
759759
transaction_isolation
@@ -773,7 +773,7 @@ SHOW transaction_deferrable;
773773
on
774774
(1 row)
775775

776-
INSERT INTO abc VALUES (5);
776+
INSERT INTO trans_abc VALUES (5);
777777
COMMIT;
778778
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
779779
SHOW transaction_isolation;
@@ -835,7 +835,7 @@ SHOW transaction_deferrable;
835835
off
836836
(1 row)
837837

838-
INSERT INTO abc VALUES (6);
838+
INSERT INTO trans_abc VALUES (6);
839839
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
840840
SHOW transaction_isolation;
841841
transaction_isolation
@@ -855,10 +855,10 @@ SHOW transaction_deferrable;
855855
off
856856
(1 row)
857857

858-
INSERT INTO abc VALUES ('error');
858+
INSERT INTO trans_abc VALUES ('error');
859859
ERROR: invalid input syntax for type integer: "error"
860-
LINE 1: INSERT INTO abc VALUES ('error');
861-
^
860+
LINE 1: INSERT INTO trans_abc VALUES ('error');
861+
^
862862
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
863863
SHOW transaction_isolation;
864864
transaction_isolation
@@ -884,7 +884,7 @@ COMMIT AND CHAIN; -- error
884884
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
885885
ROLLBACK AND CHAIN; -- error
886886
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
887-
SELECT * FROM abc ORDER BY 1;
887+
SELECT * FROM trans_abc ORDER BY 1;
888888
a
889889
---
890890
1
@@ -894,7 +894,7 @@ SELECT * FROM abc ORDER BY 1;
894894
(4 rows)
895895

896896
RESET default_transaction_read_only;
897-
DROP TABLE abc;
897+
DROP TABLE trans_abc;
898898
-- Test assorted behaviors around the implicit transaction block created
899899
-- when multiple SQL commands are sent in a single Query message. These
900900
-- tests rely on the fact that psql will not break SQL commands apart at a
@@ -996,29 +996,29 @@ SHOW transaction_read_only;
996996
off
997997
(1 row)
998998

999-
CREATE TABLE abc (a int);
999+
CREATE TABLE trans_abc (a int);
10001000
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1001-
INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
1001+
INSERT INTO trans_abc VALUES (7)\; COMMIT\; INSERT INTO trans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
10021002
WARNING: there is no transaction in progress
10031003
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1004-
INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
1004+
INSERT INTO trans_abc VALUES (9)\; ROLLBACK\; INSERT INTO trans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
10051005
WARNING: there is no transaction in progress
10061006
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
10071007
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
1008-
INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
1008+
INSERT INTO trans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO trans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
10091009
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1010-
INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
1010+
INSERT INTO trans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO trans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
10111011
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
10121012
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
1013-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
1013+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
10141014
SHOW transaction_isolation; -- transaction is active at this point
10151015
transaction_isolation
10161016
-----------------------
10171017
repeatable read
10181018
(1 row)
10191019

10201020
COMMIT;
1021-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
1021+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
10221022
SHOW transaction_isolation; -- transaction is active at this point
10231023
transaction_isolation
10241024
-----------------------
@@ -1028,15 +1028,15 @@ SHOW transaction_isolation; -- transaction is active at this point
10281028
ROLLBACK;
10291029
SET default_transaction_isolation = 'read committed';
10301030
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1031-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
1031+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (17)\; COMMIT\; INSERT INTO trans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
10321032
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
10331033
SHOW transaction_isolation; -- out of transaction block
10341034
transaction_isolation
10351035
-----------------------
10361036
read committed
10371037
(1 row)
10381038

1039-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
1039+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (19)\; ROLLBACK\; INSERT INTO trans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
10401040
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
10411041
SHOW transaction_isolation; -- out of transaction block
10421042
transaction_isolation
@@ -1045,15 +1045,15 @@ SHOW transaction_isolation; -- out of transaction block
10451045
(1 row)
10461046

10471047
RESET default_transaction_isolation;
1048-
SELECT * FROM abc ORDER BY 1;
1048+
SELECT * FROM trans_abc ORDER BY 1;
10491049
a
10501050
----
10511051
7
10521052
15
10531053
17
10541054
(3 rows)
10551055

1056-
DROP TABLE abc;
1056+
DROP TABLE trans_abc;
10571057
-- Test for successful cleanup of an aborted transaction at session exit.
10581058
-- THIS MUST BE THE LAST TEST IN THIS FILE.
10591059
begin;

src/test/regress/sql/transactions.sql

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -358,10 +358,10 @@ drop function inverse(int);
358358
begin;
359359

360360
savepoint x;
361-
create table abc (a int);
362-
insert into abc values (5);
363-
insert into abc values (10);
364-
declare foo cursor for select * from abc;
361+
create table trans_abc (a int);
362+
insert into trans_abc values (5);
363+
insert into trans_abc values (10);
364+
declare foo cursor for select * from trans_abc;
365365
fetch from foo;
366366
rollback to x;
367367

@@ -371,11 +371,11 @@ commit;
371371

372372
begin;
373373

374-
create table abc (a int);
375-
insert into abc values (5);
376-
insert into abc values (10);
377-
insert into abc values (15);
378-
declare foo cursor for select * from abc;
374+
create table trans_abc (a int);
375+
insert into trans_abc values (5);
376+
insert into trans_abc values (10);
377+
insert into trans_abc values (15);
378+
declare foo cursor for select * from trans_abc;
379379

380380
fetch from foo;
381381

@@ -421,7 +421,7 @@ DROP FUNCTION invert(x float8);
421421

422422
-- Tests for AND CHAIN
423423

424-
CREATE TABLE abc (a int);
424+
CREATE TABLE trans_abc (a int);
425425

426426
-- set nondefault value so we have something to override below
427427
SET default_transaction_read_only = on;
@@ -430,32 +430,32 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
430430
SHOW transaction_isolation;
431431
SHOW transaction_read_only;
432432
SHOW transaction_deferrable;
433-
INSERT INTO abc VALUES (1);
434-
INSERT INTO abc VALUES (2);
433+
INSERT INTO trans_abc VALUES (1);
434+
INSERT INTO trans_abc VALUES (2);
435435
COMMIT AND CHAIN; -- TBLOCK_END
436436
SHOW transaction_isolation;
437437
SHOW transaction_read_only;
438438
SHOW transaction_deferrable;
439-
INSERT INTO abc VALUES ('error');
440-
INSERT INTO abc VALUES (3); -- check it's really aborted
439+
INSERT INTO trans_abc VALUES ('error');
440+
INSERT INTO trans_abc VALUES (3); -- check it's really aborted
441441
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
442442
SHOW transaction_isolation;
443443
SHOW transaction_read_only;
444444
SHOW transaction_deferrable;
445-
INSERT INTO abc VALUES (4);
445+
INSERT INTO trans_abc VALUES (4);
446446
COMMIT;
447447

448448
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
449449
SHOW transaction_isolation;
450450
SHOW transaction_read_only;
451451
SHOW transaction_deferrable;
452452
SAVEPOINT x;
453-
INSERT INTO abc VALUES ('error');
453+
INSERT INTO trans_abc VALUES ('error');
454454
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
455455
SHOW transaction_isolation;
456456
SHOW transaction_read_only;
457457
SHOW transaction_deferrable;
458-
INSERT INTO abc VALUES (5);
458+
INSERT INTO trans_abc VALUES (5);
459459
COMMIT;
460460

461461
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
@@ -474,12 +474,12 @@ START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE;
474474
SHOW transaction_isolation;
475475
SHOW transaction_read_only;
476476
SHOW transaction_deferrable;
477-
INSERT INTO abc VALUES (6);
477+
INSERT INTO trans_abc VALUES (6);
478478
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
479479
SHOW transaction_isolation;
480480
SHOW transaction_read_only;
481481
SHOW transaction_deferrable;
482-
INSERT INTO abc VALUES ('error');
482+
INSERT INTO trans_abc VALUES ('error');
483483
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
484484
SHOW transaction_isolation;
485485
SHOW transaction_read_only;
@@ -490,11 +490,11 @@ ROLLBACK;
490490
COMMIT AND CHAIN; -- error
491491
ROLLBACK AND CHAIN; -- error
492492

493-
SELECT * FROM abc ORDER BY 1;
493+
SELECT * FROM trans_abc ORDER BY 1;
494494

495495
RESET default_transaction_read_only;
496496

497-
DROP TABLE abc;
497+
DROP TABLE trans_abc;
498498

499499

500500
-- Test assorted behaviors around the implicit transaction block created
@@ -559,39 +559,39 @@ SHOW transaction_read_only;
559559
SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error
560560
SHOW transaction_read_only;
561561

562-
CREATE TABLE abc (a int);
562+
CREATE TABLE trans_abc (a int);
563563

564564
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
565-
INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
566-
INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
565+
INSERT INTO trans_abc VALUES (7)\; COMMIT\; INSERT INTO trans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
566+
INSERT INTO trans_abc VALUES (9)\; ROLLBACK\; INSERT INTO trans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
567567

568568
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
569-
INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
570-
INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
569+
INSERT INTO trans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO trans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
570+
INSERT INTO trans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO trans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
571571

572572
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
573-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
573+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
574574
SHOW transaction_isolation; -- transaction is active at this point
575575
COMMIT;
576576

577-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
577+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
578578
SHOW transaction_isolation; -- transaction is active at this point
579579
ROLLBACK;
580580

581581
SET default_transaction_isolation = 'read committed';
582582

583583
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
584-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
584+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (17)\; COMMIT\; INSERT INTO trans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
585585
SHOW transaction_isolation; -- out of transaction block
586586

587-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
587+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (19)\; ROLLBACK\; INSERT INTO trans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
588588
SHOW transaction_isolation; -- out of transaction block
589589

590590
RESET default_transaction_isolation;
591591

592-
SELECT * FROM abc ORDER BY 1;
592+
SELECT * FROM trans_abc ORDER BY 1;
593593

594-
DROP TABLE abc;
594+
DROP TABLE trans_abc;
595595

596596

597597
-- Test for successful cleanup of an aborted transaction at session exit.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy