Re: BUG #18429: Inconsistent results on similar queries with join lateral
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Benoit Ryder <b.ryder@ateme.com>,
"David G. Johnston" <david.g.johnston@gmail.com>,
"pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2024-04-15T14:20:33Z
Lists: pgsql-bugs
Richard Guo <guofenglinux@gmail.com> writes: > I agree that the new test case for v15 does not seem to be worth > including in v16+. It seems to me that it would be better if we can > have another new test case to verify that we've included child rel's > em_relids even for appendrel child relations with pseudoconstant > translated variables, i.e. to verify that the change in equivclass.c > takes effect. Maybe with a query like below: > explain (costs off) > select * from tenk1 t1 > left join lateral > (select t1.unique1 as t1u, 0 as c > union all > select t1.unique1 as t1u, 1 as c) s on true > where t1.unique1 = s.c; > Without the change in equivclass.c, this query would trigger the new > added assert in get_baserel_parampathinfo for v16, and give a wrong plan > for v15. What do you think? I didn't add such a test because there are already several cases (in foreign_data.sql, IIRC) that trigger the assert, which is how come I found the problem in the first place. Admittedly, those depend on potentially-changeable details of an information_schema view, so maybe it'd be better to have a bespoke test. regards, tom lane
Commits
-
Ensure generated join clauses for child rels have correct relids.
- 03107b4eda7f 17.0 landed
- 91800af13710 16.3 landed
-
Fix generation of EC join conditions at the wrong plan level.
- f502849d49a4 12.19 landed
- d9e4ee74f48c 13.15 landed
- ab2402268c04 14.12 landed
- 5aacfa64e5da 15.7 landed
-
Make Vars be outer-join-aware.
- 2489d76c4906 16.0 cited