The documentation for storage type 'plain' actually allows single byte header

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: suchithjn22(at)gmail(dot)com
Subject: The documentation for storage type 'plain' actually allows single byte header
Date: 2023-01-10 15:53:10
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

The following documentation comment has been logged on the website:

Description: - This is the
development version.

> PLAIN prevents either compression or out-of-line storage; furthermore it
disables use of single-byte headers for varlena types. This is the only
possible strategy for columns of non-TOAST-able data types.

However, it does allow "single byte" headers. How to verify this?

INSERT INTO test VALUES (repeat('A',10));

Now peek into the page with pageinspect functions

SELECT left(encode(t_data, 'hex'), 40) FROM
heap_page_items(get_raw_page('test', 0));

This returned value of "1741414141414141414141".
Here the first byte 0x17 = 0001 0111 in binary.
Length + 1 is stored in the length bits (1-7). So Len = 0001011-1 = (11-1)
[base-10] = 10 [base-10]
which exactly matches the expected length. Further the data "41" repeated 10
times also indicates character A (65 or 0x41 in ASCII) repeated 10 times.

So....This does **not** disable 1-B header. That sentence should be removed
from the documentation unless this is a bug.


Browse pgsql-docs by date

  From Date Subject
Next Message Magnus Hagander 2023-01-12 09:32:29 Tightening the trust auth advice
Previous Message Laurenz Albe 2023-01-09 15:40:10 Re: Postgres Partitions Limitations (

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2023-01-10 15:59:34 Re: [PATCH] pgbench: add multiconnect option
Previous Message Justin Pryzby 2023-01-10 15:22:12 Re: Use windows VMs instead of windows containers on the CI