pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.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: Thu, 18 Aug 2022 17:52:08 -0400
Message-ID: <2792105.1660859528@sss.pgh.pa.us> (raw)
In-Reply-To: <Yv6xeki829pitIXd@momjian.us>
References: <17233-afb9d806aaa64b17@postgresql.org>
	<CAKFQuwbnETbhnBYtMA8HNJwf0ipwAETd58=K0JzPs22Of2ZhcA@mail.gmail.com>
	<1409812.1634481258@sss.pgh.pa.us>
	<Yv6xeki829pitIXd@momjian.us>

Bruce Momjian <bruce@momjian.us> writes:
> Feedback?

>  -- test some error cases where LATERAL should have been used but wasn't
>  select f1,g from int4_tbl a, (select f1 as g) ss;
>  ERROR:  column "f1" does not exist
>  LINE 1: select f1,g from int4_tbl a, (select f1 as g) ss;
>                                               ^
> -HINT:  There is a column named "f1" in table "a", but it cannot be referenced from this part of the query.
> +HINT:  There is a column named "f1" in table "a" and another table so a table-qualified column reference is required.

That one has gone from accurate to completely wrong.  First, it's not
the case that there's more than one possible referent, and second,
table-qualifying the reference wouldn't help.  What *would* help here
is adding LATERAL, but I'm not sure if we can easily tell whether that
is the case.

I think perhaps the existing message is mislabeled: it's not a hint
as written, but errdetail, because it's entirely factual.  For this
particular example, what would be on-point is

DETAIL:  There is a column named "f1" in table "a", but it cannot be referenced from this part of the query.
HINT:  To reference that column, you must mark this subquery with LATERAL.

While we don't insist that hints be 100% accurate, it's not good
if they're wildly unhelpful.  So I'm not sure if we can determine
whether or not it's likely to be on-point.

I didn't look too closely at your other examples.

			regards, tom lane





view thread (16+ messages)  latest in thread

Message-ID: <2792105.1660859528@sss.pgh.pa.us>
Permalink:  ../2792105.1660859528@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2792105.1660859528@sss.pgh.pa.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: tgl@sss.pgh.pa.us, bruce@momjian.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: <2792105.1660859528@sss.pgh.pa.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