Re: BUG #18429: Inconsistent results on similar queries with join lateral

Benoit Ryder <b.ryder@ateme.com>

From: Benoit Ryder <b.ryder@ateme.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, "David G. Johnston" <david.g.johnston@gmail.com>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2024-04-12T15:33:41Z
Lists: pgsql-bugs
> This is kind of exciting for me, as IIRC it's the first field-detected
> bug that that work fixes.  However, I'm not real sure right now how
> we might fix it in the back branches ...

Thanks for the insight! And I'm glad this report can be help. :)

Would you know a way to avoid this bug? I could probably tweak the query
until the result is looking good, but I would prefer to make sure the
bug won't reappear if the query is used with different data or context.



Commits

  1. Ensure generated join clauses for child rels have correct relids.

  2. Fix generation of EC join conditions at the wrong plan level.

  3. Make Vars be outer-join-aware.