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 1mc7F1-0006cg-7o for pgsql-bugs@arkaria.postgresql.org; Sun, 17 Oct 2021 14:34:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mc7F0-0007WG-4i for pgsql-bugs@arkaria.postgresql.org; Sun, 17 Oct 2021 14:34:22 +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 1mc7Ez-0007W3-TT for pgsql-bugs@lists.postgresql.org; Sun, 17 Oct 2021 14:34:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mc7Ey-0002yt-4J for pgsql-bugs@lists.postgresql.org; Sun, 17 Oct 2021 14:34:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19HEYIen1409813; Sun, 17 Oct 2021 10:34:18 -0400 From: Tom Lane To: "David G. Johnston" cc: "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: References: <17233-afb9d806aaa64b17@postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Sun, 17 Oct 2021 07:15:48 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1409811.1634481258.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 17 Oct 2021 10:34:18 -0400 Message-ID: <1409812.1634481258@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > The virtual join table doesn=E2=80=99t have a ctid, only physical tables= do, and > the ctid of physical tables apparently aren=E2=80=99t propogated when th= ey 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=3D# SELECT CTID regression-# FROM tmp1 regression-# INNER JOIN tmp2 ON tmp1.id =3D 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 re= ferenced 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