mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-07 19:47:50 +08:00
Fix instability in parallel regression tests.
Commit f0c7b789a
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>
This commit is contained in:
parent
ae4760d667
commit
2533ff0aa5
@ -305,6 +305,9 @@ SELECT * FROM CASE_TBL;
|
|||||||
-- the isNull flag for the case test value incorrectly became true, causing
|
-- the isNull flag for the case test value incorrectly became true, causing
|
||||||
-- the third WHEN-clause not to match. The volatile function calls are needed
|
-- the third WHEN-clause not to match. The volatile function calls are needed
|
||||||
-- to prevent constant-folding in the planner, which would hide the bug.
|
-- to prevent constant-folding in the planner, which would hide the bug.
|
||||||
|
-- Wrap this in a single transaction so the transient '=' operator doesn't
|
||||||
|
-- cause problems in concurrent sessions
|
||||||
|
BEGIN;
|
||||||
CREATE FUNCTION vol(text) returns text as
|
CREATE FUNCTION vol(text) returns text as
|
||||||
'begin return $1; end' language plpgsql volatile;
|
'begin return $1; end' language plpgsql volatile;
|
||||||
SELECT CASE
|
SELECT CASE
|
||||||
@ -335,13 +338,9 @@ SELECT CASE volfoo('bar') WHEN 'foo'::foodomain THEN 'is foo' ELSE 'is not foo'
|
|||||||
is not foo
|
is not foo
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
ROLLBACK;
|
||||||
--
|
--
|
||||||
-- Clean up
|
-- Clean up
|
||||||
--
|
--
|
||||||
DROP TABLE CASE_TBL;
|
DROP TABLE CASE_TBL;
|
||||||
DROP TABLE CASE2_TBL;
|
DROP TABLE CASE2_TBL;
|
||||||
DROP OPERATOR = (foodomain, foodomain);
|
|
||||||
DROP FUNCTION inline_eq(foodomain, foodomain);
|
|
||||||
DROP FUNCTION volfoo(text);
|
|
||||||
DROP DOMAIN foodomain;
|
|
||||||
DROP FUNCTION vol(text);
|
|
||||||
|
@ -167,6 +167,10 @@ SELECT * FROM CASE_TBL;
|
|||||||
-- the third WHEN-clause not to match. The volatile function calls are needed
|
-- the third WHEN-clause not to match. The volatile function calls are needed
|
||||||
-- to prevent constant-folding in the planner, which would hide the bug.
|
-- to prevent constant-folding in the planner, which would hide the bug.
|
||||||
|
|
||||||
|
-- Wrap this in a single transaction so the transient '=' operator doesn't
|
||||||
|
-- cause problems in concurrent sessions
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
CREATE FUNCTION vol(text) returns text as
|
CREATE FUNCTION vol(text) returns text as
|
||||||
'begin return $1; end' language plpgsql volatile;
|
'begin return $1; end' language plpgsql volatile;
|
||||||
|
|
||||||
@ -194,14 +198,11 @@ CREATE OPERATOR = (procedure = inline_eq,
|
|||||||
|
|
||||||
SELECT CASE volfoo('bar') WHEN 'foo'::foodomain THEN 'is foo' ELSE 'is not foo' END;
|
SELECT CASE volfoo('bar') WHEN 'foo'::foodomain THEN 'is foo' ELSE 'is not foo' END;
|
||||||
|
|
||||||
|
ROLLBACK;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Clean up
|
-- Clean up
|
||||||
--
|
--
|
||||||
|
|
||||||
DROP TABLE CASE_TBL;
|
DROP TABLE CASE_TBL;
|
||||||
DROP TABLE CASE2_TBL;
|
DROP TABLE CASE2_TBL;
|
||||||
DROP OPERATOR = (foodomain, foodomain);
|
|
||||||
DROP FUNCTION inline_eq(foodomain, foodomain);
|
|
||||||
DROP FUNCTION volfoo(text);
|
|
||||||
DROP DOMAIN foodomain;
|
|
||||||
DROP FUNCTION vol(text);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user