Re: Using HeapTuple.t_len to verify size of tuple - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Using HeapTuple.t_len to verify size of tuple
Date
Msg-id 21367.1440539762@sss.pgh.pa.us
Whole thread Raw
In response to Using HeapTuple.t_len to verify size of tuple  (Vignesh Raghunathan <vignesh.pgsql@gmail.com>)
Responses Re: Using HeapTuple.t_len to verify size of tuple  (Vignesh Raghunathan <vignesh.pgsql@gmail.com>)
List pgsql-hackers
Vignesh Raghunathan <vignesh.pgsql@gmail.com> writes:
> Can the t_len field in HeapTuple structure be used to verify the length of
> the tuple?

> That is, if I calculate the length from the contents of the tuple using
> data from pg_attribute for fixed length fields and the data from the header
> for varlena fields, should it always match the value stored in t_len?

If t_len were *less* than that, it would be a bug.  But I think it's
fairly common for t_len to be rounded up to the next maxalign boundary.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: 9.4 broken on alpha
Next
From: Tom Lane
Date:
Subject: Re: 9.4 broken on alpha