The structure of tuples within the binary file is as follows: a 16-bit integer count of the fields within the tuple
(this is the same within every tuple), a 16-bit integer
word, and the field data for each field.
The available options for the
field are as follow:
NULL; this field contains no data.
A fixed-length data type. The specified number bytes of data follow the
data type. The next four bytes are the
consisting of the value's total length (including the length of the header).
Reserved for possible future use.
To create a convenient way for an application reading this format to check the integrity of incoming binary data, all
non-NULL fields have a
value, which can be compared against the
of the destination column before attempting to insert or update data within PostgreSQL.
A few formatting options were left un-implemented to improve the portability of binary file dumps. Primarily, extra
data between fields is not possible (e.g., alignment padding), and there is no distinguishment between data types based on
passes by reference, or passes by value.
If OIDs are included in a PostgreSQL binary file, they immediately follow the field count word. OIDs are not
included in the field count.