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