pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: lxndrkrlv@gmail.com <lxndrkrlv@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
Date: Mon, 22 Aug 2022 12:02:04 -0400
Message-ID: <YwOofIFajASrgRbC@momjian.us> (raw)
In-Reply-To: <4158934.1661104235@sss.pgh.pa.us>
References: <17233-afb9d806aaa64b17@postgresql.org>
	<CAKFQuwbnETbhnBYtMA8HNJwf0ipwAETd58=K0JzPs22Of2ZhcA@mail.gmail.com>
	<1409812.1634481258@sss.pgh.pa.us>
	<Yv6xeki829pitIXd@momjian.us>
	<2792105.1660859528@sss.pgh.pa.us>
	<Yv7wRmKX01Q2gfPo@momjian.us>
	<Yv+cTDKXsaLrOwMo@momjian.us>
	<4158934.1661104235@sss.pgh.pa.us>

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






view thread (16+ messages)  latest in thread

Message-ID: <YwOofIFajASrgRbC@momjian.us>
Permalink:  ../YwOofIFajASrgRbC@momjian.us/
Also on:    postgresql.org/message-id/YwOofIFajASrgRbC@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, lxndrkrlv@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
  In-Reply-To: <YwOofIFajASrgRbC@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox