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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: "lxndrkrlv@gmail.com" <lxndrkrlv@gmail.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2021-10-17T14:57:16Z
Lists: pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> I was actually wondering why the error wasn’t an ambiguous column name
> error.  For a pure select query we already allow duplicate column names in
> the result.

To get an "ambiguous column name" error, there'd need to be multiple
*accessible* names, not multiple inaccessible ones.  Although I concede
your point that maybe we could adjust the "does not exist" phraseology
too.  Maybe something like "column foo is not available"?

			regards, tom lane



Commits

  1. Give better hints for ambiguous or unreferenceable columns.

  2. Make subquery aliases optional in the FROM clause.