Re: (Updated) Table File Format - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: (Updated) Table File Format
Date
Msg-id 3A3A560E.38D025DF@tm.ee
Whole thread Raw
In response to (Updated) Table File Format  ("Michael Richards" <miker@interchange.ca>)
List pgsql-hackers
Michael Richards wrote:
> 
> Okay,
> 
> Where would I find a definition of the tuple data? I didn't see anything
> promising in include/storage?
> 
> I've found a definition for the page inside pagebuf.h That clears up all the
> page stuff. I'm still having a little trouble decoding the tuple data
> within. Hannu Krosing sent me a python script to do the extract, but having
> never seen a line of Python before in my life, I'm having a little trouble
> with the actual tuple data. I can see where the actual transaction
> visibility info is in the tuple data, but the actual data... nope. My
> program (c++) is at the point where it will create tuple objects for every
> block of "tuple" data within the page.

IIRC, the data field format for individual fields is the same as defined
in 
the back-end/front-end protocol for binary cursors.

if there are any NULL fields in the record then there is a flag
somewhere in 
the tuple header and a bitmap of N*32 bits (N=no_of_fields/32) for
missing .
It is possible that there is no flag and you must deduce the presence of 
bitmap from the tuple-header length, im not sure which way it was.

The actual fields in a table and their order must be extracted from
pg_class 
and pg_attribute tables.

------------
Hannu


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: index support for arrays (GiST)
Next
From: Nick Wayne
Date:
Subject: BLCKSZ:Max tuple size problem