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

Commit2d7d67c

Browse files
committed
Fix random regression failure in test case "temp"
This test case could fail because of an incorrect result ordering whenlooking up at pg_class entries. This commit adds an ORDER BY to theculprit query. The cause of the failure was likely caused by a planswitch. By default, the planner would likely choose an index-only scanor an index scan, but even a small change in the startup cost could havecaused a bitmap heap scan to be chosen, causing the failure.While on it, switch some filtering quals to a regular expression as peran idea of Tom Lane. As previously shaped, the quals would haveselected any relations whose name begins with "temp". And that couldcause failures if another test running in parallel began to use similarrelation names.Per report from buildfarm member anole, though the failure was veryrare. This test has been introduced by319a810, so backpatch down tov10.Discussion:https://postgr.es/m/20190807132422.GC15695@paquier.xyzBackpatch-through: 10
1 parent6754fe6 commit2d7d67c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

‎src/test/regress/expected/temp.out

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ create temp table temp_parted_oncommit_test2
246246
insert into temp_parted_oncommit_test values (1), (2);
247247
commit;
248248
-- no relations remain in this case.
249-
select relname from pg_class where relnamelike 'temp_parted_oncommit_test%';
249+
select relname from pg_class where relname~ '^temp_parted_oncommit_test';
250250
relname
251251
---------
252252
(0 rows)
@@ -273,7 +273,8 @@ select * from temp_parted_oncommit_test;
273273
(1 row)
274274

275275
-- two relations remain in this case.
276-
select relname from pg_class where relname like 'temp_parted_oncommit_test%';
276+
select relname from pg_class where relname ~ '^temp_parted_oncommit_test'
277+
order by relname;
277278
relname
278279
----------------------------
279280
temp_parted_oncommit_test
@@ -290,7 +291,7 @@ create temp table temp_inh_oncommit_test1 ()
290291
insert into temp_inh_oncommit_test1 values (1);
291292
commit;
292293
-- no relations remain in this case
293-
select relname from pg_class where relnamelike 'temp_inh_oncommit_test%';
294+
select relname from pg_class where relname~ '^temp_inh_oncommit_test';
294295
relname
295296
---------
296297
(0 rows)
@@ -309,7 +310,7 @@ select * from temp_inh_oncommit_test;
309310
(0 rows)
310311

311312
-- one relation remains
312-
select relname from pg_class where relnamelike 'temp_inh_oncommit_test%';
313+
select relname from pg_class where relname~ '^temp_inh_oncommit_test';
313314
relname
314315
------------------------
315316
temp_inh_oncommit_test

‎src/test/regress/sql/temp.sql

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ create temp table temp_parted_oncommit_test2
192192
insert into temp_parted_oncommit_testvalues (1), (2);
193193
commit;
194194
-- no relations remain in this case.
195-
select relnamefrom pg_classwhere relnamelike'temp_parted_oncommit_test%';
195+
select relnamefrom pg_classwhere relname~'^temp_parted_oncommit_test';
196196
-- Using ON COMMIT DELETE on a partitioned table does not remove
197197
-- all rows if partitions preserve their data.
198198
begin;
@@ -210,7 +210,8 @@ commit;
210210
-- preserved.
211211
select*from temp_parted_oncommit_test;
212212
-- two relations remain in this case.
213-
select relnamefrom pg_classwhere relnamelike'temp_parted_oncommit_test%';
213+
select relnamefrom pg_classwhere relname ~'^temp_parted_oncommit_test'
214+
order by relname;
214215
droptable temp_parted_oncommit_test;
215216

216217
-- Check dependencies between ON COMMIT actions with inheritance trees.
@@ -222,7 +223,7 @@ create temp table temp_inh_oncommit_test1 ()
222223
insert into temp_inh_oncommit_test1values (1);
223224
commit;
224225
-- no relations remain in this case
225-
select relnamefrom pg_classwhere relnamelike'temp_inh_oncommit_test%';
226+
select relnamefrom pg_classwhere relname~'^temp_inh_oncommit_test';
226227
-- Data on the parent is removed, and the child goes away.
227228
begin;
228229
create temp table temp_inh_oncommit_test (aint)oncommitdelete rows;
@@ -233,7 +234,7 @@ insert into temp_inh_oncommit_test values (1);
233234
commit;
234235
select*from temp_inh_oncommit_test;
235236
-- one relation remains
236-
select relnamefrom pg_classwhere relnamelike'temp_inh_oncommit_test%';
237+
select relnamefrom pg_classwhere relname~'^temp_inh_oncommit_test';
237238
droptable temp_inh_oncommit_test;
238239

239240
-- Tests with two-phase commit

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp