Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
Date
Msg-id CAKFQuwbnETbhnBYtMA8HNJwf0ipwAETd58=K0JzPs22Of2ZhcA@mail.gmail.com
Whole thread Raw
In response to BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Saturday, October 16, 2021, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17233
Logged by:          Alexander Korolev
Email address:      lxndrkrlv@gmail.com
PostgreSQL version: 14.0
Operating system:   Windows
Description:       

This SELECT command fails as expected:
SELECT CTID FROM tmp1 INNER JOIN tmp2 ON tmp1.id = tmp2.id FOR UPDATE;
-- ERROR: column "ctid" does not exist.

But if I use same SELECT in WHERE clause of DELETE command
DELETE FROM tmp1 WHERE CTID in (
    SELECT CTID FROM tmp1 INNER JOIN tmp2 ON tmp1.id = tmp2.id FOR
UPDATE);
this command is executed without errors.

This is not a bug:


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.

David J.

pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause
Next
From: Tom Lane
Date:
Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause