Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "lxndrkrlv(at)gmail(dot)com" <lxndrkrlv(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
Date: 2022-08-22 16:02:04
Message-ID: YwOofIFajASrgRbC@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Aug 21, 2022 at 01:50:35PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > To improve things, it would be good if we could determine if LATERAL
> > will really fix the error, or at least detect one of the cases above we
> > have a clearer way to suggest a fix.
>
> Here's a proposed patch that tries to determine this by looking at
> ParseNamespaceItem flags. I'm not sure it's totally bulletproof,
> but it's likely good enough for a HINT.

Wow, this is great. I can see how people would be confused by the need
for LATERAL, and this is really a great boost for them.

> I felt that the conditional-expression nests in the existing ereport
> calls were nearly unintelligible already, so I rearranged the logic

Wow, I am glad you mentioned this. I never saw a ? b ? c : d : e used
before and I had to look it up, and I have been around C for a long time:

https://www.geeksforgeeks.org/c-nested-ternary-operator/

> to duplicate portions of the ereports instead. That could be debated
> perhaps. Also, as written some paths through errorMissingColumn
> will invoke the findNSItemForRTE search twice. I'm not too fussed
> about that: it's a pretty cheap search and anyway nobody should be
> bothering to shave microseconds off an error reporting path.

Exactly.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Indecision is a decision. Inaction is an action. Mark Batterson

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-08-23 04:00:11 Re: BUG #17580: use pg_terminate_backend to terminate a wal sender process may wait a long time
Previous Message Tom Lane 2022-08-22 13:21:39 Re: [External] Re: BUG #17585: Wrong path to the extension control file