Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ9sc-00084s-Kx for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Aug 2022 16:02:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oQ9sb-0004fh-6S for pgsql-bugs@arkaria.postgresql.org; Mon, 22 Aug 2022 16:02:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ9sa-0004fY-Uh for pgsql-bugs@lists.postgresql.org; Mon, 22 Aug 2022 16:02:20 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ9sO-0003yL-Gn for pgsql-bugs@lists.postgresql.org; Mon, 22 Aug 2022 16:02:19 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oQ9sK-002PY5-MC; Mon, 22 Aug 2022 12:02:04 -0400 Date: Mon, 22 Aug 2022 12:02:04 -0400 From: Bruce Momjian To: Tom Lane Cc: "David G. Johnston" , "lxndrkrlv@gmail.com" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause Message-ID: References: <17233-afb9d806aaa64b17@postgresql.org> <1409812.1634481258@sss.pgh.pa.us> <2792105.1660859528@sss.pgh.pa.us> <4158934.1661104235@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4158934.1661104235@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Aug 21, 2022 at 01:50:35PM -0400, Tom Lane wrote: > Bruce Momjian 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 https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson