Re: An inefficient query caused by unnecessary PlaceHolderVar

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: Andrei Lepikhov <lepihov@gmail.com>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>, James Coleman <jtc331@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-12-09T12:20:16Z
Lists: pgsql-hackers
On Tue, Dec 3, 2024 at 5:33 PM Andrei Lepikhov <lepihov@gmail.com> wrote:
> A couple of words about your patch. These few lines of code caused a lot
> of discoveries, but in my opinion, they look fine. But I didn't find
> negative tests, where we need to wrap a Var with PHV like the following:

Pushed after adding two negative tests.  Thank you for your review.

Thanks
Richard



Commits

  1. Avoid unnecessary wrapping for Vars and PHVs

  2. Avoid mislabeling of lateral references, redux.

  3. Avoid inserting PlaceHolderVars in cases where pre-v16 PG did not.