translate
When a tuple is saved to a hard disk, its t_ctid is initialized to its TID (location information). If the tuple is updated, t_ctid is changed to the latest tuple replacement version. Therefore, if XMAX is invalid or t_ctid points to itself (if XMAX is valid, tuple is either locked or deleted). tuple represents the latest version of this trip. In this case, we can follow t_ctid to find the latest version of this trip. Be careful, VACUUM may erase the new version before it erases the old version pointer pointed to by c_tid. So, before we follow t_ctid to find a new version, we need to check whether the reference slot is empty or if a unrelate tuple is referenced. And whether XMIN is equal to XMAX to determine that we did not refer to a tuple released by VACUUM, If the above check fails to return, we can assume that there is no extended version of the tuple. t_ctid is sometimes used to save a special insert tag, rather than a TID, when tuple is inserted. We will set a special tag until the inserter decides to insert the tuple into the hard disk. So when a transaction is running or fails, we should only see a tuple containing XMAX. If the insertion is determined, the tag will be replaced with the actual TID. Note that we can see the tag only when the insertion is made, because it is only used as an insertion operation.
original text
/* A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid
* is initialized with its own TID (location). If the tuple is ever updated,
* its t_ctid is changed to point to the replacement version of the tuple.
* Thus, a tuple is the latest version of its row iff XMAX is invalid or
* t_ctid points to itself (in which case, if XMAX is valid, the tuple is
* either locked or deleted). One can follow the chain of t_ctid links
* to find the newest version of the row. Beware however that VACUUM might
* erase the pointed-to (newer) tuple before erasing the pointing (older)
* tuple. Hence, when following a t_ctid link, it is necessary to check
* to see if the referenced slot is empty or contains an unrelated tuple.
* Check that the referenced tuple has XMIN equal to the referencing tuple's
* XMAX to verify that it is actually the descendant version and not an
* unrelated tuple stored into a slot recently freed by VACUUM. If either
* check fails, one may assume that there is no live descendant version.
*
* t_ctid is sometimes used to store a speculative insertion token, instead
* of a real TID. A speculative token is set on a tuple that's being
* inserted, until the inserter is sure that it wants to go ahead with the
* insertion. Hence a token should only be seen on a tuple with an XMAX
* that's still in-progress, or invalid/aborted. The token is replaced with
* the tuple's real TID when the insertion is confirmed. One should never
* see a speculative insertion token while following a chain of t_ctid links,
* because they are not used on updates, only insertions.