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

Commit934630c

Browse files
committed
Fix instability in parallel regression tests.
Commitf0c7b78 added a test case in case.sql that creates and then dropsboth an '=' operator and the type it's for. Given the right timing, thatcan cause a "cache lookup failed for type" failure in concurrent sessions,which see the '=' operator as a potential match for '=' in a query, butthen the type is gone by the time they inquire into its properties.It might be nice to make that behavior more robust someday, but as aback-patchable solution, adjust the new test case so that the operatoris never visible to other sessions. Like the previous commit, back-patchto all supported branches.Discussion: <5983.1471371667@sss.pgh.pa.us>
1 parent3570ea4 commit934630c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,9 @@ SELECT * FROM CASE_TBL;
305305
-- the isNull flag for the case test value incorrectly became true, causing
306306
-- the third WHEN-clause not to match. The volatile function calls are needed
307307
-- to prevent constant-folding in the planner, which would hide the bug.
308+
-- Wrap this in a single transaction so the transient '=' operator doesn't
309+
-- cause problems in concurrent sessions
310+
BEGIN;
308311
CREATE FUNCTION vol(text) returns text as
309312
'begin return $1; end' language plpgsql volatile;
310313
SELECT CASE
@@ -335,13 +338,9 @@ SELECT CASE volfoo('bar') WHEN 'foo'::foodomain THEN 'is foo' ELSE 'is not foo'
335338
is not foo
336339
(1 row)
337340

341+
ROLLBACK;
338342
--
339343
-- Clean up
340344
--
341345
DROP TABLE CASE_TBL;
342346
DROP TABLE CASE2_TBL;
343-
DROP OPERATOR = (foodomain, foodomain);
344-
DROP FUNCTION inline_eq(foodomain, foodomain);
345-
DROP FUNCTION volfoo(text);
346-
DROP DOMAIN foodomain;
347-
DROP FUNCTION vol(text);

‎src/test/regress/sql/case.sql

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ SELECT * FROM CASE_TBL;
167167
-- the third WHEN-clause not to match. The volatile function calls are needed
168168
-- to prevent constant-folding in the planner, which would hide the bug.
169169

170+
-- Wrap this in a single transaction so the transient '=' operator doesn't
171+
-- cause problems in concurrent sessions
172+
BEGIN;
173+
170174
CREATEFUNCTIONvol(text) returnstextas
171175
'begin return $1; end' language plpgsql volatile;
172176

@@ -194,14 +198,11 @@ CREATE OPERATOR = (procedure = inline_eq,
194198

195199
SELECT CASE volfoo('bar') WHEN'foo'::foodomain THEN'is foo' ELSE'is not foo' END;
196200

201+
ROLLBACK;
202+
197203
--
198204
-- Clean up
199205
--
200206

201207
DROPTABLE CASE_TBL;
202208
DROPTABLE CASE2_TBL;
203-
DROPOPERATOR= (foodomain, foodomain);
204-
DROPFUNCTION inline_eq(foodomain, foodomain);
205-
DROPFUNCTION volfoo(text);
206-
DROPDOMAIN foodomain;
207-
DROPFUNCTION vol(text);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp