Re: CTIDs invalidations and dropping columns. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: CTIDs invalidations and dropping columns.
Date
Msg-id 7912.1152588264@sss.pgh.pa.us
Whole thread Raw
In response to Re: CTIDs invalidations and dropping columns.  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> You're talking about "invalidation" as if it's something someone
> deliberately does. That's incorrect. The t_ctid field is filled in if
> and only if the tuple is exactly the on disk tuple. Otherwise it's a
> new tuple, which by definition does not have a ctid (it doesn't exist
> on disk).

The only way that t_ctid would be "valid" in the result of a SELECT * FROM
is if the "physical tlist" optimization triggers to make the scan skip
the usual ExecProject call and just return a direct pointer to the
on-disk tuple.  That optimization never existed before 8.0 or 8.1
(I forget exactly, but it's pretty recent).  So the OP is depending
on an undocumented, recently added behavior that only applies in one
special case.  To be blunt, the OP's code is broken.  If you want to
know the on-disk tuple's CTID, select it explicitly:SELECT ctid, whatever-else-you-need FROM foo ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Agent M
Date:
Subject: 10th Anniversary Conference
Next
From: Katsuhiko Okano
Date:
Subject: poor performance with Context Switch Storm at TPC-W.