Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d3c0b1

Browse files
committed
Avoid naming conflict between transactions.sql and namespace.sql.
Commits681d9e4 et al added a test case in namespace.sql thatimplicitly relied on there not being a table "public.abc".However, the concurrently-run transactions.sql test creates preciselysuch a table, so with the right timing you'd get a failure.Creating a table named as generically as "abc" in a common schemaseems like bad practice, so fix this by changing the name oftransactions.sql's table. (Compare2cf8c7a.)Marina PolyakovaDiscussion:https://postgr.es/m/80d0201636665d82185942e7112257b4@postgrespro.ru
1 parent6c512fc commit7d3c0b1

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 tableabc (a int);
575-
insert intoabc values (5);
576-
insert intoabc values (10);
577-
declare foo cursor for select * fromabc;
574+
create tabletrans_abc (a int);
575+
insert intotrans_abc values (5);
576+
insert intotrans_abc values (10);
577+
declare foo cursor for select * fromtrans_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 tableabc (a int);
591-
insert intoabc values (5);
592-
insert intoabc values (10);
593-
insert intoabc values (15);
594-
declare foo cursor for select * fromabc;
590+
create tabletrans_abc (a int);
591+
insert intotrans_abc values (5);
592+
insert intotrans_abc values (10);
593+
insert intotrans_abc values (15);
594+
declare foo cursor for select * fromtrans_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 TABLEabc (a int);
663+
CREATE TABLEtrans_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 INTOabc VALUES (1);
686-
INSERT INTOabc VALUES (2);
685+
INSERT INTOtrans_abc VALUES (1);
686+
INSERT INTOtrans_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 INTOabc VALUES ('error');
706+
INSERT INTOtrans_abc VALUES ('error');
707707
ERROR: invalid input syntax for type integer: "error"
708-
LINE 1: INSERT INTOabc VALUES ('error');
709-
^
710-
INSERT INTOabc VALUES (3); -- check it's really aborted
708+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
709+
^
710+
INSERT INTOtrans_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 INTOabc VALUES (4);
731+
INSERT INTOtrans_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 INTOabc VALUES ('error');
753+
INSERT INTOtrans_abc VALUES ('error');
754754
ERROR: invalid input syntax for type integer: "error"
755-
LINE 1: INSERT INTOabc VALUES ('error');
756-
^
755+
LINE 1: INSERT INTOtrans_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 INTOabc VALUES (5);
776+
INSERT INTOtrans_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 INTOabc VALUES (6);
838+
INSERT INTOtrans_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 INTOabc VALUES ('error');
858+
INSERT INTOtrans_abc VALUES ('error');
859859
ERROR: invalid input syntax for type integer: "error"
860-
LINE 1: INSERT INTOabc VALUES ('error');
861-
^
860+
LINE 1: INSERT INTOtrans_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 * FROMabc ORDER BY 1;
887+
SELECT * FROMtrans_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 TABLEabc;
897+
DROP TABLEtrans_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 TABLEabc (a int);
999+
CREATE TABLEtrans_abc (a int);
10001000
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1001-
INSERT INTOabc VALUES (7)\; COMMIT\; INSERT INTOabc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
1001+
INSERT INTOtrans_abc VALUES (7)\; COMMIT\; INSERT INTOtrans_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 INTOabc VALUES (9)\; ROLLBACK\; INSERT INTOabc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
1004+
INSERT INTOtrans_abc VALUES (9)\; ROLLBACK\; INSERT INTOtrans_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 INTOabc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTOabc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
1008+
INSERT INTOtrans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTOtrans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
10091009
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1010-
INSERT INTOabc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTOabc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
1010+
INSERT INTOtrans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTOtrans_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 INTOabc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
1013+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_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 INTOabc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
1021+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
10221022
SHOW transaction_isolation; -- transaction is active at this point
10231023
transaction_isolation
10241024
-----------------------
@@ -1027,31 +1027,31 @@ SHOW transaction_isolation; -- transaction is active at this point
10271027

10281028
ROLLBACK;
10291029
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1030-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (17)\; COMMIT\; INSERT INTOabc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
1030+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (17)\; COMMIT\; INSERT INTOtrans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
10311031
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
10321032
SHOW transaction_isolation; -- out of transaction block
10331033
transaction_isolation
10341034
-----------------------
10351035
read committed
10361036
(1 row)
10371037

1038-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (19)\; ROLLBACK\; INSERT INTOabc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
1038+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (19)\; ROLLBACK\; INSERT INTOtrans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
10391039
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
10401040
SHOW transaction_isolation; -- out of transaction block
10411041
transaction_isolation
10421042
-----------------------
10431043
read committed
10441044
(1 row)
10451045

1046-
SELECT * FROMabc ORDER BY 1;
1046+
SELECT * FROMtrans_abc ORDER BY 1;
10471047
a
10481048
----
10491049
7
10501050
15
10511051
17
10521052
(3 rows)
10531053

1054-
DROP TABLEabc;
1054+
DROP TABLEtrans_abc;
10551055
-- Test for successful cleanup of an aborted transaction at session exit.
10561056
-- THIS MUST BE THE LAST TEST IN THIS FILE.
10571057
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-
createtableabc (aint);
362-
insert intoabcvalues (5);
363-
insert intoabcvalues (10);
364-
declare foo cursor forselect*fromabc;
361+
createtabletrans_abc (aint);
362+
insert intotrans_abcvalues (5);
363+
insert intotrans_abcvalues (10);
364+
declare foo cursor forselect*fromtrans_abc;
365365
fetchfrom foo;
366366
rollback to x;
367367

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

372372
begin;
373373

374-
createtableabc (aint);
375-
insert intoabcvalues (5);
376-
insert intoabcvalues (10);
377-
insert intoabcvalues (15);
378-
declare foo cursor forselect*fromabc;
374+
createtabletrans_abc (aint);
375+
insert intotrans_abcvalues (5);
376+
insert intotrans_abcvalues (10);
377+
insert intotrans_abcvalues (15);
378+
declare foo cursor forselect*fromtrans_abc;
379379

380380
fetchfrom foo;
381381

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

422422
-- Tests for AND CHAIN
423423

424-
CREATETABLEabc (aint);
424+
CREATETABLEtrans_abc (aint);
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 INTOabcVALUES (1);
434-
INSERT INTOabcVALUES (2);
433+
INSERT INTOtrans_abcVALUES (1);
434+
INSERT INTOtrans_abcVALUES (2);
435435
COMMITAND CHAIN;-- TBLOCK_END
436436
SHOW transaction_isolation;
437437
SHOW transaction_read_only;
438438
SHOW transaction_deferrable;
439-
INSERT INTOabcVALUES ('error');
440-
INSERT INTOabcVALUES (3);-- check it's really aborted
439+
INSERT INTOtrans_abcVALUES ('error');
440+
INSERT INTOtrans_abcVALUES (3);-- check it's really aborted
441441
COMMITAND CHAIN;-- TBLOCK_ABORT_END
442442
SHOW transaction_isolation;
443443
SHOW transaction_read_only;
444444
SHOW transaction_deferrable;
445-
INSERT INTOabcVALUES (4);
445+
INSERT INTOtrans_abcVALUES (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 INTOabcVALUES ('error');
453+
INSERT INTOtrans_abcVALUES ('error');
454454
COMMITAND CHAIN;-- TBLOCK_ABORT_PENDING
455455
SHOW transaction_isolation;
456456
SHOW transaction_read_only;
457457
SHOW transaction_deferrable;
458-
INSERT INTOabcVALUES (5);
458+
INSERT INTOtrans_abcVALUES (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 INTOabcVALUES (6);
477+
INSERT INTOtrans_abcVALUES (6);
478478
ROLLBACKAND CHAIN;-- TBLOCK_ABORT_PENDING
479479
SHOW transaction_isolation;
480480
SHOW transaction_read_only;
481481
SHOW transaction_deferrable;
482-
INSERT INTOabcVALUES ('error');
482+
INSERT INTOtrans_abcVALUES ('error');
483483
ROLLBACKAND CHAIN;-- TBLOCK_ABORT_END
484484
SHOW transaction_isolation;
485485
SHOW transaction_read_only;
@@ -490,11 +490,11 @@ ROLLBACK;
490490
COMMITAND CHAIN;-- error
491491
ROLLBACKAND CHAIN;-- error
492492

493-
SELECT*FROMabcORDER BY1;
493+
SELECT*FROMtrans_abcORDER BY1;
494494

495495
RESET default_transaction_read_only;
496496

497-
DROPTABLEabc;
497+
DROPTABLEtrans_abc;
498498

499499

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

562-
CREATETABLEabc (aint);
562+
CREATETABLEtrans_abc (aint);
563563

564564
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
565-
INSERT INTOabcVALUES (7)\;COMMIT\;INSERT INTOabcVALUES (8)\;COMMITAND CHAIN;-- 7 commit, 8 error
566-
INSERT INTOabcVALUES (9)\;ROLLBACK\;INSERT INTOabcVALUES (10)\;ROLLBACKAND CHAIN;-- 9 rollback, 10 error
565+
INSERT INTOtrans_abcVALUES (7)\;COMMIT\;INSERT INTOtrans_abcVALUES (8)\;COMMITAND CHAIN;-- 7 commit, 8 error
566+
INSERT INTOtrans_abcVALUES (9)\;ROLLBACK\;INSERT INTOtrans_abcVALUES (10)\;ROLLBACKAND CHAIN;-- 9 rollback, 10 error
567567

568568
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
569-
INSERT INTOabcVALUES (11)\;COMMITAND CHAIN\;INSERT INTOabcVALUES (12)\;COMMIT;-- 11 error, 12 not reached
570-
INSERT INTOabcVALUES (13)\;ROLLBACKAND CHAIN\;INSERT INTOabcVALUES (14)\;ROLLBACK;-- 13 error, 14 not reached
569+
INSERT INTOtrans_abcVALUES (11)\;COMMITAND CHAIN\;INSERT INTOtrans_abcVALUES (12)\;COMMIT;-- 11 error, 12 not reached
570+
INSERT INTOtrans_abcVALUES (13)\;ROLLBACKAND CHAIN\;INSERT INTOtrans_abcVALUES (14)\;ROLLBACK;-- 13 error, 14 not reached
571571

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

577-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOabcVALUES (16)\;ROLLBACKAND CHAIN;-- 16 ok
577+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOtrans_abcVALUES (16)\;ROLLBACKAND CHAIN;-- 16 ok
578578
SHOW transaction_isolation;-- transaction is active at this point
579579
ROLLBACK;
580580

581581
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
582-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOabcVALUES (17)\;COMMIT\;INSERT INTOabcVALUES (18)\;COMMITAND CHAIN;-- 17 commit, 18 error
582+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOtrans_abcVALUES (17)\;COMMIT\;INSERT INTOtrans_abcVALUES (18)\;COMMITAND CHAIN;-- 17 commit, 18 error
583583
SHOW transaction_isolation;-- out of transaction block
584584

585-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOabcVALUES (19)\;ROLLBACK\;INSERT INTOabcVALUES (20)\;ROLLBACKAND CHAIN;-- 19 rollback, 20 error
585+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOtrans_abcVALUES (19)\;ROLLBACK\;INSERT INTOtrans_abcVALUES (20)\;ROLLBACKAND CHAIN;-- 19 rollback, 20 error
586586
SHOW transaction_isolation;-- out of transaction block
587587

588-
SELECT*FROMabcORDER BY1;
588+
SELECT*FROMtrans_abcORDER BY1;
589589

590-
DROPTABLEabc;
590+
DROPTABLEtrans_abc;
591591

592592

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp