Re: ERROR: PlaceHolderVar found where not expected

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: ERROR: PlaceHolderVar found where not expected
Date: 2023-03-14 03:39:44
Message-ID: 2475647.1678765184@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> WindowFuncs should be disallowed in qual clauses, so I think it's okay
> to leave those flags out. An Aggref could occur in a HAVING qual though.
> I'm not sure if this code could get applied to HAVING ... but it's
> not immediately clear that it can't. I'd be inclined to add
> PVC_RECURSE_AGGREGATES, as that seems more likely to be okay than not.

Actually, on closer look: why don't we just nuke that pull_var_clause
call entirely, along with the following loop inspecting its result?

The subsequent loop that looks for a matching StatisticExtInfo
expression will do just fine at rejecting any expression that
contains Vars of the wrong relation. Maybe there is some performance
argument why the pull_var_clause precheck is worth the trouble,
but I'm inclined to bet that it's actually a net loss.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message jitesh tiwari 2023-03-14 06:07:33 Re: Invalid memory allocation error with pg_recvlogical or with libPQ logical connection
Previous Message Tom Lane 2023-03-14 03:32:31 Re: ERROR: PlaceHolderVar found where not expected