Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Andrei Lepikhov <a.lepikhov@postgrespro.ru>
Cc: zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org, PG Bug reporting form <noreply@postgresql.org>
Date: 2023-11-09T11:08:38Z
Lists: pgsql-bugs
On Thu, Nov 9, 2023 at 12:51 PM Andrei Lepikhov <a.lepikhov@postgrespro.ru>
wrote:

> ... Should we add a reference to the
> bug that triggered the issue as a comment to the test?


Yeah, we can do that.  I guess something like:

-- Check that SJE removes references from PHVs correctly (bug #18187)


> Also, to be sure,
> maybe add column t4.code into the list of the coalesce parameters?


I don't think it's necessary.  It is t3 that SJE would remove, so it's
sufficient to have t3's Vars in the PHV expression to trigger this
error.

Thanks
Richard

Commits

  1. Fix a comment for remove_self_joins_recurse()

  2. Don't constrain self-join removal due to PHVs

  3. Handle PlaceHolderVar case in replace_varno_walker

  4. Fix how SJE checks against PHVs

  5. citext: Allow tests to pass in OpenSSL FIPS mode