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.
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.