Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
Bruce Momjian <bruce@momjian.us>
From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "lxndrkrlv@gmail.com" <lxndrkrlv@gmail.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2022-08-22T16:02:04Z
Lists: pgsql-bugs
On Sun, Aug 21, 2022 at 01:50:35PM -0400, Tom Lane wrote: > Bruce Momjian <bruce@momjian.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@momjian.us> https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson
Commits
-
Give better hints for ambiguous or unreferenceable columns.
- 56d0ed3b756b 16.0 landed
-
Make subquery aliases optional in the FROM clause.
- bcedd8f5fce0 16.0 cited