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

Commitb973f93

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 parent803b4a2 commitb973f93

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
@@ -609,10 +609,10 @@ drop function inverse(int);
609609
-- performed in the aborted subtransaction
610610
begin;
611611
savepoint x;
612-
create tableabc (a int);
613-
insert intoabc values (5);
614-
insert intoabc values (10);
615-
declare foo cursor for select * fromabc;
612+
create tabletrans_abc (a int);
613+
insert intotrans_abc values (5);
614+
insert intotrans_abc values (10);
615+
declare foo cursor for select * fromtrans_abc;
616616
fetch from foo;
617617
a
618618
---
@@ -625,11 +625,11 @@ fetch from foo;
625625
ERROR: cursor "foo" does not exist
626626
commit;
627627
begin;
628-
create tableabc (a int);
629-
insert intoabc values (5);
630-
insert intoabc values (10);
631-
insert intoabc values (15);
632-
declare foo cursor for select * fromabc;
628+
create tabletrans_abc (a int);
629+
insert intotrans_abc values (5);
630+
insert intotrans_abc values (10);
631+
insert intotrans_abc values (15);
632+
declare foo cursor for select * fromtrans_abc;
633633
fetch from foo;
634634
a
635635
---
@@ -698,7 +698,7 @@ COMMIT;
698698
DROP FUNCTION create_temp_tab();
699699
DROP FUNCTION invert(x float8);
700700
-- Tests for AND CHAIN
701-
CREATE TABLEabc (a int);
701+
CREATE TABLEtrans_abc (a int);
702702
-- set nondefault value so we have something to override below
703703
SET default_transaction_read_only = on;
704704
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
@@ -720,8 +720,8 @@ SHOW transaction_deferrable;
720720
on
721721
(1 row)
722722

723-
INSERT INTOabc VALUES (1);
724-
INSERT INTOabc VALUES (2);
723+
INSERT INTOtrans_abc VALUES (1);
724+
INSERT INTOtrans_abc VALUES (2);
725725
COMMIT AND CHAIN; -- TBLOCK_END
726726
SHOW transaction_isolation;
727727
transaction_isolation
@@ -741,11 +741,11 @@ SHOW transaction_deferrable;
741741
on
742742
(1 row)
743743

744-
INSERT INTOabc VALUES ('error');
744+
INSERT INTOtrans_abc VALUES ('error');
745745
ERROR: invalid input syntax for type integer: "error"
746-
LINE 1: INSERT INTOabc VALUES ('error');
747-
^
748-
INSERT INTOabc VALUES (3); -- check it's really aborted
746+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
747+
^
748+
INSERT INTOtrans_abc VALUES (3); -- check it's really aborted
749749
ERROR: current transaction is aborted, commands ignored until end of transaction block
750750
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
751751
SHOW transaction_isolation;
@@ -766,7 +766,7 @@ SHOW transaction_deferrable;
766766
on
767767
(1 row)
768768

769-
INSERT INTOabc VALUES (4);
769+
INSERT INTOtrans_abc VALUES (4);
770770
COMMIT;
771771
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
772772
SHOW transaction_isolation;
@@ -788,10 +788,10 @@ SHOW transaction_deferrable;
788788
(1 row)
789789

790790
SAVEPOINT x;
791-
INSERT INTOabc VALUES ('error');
791+
INSERT INTOtrans_abc VALUES ('error');
792792
ERROR: invalid input syntax for type integer: "error"
793-
LINE 1: INSERT INTOabc VALUES ('error');
794-
^
793+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
794+
^
795795
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
796796
SHOW transaction_isolation;
797797
transaction_isolation
@@ -811,7 +811,7 @@ SHOW transaction_deferrable;
811811
on
812812
(1 row)
813813

814-
INSERT INTOabc VALUES (5);
814+
INSERT INTOtrans_abc VALUES (5);
815815
COMMIT;
816816
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
817817
SHOW transaction_isolation;
@@ -873,7 +873,7 @@ SHOW transaction_deferrable;
873873
off
874874
(1 row)
875875

876-
INSERT INTOabc VALUES (6);
876+
INSERT INTOtrans_abc VALUES (6);
877877
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
878878
SHOW transaction_isolation;
879879
transaction_isolation
@@ -893,10 +893,10 @@ SHOW transaction_deferrable;
893893
off
894894
(1 row)
895895

896-
INSERT INTOabc VALUES ('error');
896+
INSERT INTOtrans_abc VALUES ('error');
897897
ERROR: invalid input syntax for type integer: "error"
898-
LINE 1: INSERT INTOabc VALUES ('error');
899-
^
898+
LINE 1: INSERT INTOtrans_abc VALUES ('error');
899+
^
900900
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
901901
SHOW transaction_isolation;
902902
transaction_isolation
@@ -922,7 +922,7 @@ COMMIT AND CHAIN; -- error
922922
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
923923
ROLLBACK AND CHAIN; -- error
924924
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
925-
SELECT * FROMabc ORDER BY 1;
925+
SELECT * FROMtrans_abc ORDER BY 1;
926926
a
927927
---
928928
1
@@ -932,7 +932,7 @@ SELECT * FROM abc ORDER BY 1;
932932
(4 rows)
933933

934934
RESET default_transaction_read_only;
935-
DROP TABLEabc;
935+
DROP TABLEtrans_abc;
936936
-- Test assorted behaviors around the implicit transaction block created
937937
-- when multiple SQL commands are sent in a single Query message. These
938938
-- tests rely on the fact that psql will not break SQL commands apart at a
@@ -1090,29 +1090,29 @@ SHOW transaction_read_only;
10901090
off
10911091
(1 row)
10921092

1093-
CREATE TABLEabc (a int);
1093+
CREATE TABLEtrans_abc (a int);
10941094
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1095-
INSERT INTOabc VALUES (7)\; COMMIT\; INSERT INTOabc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
1095+
INSERT INTOtrans_abc VALUES (7)\; COMMIT\; INSERT INTOtrans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
10961096
WARNING: there is no transaction in progress
10971097
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1098-
INSERT INTOabc VALUES (9)\; ROLLBACK\; INSERT INTOabc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
1098+
INSERT INTOtrans_abc VALUES (9)\; ROLLBACK\; INSERT INTOtrans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
10991099
WARNING: there is no transaction in progress
11001100
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
11011101
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
1102-
INSERT INTOabc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTOabc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
1102+
INSERT INTOtrans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTOtrans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
11031103
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
1104-
INSERT INTOabc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTOabc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
1104+
INSERT INTOtrans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTOtrans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
11051105
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
11061106
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
1107-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
1107+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
11081108
SHOW transaction_isolation; -- transaction is active at this point
11091109
transaction_isolation
11101110
-----------------------
11111111
repeatable read
11121112
(1 row)
11131113

11141114
COMMIT;
1115-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
1115+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
11161116
SHOW transaction_isolation; -- transaction is active at this point
11171117
transaction_isolation
11181118
-----------------------
@@ -1122,15 +1122,15 @@ SHOW transaction_isolation; -- transaction is active at this point
11221122
ROLLBACK;
11231123
SET default_transaction_isolation = 'read committed';
11241124
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
1125-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (17)\; COMMIT\; INSERT INTOabc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
1125+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (17)\; COMMIT\; INSERT INTOtrans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
11261126
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
11271127
SHOW transaction_isolation; -- out of transaction block
11281128
transaction_isolation
11291129
-----------------------
11301130
read committed
11311131
(1 row)
11321132

1133-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOabc VALUES (19)\; ROLLBACK\; INSERT INTOabc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
1133+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTOtrans_abc VALUES (19)\; ROLLBACK\; INSERT INTOtrans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
11341134
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
11351135
SHOW transaction_isolation; -- out of transaction block
11361136
transaction_isolation
@@ -1139,15 +1139,15 @@ SHOW transaction_isolation; -- out of transaction block
11391139
(1 row)
11401140

11411141
RESET default_transaction_isolation;
1142-
SELECT * FROMabc ORDER BY 1;
1142+
SELECT * FROMtrans_abc ORDER BY 1;
11431143
a
11441144
----
11451145
7
11461146
15
11471147
17
11481148
(3 rows)
11491149

1150-
DROP TABLEabc;
1150+
DROP TABLEtrans_abc;
11511151
-- Test for successful cleanup of an aborted transaction at session exit.
11521152
-- THIS MUST BE THE LAST TEST IN THIS FILE.
11531153
begin;

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

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

380380
savepoint x;
381-
createtableabc (aint);
382-
insert intoabcvalues (5);
383-
insert intoabcvalues (10);
384-
declare foo cursor forselect*fromabc;
381+
createtabletrans_abc (aint);
382+
insert intotrans_abcvalues (5);
383+
insert intotrans_abcvalues (10);
384+
declare foo cursor forselect*fromtrans_abc;
385385
fetchfrom foo;
386386
rollback to x;
387387

@@ -391,11 +391,11 @@ commit;
391391

392392
begin;
393393

394-
createtableabc (aint);
395-
insert intoabcvalues (5);
396-
insert intoabcvalues (10);
397-
insert intoabcvalues (15);
398-
declare foo cursor forselect*fromabc;
394+
createtabletrans_abc (aint);
395+
insert intotrans_abcvalues (5);
396+
insert intotrans_abcvalues (10);
397+
insert intotrans_abcvalues (15);
398+
declare foo cursor forselect*fromtrans_abc;
399399

400400
fetchfrom foo;
401401

@@ -441,7 +441,7 @@ DROP FUNCTION invert(x float8);
441441

442442
-- Tests for AND CHAIN
443443

444-
CREATETABLEabc (aint);
444+
CREATETABLEtrans_abc (aint);
445445

446446
-- set nondefault value so we have something to override below
447447
SET default_transaction_read_only=on;
@@ -450,32 +450,32 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
450450
SHOW transaction_isolation;
451451
SHOW transaction_read_only;
452452
SHOW transaction_deferrable;
453-
INSERT INTOabcVALUES (1);
454-
INSERT INTOabcVALUES (2);
453+
INSERT INTOtrans_abcVALUES (1);
454+
INSERT INTOtrans_abcVALUES (2);
455455
COMMITAND CHAIN;-- TBLOCK_END
456456
SHOW transaction_isolation;
457457
SHOW transaction_read_only;
458458
SHOW transaction_deferrable;
459-
INSERT INTOabcVALUES ('error');
460-
INSERT INTOabcVALUES (3);-- check it's really aborted
459+
INSERT INTOtrans_abcVALUES ('error');
460+
INSERT INTOtrans_abcVALUES (3);-- check it's really aborted
461461
COMMITAND CHAIN;-- TBLOCK_ABORT_END
462462
SHOW transaction_isolation;
463463
SHOW transaction_read_only;
464464
SHOW transaction_deferrable;
465-
INSERT INTOabcVALUES (4);
465+
INSERT INTOtrans_abcVALUES (4);
466466
COMMIT;
467467

468468
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
469469
SHOW transaction_isolation;
470470
SHOW transaction_read_only;
471471
SHOW transaction_deferrable;
472472
SAVEPOINT x;
473-
INSERT INTOabcVALUES ('error');
473+
INSERT INTOtrans_abcVALUES ('error');
474474
COMMITAND CHAIN;-- TBLOCK_ABORT_PENDING
475475
SHOW transaction_isolation;
476476
SHOW transaction_read_only;
477477
SHOW transaction_deferrable;
478-
INSERT INTOabcVALUES (5);
478+
INSERT INTOtrans_abcVALUES (5);
479479
COMMIT;
480480

481481
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
@@ -494,12 +494,12 @@ START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE;
494494
SHOW transaction_isolation;
495495
SHOW transaction_read_only;
496496
SHOW transaction_deferrable;
497-
INSERT INTOabcVALUES (6);
497+
INSERT INTOtrans_abcVALUES (6);
498498
ROLLBACKAND CHAIN;-- TBLOCK_ABORT_PENDING
499499
SHOW transaction_isolation;
500500
SHOW transaction_read_only;
501501
SHOW transaction_deferrable;
502-
INSERT INTOabcVALUES ('error');
502+
INSERT INTOtrans_abcVALUES ('error');
503503
ROLLBACKAND CHAIN;-- TBLOCK_ABORT_END
504504
SHOW transaction_isolation;
505505
SHOW transaction_read_only;
@@ -510,11 +510,11 @@ ROLLBACK;
510510
COMMITAND CHAIN;-- error
511511
ROLLBACKAND CHAIN;-- error
512512

513-
SELECT*FROMabcORDER BY1;
513+
SELECT*FROMtrans_abcORDER BY1;
514514

515515
RESET default_transaction_read_only;
516516

517-
DROPTABLEabc;
517+
DROPTABLEtrans_abc;
518518

519519

520520
-- Test assorted behaviors around the implicit transaction block created
@@ -579,39 +579,39 @@ SHOW transaction_read_only;
579579
SET TRANSACTION READ ONLY\;ROLLBACKAND CHAIN;-- error
580580
SHOW transaction_read_only;
581581

582-
CREATETABLEabc (aint);
582+
CREATETABLEtrans_abc (aint);
583583

584584
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
585-
INSERT INTOabcVALUES (7)\;COMMIT\;INSERT INTOabcVALUES (8)\;COMMITAND CHAIN;-- 7 commit, 8 error
586-
INSERT INTOabcVALUES (9)\;ROLLBACK\;INSERT INTOabcVALUES (10)\;ROLLBACKAND CHAIN;-- 9 rollback, 10 error
585+
INSERT INTOtrans_abcVALUES (7)\;COMMIT\;INSERT INTOtrans_abcVALUES (8)\;COMMITAND CHAIN;-- 7 commit, 8 error
586+
INSERT INTOtrans_abcVALUES (9)\;ROLLBACK\;INSERT INTOtrans_abcVALUES (10)\;ROLLBACKAND CHAIN;-- 9 rollback, 10 error
587587

588588
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
589-
INSERT INTOabcVALUES (11)\;COMMITAND CHAIN\;INSERT INTOabcVALUES (12)\;COMMIT;-- 11 error, 12 not reached
590-
INSERT INTOabcVALUES (13)\;ROLLBACKAND CHAIN\;INSERT INTOabcVALUES (14)\;ROLLBACK;-- 13 error, 14 not reached
589+
INSERT INTOtrans_abcVALUES (11)\;COMMITAND CHAIN\;INSERT INTOtrans_abcVALUES (12)\;COMMIT;-- 11 error, 12 not reached
590+
INSERT INTOtrans_abcVALUES (13)\;ROLLBACKAND CHAIN\;INSERT INTOtrans_abcVALUES (14)\;ROLLBACK;-- 13 error, 14 not reached
591591

592592
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
593-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOabcVALUES (15)\;COMMITAND CHAIN;-- 15 ok
593+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOtrans_abcVALUES (15)\;COMMITAND CHAIN;-- 15 ok
594594
SHOW transaction_isolation;-- transaction is active at this point
595595
COMMIT;
596596

597-
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOabcVALUES (16)\;ROLLBACKAND CHAIN;-- 16 ok
597+
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\;INSERT INTOtrans_abcVALUES (16)\;ROLLBACKAND CHAIN;-- 16 ok
598598
SHOW transaction_isolation;-- transaction is active at this point
599599
ROLLBACK;
600600

601601
SET default_transaction_isolation='read committed';
602602

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

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

610610
RESET default_transaction_isolation;
611611

612-
SELECT*FROMabcORDER BY1;
612+
SELECT*FROMtrans_abcORDER BY1;
613613

614-
DROPTABLEabc;
614+
DROPTABLEtrans_abc;
615615

616616

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp