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 22557.1440542187@sss.pgh.pa.us
Whole thread Raw
In response to Re: 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:
> On Tue, Aug 25, 2015 at 2:56 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.

> I have modified heap_deform_tuple code to check whether the 'off' variable
> matches the tuple's t_len field for a project. In the code, off is not
> updated in case of null fields. However, when I run it for pg_class table,
> the code throws an error saying that the value of off does not match t_len.
> It turns out that for all tuples even if the attribute attacl is null,
> t_len field is set to be the sizeof(FormData_pg_class).

You mean "even if relacl is not null"?  Sounds improbable: AFAIR, pg_class
tuples are built with heap_form_tuple, same as anything else.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Vignesh Raghunathan
Date:
Subject: Re: Using HeapTuple.t_len to verify size of tuple
Next
From: Andres Freund
Date:
Subject: Re: Custom Scans and private data