Commit b2304a71 authored by Alvaro Herrera's avatar Alvaro Herrera

Simplify FK-to-partitioned regression test query

Avoid a join between relations having the FK to detect FK violation.
The planner might optimize this considering the PK must exist on the
referenced side at some point, effectively masking a bug this test
tries to detect.

Tom Lane and Jehan-Guillaume de Rorthais
Discussion: https://postgr.es/m/467.1581270529@sss.pgh.pa.us
parent 53b01acd
...@@ -2456,12 +2456,14 @@ CREATE SCHEMA fkpart9 ...@@ -2456,12 +2456,14 @@ CREATE SCHEMA fkpart9
INSERT INTO fkpart9.pk VALUES (35); INSERT INTO fkpart9.pk VALUES (35);
INSERT INTO fkpart9.fk VALUES (35); INSERT INTO fkpart9.fk VALUES (35);
DELETE FROM fkpart9.pk WHERE a=35; DELETE FROM fkpart9.pk WHERE a=35;
SELECT fk.fk_a, pk.a SELECT * FROM fkpart9.pk;
FROM fkpart9.fk a
LEFT JOIN fkpart9.pk ON fk.fk_a = pk.a ---
WHERE fk.fk_a=35; (0 rows)
fk_a | a
------+--- SELECT * FROM fkpart9.fk;
fk_a
------
(0 rows) (0 rows)
DROP SCHEMA fkpart9 CASCADE; DROP SCHEMA fkpart9 CASCADE;
......
...@@ -1735,8 +1735,6 @@ CREATE SCHEMA fkpart9 ...@@ -1735,8 +1735,6 @@ CREATE SCHEMA fkpart9
INSERT INTO fkpart9.pk VALUES (35); INSERT INTO fkpart9.pk VALUES (35);
INSERT INTO fkpart9.fk VALUES (35); INSERT INTO fkpart9.fk VALUES (35);
DELETE FROM fkpart9.pk WHERE a=35; DELETE FROM fkpart9.pk WHERE a=35;
SELECT fk.fk_a, pk.a SELECT * FROM fkpart9.pk;
FROM fkpart9.fk SELECT * FROM fkpart9.fk;
LEFT JOIN fkpart9.pk ON fk.fk_a = pk.a
WHERE fk.fk_a=35;
DROP SCHEMA fkpart9 CASCADE; DROP SCHEMA fkpart9 CASCADE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment