pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 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: Sun, 17 Oct 2021 10:34:18 -0400
Message-ID: <1409812.1634481258@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbnETbhnBYtMA8HNJwf0ipwAETd58=K0JzPs22Of2ZhcA@mail.gmail.com>
References: <17233-afb9d806aaa64b17@postgresql.org>
	<CAKFQuwbnETbhnBYtMA8HNJwf0ipwAETd58=K0JzPs22Of2ZhcA@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The virtual join table doesn’t have a ctid, only physical tables do, and
> the ctid of physical tables apparently aren’t propogated when they are
> joined.

We leave the system columns out of the join because otherwise they'd
surely conflict between the two sides of the join.  However, you could
still reference either one with "tmp1.ctid" or "tmp2.ctid".

There might be an opportunity here to improve the error message's hint:

regression=# SELECT CTID
regression-# FROM tmp1
regression-# INNER JOIN tmp2 ON tmp1.id = tmp2.id;
ERROR:  column "ctid" does not exist
LINE 1: SELECT CTID
               ^
HINT:  There is a column named "ctid" in table "tmp1", but it cannot be referenced from this part of the query.

"cannot be referenced" is probably a shade misleading, given the
availability of the qualified-name alternative.

			regards, tom lane





view thread (16+ messages)  latest in thread

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