Thread: HeapTuple layout

HeapTuple layout

From
Michael Klatt
Date:
Is a HeapTuple for a particular table guaranteed to have the same layout
(order and number of attributes) as that table?  This seems to be true, but
can I rely on that behavior in all situations?  Also, is a HeapTuple used to
store the tuples in a PGresult?

___________________________________
Michael Klatt

University of Oklahoma
Environmental Verification and Analysis Center
710 Asp Avenue, Suite 8
Norman, OK  73069

405.447.8412
405.447.8455  FAX
http://www.evac.ou.edu/

"I'm a great motivator.  Everyone says they have to work twice as hard when
I'm around."





Re: HeapTuple layout

From
Tom Lane
Date:
Michael Klatt <mdklatt@ou.edu> writes:
> Is a HeapTuple for a particular table guaranteed to have the same layout
> (order and number of attributes) as that table?

Define what you mean by "for a table".  If it's actually intended to be
stored in the table then it had better have the right layout.  A tuple
read from a table will have the expected layout but may be missing
columns at the end (in case it hasn't been updated since an ALTER TABLE
ADD COLUMN command).  The standard tuple access routines treat this case
as meaning that the missing columns are NULLs.

> Also, is a HeapTuple used to store the tuples in a PGresult?

No, HeapTuples are only used inside the backend.
        regards, tom lane