Re: A gap in preventing bogus parameterizations in a798660ebe3

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Tender Wang <tndrwang(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: A gap in preventing bogus parameterizations in a798660ebe3
Date: 2026-11-09 08:10:17
Message-ID: CAMbWs4_aqmWrp18vfeVt2_C8ctn4RjudNF5W5XX8ENGAZKjB9Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 9, 2026 at 4:47 AM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
> I'm now fairly confident the fix is correct. I'd still welcome someone
> else doing a quick review, of course.

I looked at the master patch, and it LGTM.

One nit on the commit message: "we still reject the path, just a bit
later" isn't quite accurate. AFAICS nothing rejects such a path
later. It'd be added to the joinrel's pathlist, just that it can
never be used, because its parameterization includes a relid within
the joinrel, which the other input of an upper join can never supply.
Maybe something like "In non-assert builds this is mostly harmless,
since such paths can never appear in a complete plan."

This check only covers parameters that need an outer join completed at
the current join, though. It misses the case where a parameter can
only be supplied above some outer join that itself has to be formed
above the current join. If such a parameter comes from a lateral
reference, every path of the joinrel is dead, and the join has to be
rejected in join_is_legal() instead. I'm working on that in [1]. So
if your join generator hits "failed to build any N-way joins" with
LATERAL, it's likely that issue rather than another hole in this
patch.

[1] https://postgr.es/m/CAMbWs48YGwbxxz-3_g0snstuVNWdkMfJwM7iwqf8NY5_uLQ23Q@mail.gmail.com

- Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-11-09 08:10:23 Re: Reject access to unlogged tables in contrib modules
Previous Message Aleksander Alekseev 2026-11-09 08:06:41 Re: [PATCH] Cover get_json_table_plan() with tests