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

Commit89f5eb2

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 parent2dd7782 commit89f5eb2

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
@@ -575,10 +575,10 @@ drop function inverse(int);
575575
-- performed in the aborted subtransaction
576576
begin;
577577
savepoint x;
578-
create tableabc (a int);
579-
insert intoabc values (5);
580-
insert intoabc values (10);
581-
declare foo cursor for select * fromabc;
578+
create tabletrans_abc (a int);
579+
insert intotrans_abc values (5);
580+
insert intotrans_abc values (10);
581+
declare foo cursor for select * fromtrans_abc;
582582
fetch from foo;
583583
a
584584
---
@@ -591,11 +591,11 @@ fetch from foo;
591591
ERROR: cursor "foo" does not exist
592592
commit;
593593
begin;
594-
create tableabc (a int);
595-
insert intoabc values (5);
596-
insert intoabc values (10);
597-
insert intoabc values (15);
598-
declare foo cursor for select * fromabc;
594+
create tabletrans_abc (a int);
595+
insert intotrans_abc values (5);
596+
insert intotrans_abc values (10);
597+
insert intotrans_abc values (15);
598+
declare foo cursor for select * fromtrans_abc;
599599
fetch from foo;
600600
a
601601
---
@@ -664,7 +664,7 @@ COMMIT;
664664
DROP FUNCTION create_temp_tab();
665665
DROP FUNCTION invert(x float8);
666666
-- Tests for AND CHAIN
667-
CREATE TABLEabc (a int);
667+
CREATE TABLEtrans_abc (a int);
668668
-- set nondefault value so we have something to override below
669669
SET default_transaction_read_only = on;
670670
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
@@ -686,8 +686,8 @@ SHOW transaction_deferrable;
686686
on
687687
(1 row)
688688

689-
INSERT INTOabc VALUES (1);
690-
INSERT INTOabc VALUES (2);
689+
INSERT INTOtrans_abc VALUES (1);
690+
INSERT INTOtrans_abc VALUES (2);
691691
COMMIT AND CHAIN; -- TBLOCK_END
692692
SHOW transaction_isolation;
693693
transaction_isolation
@@ -707,11 +707,11 @@ SHOW transaction_deferrable;
707707
on
708708
(1 row)
709709

710-
INSERT INTOabc VALUES ('error');
710+
INSERT INTOtrans_abc VALUES ('error');
711711
ERROR: invalid input syntax for type integer: "error"
712-
LINE 1: INSERT INTOabc VALUES ('error');
713-
^
714-
INSERT INTOabc VALUES (3); -- check it's really aborted
712+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
713+
^
714+
INSERT INTOtrans_abc VALUES (3); -- check it's really aborted
715715
ERROR: current transaction is aborted, commands ignored until end of transaction block
716716
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
717717
SHOW transaction_isolation;
@@ -732,7 +732,7 @@ SHOW transaction_deferrable;
732732
on
733733
(1 row)
734734

735-
INSERT INTOabc VALUES (4);
735+
INSERT INTOtrans_abc VALUES (4);
736736
COMMIT;
737737
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
738738
SHOW transaction_isolation;
@@ -754,10 +754,10 @@ SHOW transaction_deferrable;
754754
(1 row)
755755

756756
SAVEPOINT x;
757-
INSERT INTOabc VALUES ('error');
757+
INSERT INTOtrans_abc VALUES ('error');
758758
ERROR: invalid input syntax for type integer: "error"
759-
LINE 1: INSERT INTOabc VALUES ('error');
760-
^
759+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
760+
^
761761
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
762762
SHOW transaction_isolation;
763763
transaction_isolation
@@ -777,7 +777,7 @@ SHOW transaction_deferrable;
777777
on
778778
(1 row)
779779

780-
INSERT INTOabc VALUES (5);
780+
INSERT INTOtrans_abc VALUES (5);
781781
COMMIT;
782782
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
783783
SHOW transaction_isolation;
@@ -839,7 +839,7 @@ SHOW transaction_deferrable;
839839
off
840840
(1 row)
841841

842-
INSERT INTOabc VALUES (6);
842+
INSERT INTOtrans_abc VALUES (6);
843843
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
844844
SHOW transaction_isolation;
845845
transaction_isolation
@@ -859,10 +859,10 @@ SHOW transaction_deferrable;
859859
off
860860
(1 row)
861861

862-
INSERT INTOabc VALUES ('error');
862+
INSERT INTOtrans_abc VALUES ('error');
863863
ERROR: invalid input syntax for type integer: "error"
864-
LINE 1: INSERT INTOabc VALUES ('error');
865-
^
864+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
865+
^
866866
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
867867
SHOW transaction_isolation;
868868
transaction_isolation
@@ -888,7 +888,7 @@ COMMIT AND CHAIN; -- error
888888
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
889889
ROLLBACK AND CHAIN; -- error
890890
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
891-
SELECT * FROMabc ORDER BY 1;
891+
SELECT * FROMtrans_abc ORDER BY 1;
892892
a
893893
---
894894
1
@@ -898,7 +898,7 @@ SELECT * FROM abc ORDER BY 1;
898898
(4 rows)
899899

900900
RESET default_transaction_read_only;
901-
DROP TABLEabc;
901+
DROP TABLEtrans_abc;
902902
-- Test assorted behaviors around the implicit transaction block created
903903
-- when multiple SQL commands are sent in a single Query message. These
904904
-- tests rely on the fact that psql will not break SQL commands apart at a
@@ -1056,29 +1056,29 @@ SHOW transaction_read_only;
10561056
off
10571057
(1 row)
10581058

1059-
CREATE TABLEabc (a int);
1059+
CREATE TABLEtrans_abc (a int);
10601060
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1061-
INSERT INTOabc VALUES (7)\; COMMIT\; INSERT INTOabc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
1061+
INSERT INTOtrans_abc VALUES (7)\; COMMIT\; INSERT INTOtrans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
10621062
WARNING: there is no transaction in progress
10631063
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1064-
INSERT INTOabc VALUES (9)\; ROLLBACK\; INSERT INTOabc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
1064+
INSERT INTOtrans_abc VALUES (9)\; ROLLBACK\; INSERT INTOtrans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
10651065
WARNING: there is no transaction in progress
10661066
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
10671067
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
1068-
INSERT INTOabc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTOabc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
1068+
INSERT INTOtrans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTOtrans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
10691069
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1070-
INSERT INTOabc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTOabc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
1070+
INSERT INTOtrans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTOtrans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
10711071
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
10721072
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
1073-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
1073+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
10741074
SHOW transaction_isolation; -- transaction is active at this point
10751075
transaction_isolation
10761076
-----------------------
10771077
repeatable read
10781078
(1 row)
10791079

10801080
COMMIT;
1081-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
1081+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
10821082
SHOW transaction_isolation; -- transaction is active at this point
10831083
transaction_isolation
10841084
-----------------------
@@ -1088,15 +1088,15 @@ SHOW transaction_isolation; -- transaction is active at this point
10881088
ROLLBACK;
10891089
SET default_transaction_isolation = 'read committed';
10901090
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1091-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (17)\; COMMIT\; INSERT INTOabc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
1091+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (17)\; COMMIT\; INSERT INTOtrans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
10921092
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
10931093
SHOW transaction_isolation; -- out of transaction block
10941094
transaction_isolation
10951095
-----------------------
10961096
read committed
10971097
(1 row)
10981098

1099-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (19)\; ROLLBACK\; INSERT INTOabc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
1099+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (19)\; ROLLBACK\; INSERT INTOtrans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
11001100
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
11011101
SHOW transaction_isolation; -- out of transaction block
11021102
transaction_isolation
@@ -1105,15 +1105,15 @@ SHOW transaction_isolation; -- out of transaction block
11051105
(1 row)
11061106

11071107
RESET default_transaction_isolation;
1108-
SELECT * FROMabc ORDER BY 1;
1108+
SELECT * FROMtrans_abc ORDER BY 1;
11091109
a
11101110
----
11111111
7
11121112
15
11131113
17
11141114
(3 rows)
11151115

1116-
DROP TABLEabc;
1116+
DROP TABLEtrans_abc;
11171117
-- Test for successful cleanup of an aborted transaction at session exit.
11181118
-- THIS MUST BE THE LAST TEST IN THIS FILE.
11191119
begin;

‎src/test/regress/sql/transactions.sql

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

362362
savepoint x;
363-
createtableabc (aint);
364-
insert intoabcvalues (5);
365-
insert intoabcvalues (10);
366-
declare foo cursor forselect*fromabc;
363+
createtabletrans_abc (aint);
364+
insert intotrans_abcvalues (5);
365+
insert intotrans_abcvalues (10);
366+
declare foo cursor forselect*fromtrans_abc;
367367
fetchfrom foo;
368368
rollback to x;
369369

@@ -373,11 +373,11 @@ commit;
373373

374374
begin;
375375

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

382382
fetchfrom foo;
383383

@@ -423,7 +423,7 @@ DROP FUNCTION invert(x float8);
423423

424424
-- Tests for AND CHAIN
425425

426-
CREATETABLEabc (aint);
426+
CREATETABLEtrans_abc (aint);
427427

428428
-- set nondefault value so we have something to override below
429429
SET default_transaction_read_only=on;
@@ -432,32 +432,32 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
432432
SHOW transaction_isolation;
433433
SHOW transaction_read_only;
434434
SHOW transaction_deferrable;
435-
INSERT INTOabcVALUES (1);
436-
INSERT INTOabcVALUES (2);
435+
INSERT INTOtrans_abcVALUES (1);
436+
INSERT INTOtrans_abcVALUES (2);
437437
COMMITAND CHAIN;-- TBLOCK_END
438438
SHOW transaction_isolation;
439439
SHOW transaction_read_only;
440440
SHOW transaction_deferrable;
441-
INSERT INTOabcVALUES ('error');
442-
INSERT INTOabcVALUES (3);-- check it's really aborted
441+
INSERT INTOtrans_abcVALUES ('error');
442+
INSERT INTOtrans_abcVALUES (3);-- check it's really aborted
443443
COMMITAND CHAIN;-- TBLOCK_ABORT_END
444444
SHOW transaction_isolation;
445445
SHOW transaction_read_only;
446446
SHOW transaction_deferrable;
447-
INSERT INTOabcVALUES (4);
447+
INSERT INTOtrans_abcVALUES (4);
448448
COMMIT;
449449

450450
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
451451
SHOW transaction_isolation;
452452
SHOW transaction_read_only;
453453
SHOW transaction_deferrable;
454454
SAVEPOINT x;
455-
INSERT INTOabcVALUES ('error');
455+
INSERT INTOtrans_abcVALUES ('error');
456456
COMMITAND CHAIN;-- TBLOCK_ABORT_PENDING
457457
SHOW transaction_isolation;
458458
SHOW transaction_read_only;
459459
SHOW transaction_deferrable;
460-
INSERT INTOabcVALUES (5);
460+
INSERT INTOtrans_abcVALUES (5);
461461
COMMIT;
462462

463463
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
@@ -476,12 +476,12 @@ START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE;
476476
SHOW transaction_isolation;
477477
SHOW transaction_read_only;
478478
SHOW transaction_deferrable;
479-
INSERT INTOabcVALUES (6);
479+
INSERT INTOtrans_abcVALUES (6);
480480
ROLLBACKAND CHAIN;-- TBLOCK_ABORT_PENDING
481481
SHOW transaction_isolation;
482482
SHOW transaction_read_only;
483483
SHOW transaction_deferrable;
484-
INSERT INTOabcVALUES ('error');
484+
INSERT INTOtrans_abcVALUES ('error');
485485
ROLLBACKAND CHAIN;-- TBLOCK_ABORT_END
486486
SHOW transaction_isolation;
487487
SHOW transaction_read_only;
@@ -492,11 +492,11 @@ ROLLBACK;
492492
COMMITAND CHAIN;-- error
493493
ROLLBACKAND CHAIN;-- error
494494

495-
SELECT*FROMabcORDER BY1;
495+
SELECT*FROMtrans_abcORDER BY1;
496496

497497
RESET default_transaction_read_only;
498498

499-
DROPTABLEabc;
499+
DROPTABLEtrans_abc;
500500

501501

502502
-- Test assorted behaviors around the implicit transaction block created
@@ -561,39 +561,39 @@ SHOW transaction_read_only;
561561
SET TRANSACTION READ ONLY\;ROLLBACKAND CHAIN;-- error
562562
SHOW transaction_read_only;
563563

564-
CREATETABLEabc (aint);
564+
CREATETABLEtrans_abc (aint);
565565

566566
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
567-
INSERT INTOabcVALUES (7)\;COMMIT\;INSERT INTOabcVALUES (8)\;COMMITAND CHAIN;-- 7 commit, 8 error
568-
INSERT INTOabcVALUES (9)\;ROLLBACK\;INSERT INTOabcVALUES (10)\;ROLLBACKAND CHAIN;-- 9 rollback, 10 error
567+
INSERT INTOtrans_abcVALUES (7)\;COMMIT\;INSERT INTOtrans_abcVALUES (8)\;COMMITAND CHAIN;-- 7 commit, 8 error
568+
INSERT INTOtrans_abcVALUES (9)\;ROLLBACK\;INSERT INTOtrans_abcVALUES (10)\;ROLLBACKAND CHAIN;-- 9 rollback, 10 error
569569

570570
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
571-
INSERT INTOabcVALUES (11)\;COMMITAND CHAIN\;INSERT INTOabcVALUES (12)\;COMMIT;-- 11 error, 12 not reached
572-
INSERT INTOabcVALUES (13)\;ROLLBACKAND CHAIN\;INSERT INTOabcVALUES (14)\;ROLLBACK;-- 13 error, 14 not reached
571+
INSERT INTOtrans_abcVALUES (11)\;COMMITAND CHAIN\;INSERT INTOtrans_abcVALUES (12)\;COMMIT;-- 11 error, 12 not reached
572+
INSERT INTOtrans_abcVALUES (13)\;ROLLBACKAND CHAIN\;INSERT INTOtrans_abcVALUES (14)\;ROLLBACK;-- 13 error, 14 not reached
573573

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

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

583583
SET default_transaction_isolation='read committed';
584584

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

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

592592
RESET default_transaction_isolation;
593593

594-
SELECT*FROMabcORDER BY1;
594+
SELECT*FROMtrans_abcORDER BY1;
595595

596-
DROPTABLEabc;
596+
DROPTABLEtrans_abc;
597597

598598

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp