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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, suchithjn22(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: The documentation for storage type 'plain' actually allows single byte header
Date: 2023-01-16 13:07:48
Message-ID: 245d0f085c68fe0b877235d76a7c32a71454f39b.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Sun, 2023-01-15 at 16:40 -0500, Tom Lane wrote:
> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> > On Tue, 2023-01-10 at 15:53 +0000, PG Doc comments form wrote:
> > > > 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".
>
> > I think that the documentation is wrong.  The attached patch removes the
> > offending half-sentence.
>
> The documentation is correct, what is broken is the code.

I see. But what is the reason for that anyway? Why not allow short varlena
headers if TOAST storage is set to PLAIN?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2023-01-16 15:50:08 Typo in 2.7 Aggregate Functions
Previous Message Andres Freund 2023-01-16 01:08:01 Re: The documentation for storage type 'plain' actually allows single byte header

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2023-01-16 13:33:49 Re: Support logical replication of DDLs
Previous Message Julien Rouhaud 2023-01-16 13:07:29 Re: Record queryid when auto_explain.log_verbose is on