Re: [HACKERS] Using HeapTuple.t_len to verify size of tuple

2015-08-25 Thread Tom Lane
Vignesh Raghunathan vignesh.pg...@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

Re: [HACKERS] Using HeapTuple.t_len to verify size of tuple

2015-08-25 Thread Vignesh Raghunathan
On Tue, Aug 25, 2015 at 2:56 PM, Tom Lane t...@sss.pgh.pa.us wrote: Vignesh Raghunathan vignesh.pg...@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

Re: [HACKERS] Using HeapTuple.t_len to verify size of tuple

2015-08-25 Thread Tom Lane
Vignesh Raghunathan vignesh.pg...@gmail.com writes: On Tue, Aug 25, 2015 at 2:56 PM, Tom Lane t...@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

Re: [HACKERS] Using HeapTuple.t_len to verify size of tuple

2015-08-25 Thread Vignesh Raghunathan
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 I am sorry. It was a bug in my code. I did not add the size of the tuple's header field to the off variable before

[HACKERS] Using HeapTuple.t_len to verify size of tuple

2015-08-25 Thread Vignesh Raghunathan
Hello, 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