pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: suchithjn22@gmail.com
Subject: The documentation for storage type 'plain' actually allows single byte header
Date: Tue, 10 Jan 2023 15:53:10 +0000
Message-ID: <167336599095.2667301.15497893107226841625@wrigleys.postgresql.org> (raw)

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/index.html
Description:

https://www.postgresql.org/docs/devel/storage-toast.html - 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?

CREATE EXTENSION pageinspect;
CREATE TABLE test(a VARCHAR(10000) STORAGE PLAIN);
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.


view thread (19+ messages)  latest in thread

Message-ID: <167336599095.2667301.15497893107226841625@wrigleys.postgresql.org>
Permalink:  ../167336599095.2667301.15497893107226841625@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/167336599095.2667301.15497893107226841625@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, suchithjn22@gmail.com
  Subject: Re: The documentation for storage type 'plain' actually allows single byte header
  In-Reply-To: <167336599095.2667301.15497893107226841625@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox