Skip to content

Commit 934630c

Browse files
committed
Fix instability in parallel regression tests.
Commit f0c7b78 added a test case in case.sql that creates and then drops both an '=' operator and the type it's for. Given the right timing, that can cause a "cache lookup failed for type" failure in concurrent sessions, which see the '=' operator as a potential match for '=' in a query, but then 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 a back-patchable solution, adjust the new test case so that the operator is never visible to other sessions. Like the previous commit, back-patch to all supported branches. Discussion: <5983.1471371667@sss.pgh.pa.us>
1 parent 3570ea4 commit 934630c

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
CREATE FUNCTION vol(text) returns text as
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
DROP TABLE CASE_TBL;
202208
DROP TABLE CASE2_TBL;
203-
DROP OPERATOR = (foodomain, foodomain);
204-
DROP FUNCTION inline_eq(foodomain, foodomain);
205-
DROP FUNCTION volfoo(text);
206-
DROP DOMAIN foodomain;
207-
DROP FUNCTION vol(text);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy