Re: [HACKERS] How to get the 'ctid' from a record type? - Mailing list pgsql-hackers

From Eric Ridge
Subject Re: [HACKERS] How to get the 'ctid' from a record type?
Date
Msg-id CANcm6waPLx3KRR0rioBfMRn8kJwD_-+C4nZLDMueKr+u9dn-7Q@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] How to get the 'ctid' from a record type?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] How to get the 'ctid' from a record type?  (Jim Nasby <jim.nasby@openscg.com>)
Re: [HACKERS] How to get the 'ctid' from a record type?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
I suspect the tuple at (0,1) has been the subject of a failed update.

Yep.
 
Your problem here is that you're mistaking the t_ctid field of a tuple
header for the tuple's address.  It is not that; it's really just garbage
normally, and is only useful to link forward to the next version of the
row from an outdated tuple.  I think we do initialize it to the tuple's
own address during an INSERT, but either a completed or failed UPDATE
would change it.

Thanks.  That helps clarify the comments in htup_details.h, actually.
 
I do not think there is any way to get the true address of a heap tuple
out of a composite Datum manufactured from the tuple.  Most of the other
system columns can't be gotten from a composite Datum either, because of
the field overlay in HeapTupleHeaderData's union t_choice.

Well shoot.  That kinda spoils my plans.

What about this?  Is the tuple currently being evaluated (I suppose in the case of a sequential scan) available in the context of a function call?

Thanks again for your time!  It's much appreciated.

eric
 

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Bizarre choice of case for RELKIND_PARTITIONED_TABLE
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS] Write Ahead Logging for Hash Indexes