Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmM4i-006pmP-G5 for pgsql-docs@arkaria.postgresql.org; Fri, 29 Sep 2023 22:35:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qmM4h-006jhO-6G for pgsql-docs@arkaria.postgresql.org; Fri, 29 Sep 2023 22:35:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qmM4g-006jh1-QL for pgsql-docs@lists.postgresql.org; Fri, 29 Sep 2023 22:35:06 +0000 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qmM4d-008LLN-RT for pgsql-docs@lists.postgresql.org; Fri, 29 Sep 2023 22:35:06 +0000 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3248aa5cf4eso2019279f8f.1 for ; Fri, 29 Sep 2023 15:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20230601.gappssmtp.com; s=20230601; t=1696026902; x=1696631702; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=PI7+bU5sZTSjaotaSvD3NTN59hI9jZclJGnVyxDxtRU=; b=aT3aOWsw1QAHGggki1uZ7xzjQjclKI6cVdzuwWlkuzmal9RQ0Uj2qxfa9JPO7lwBIp hXqhudWPDoa2Yn2LmQDzPbXQfwIXadR8WDjgJQwxMVrnduK+9lbpX8ChLWMq96xjJv1O 0++FOCNteS+BIGc1gHehnF4FGarGoPKmVkxDTDAD/cICYnVZz2ZwVkZZH2vOnmhhk6RF HE/PJlEMToOXi23t2OL+NXl6orgR7AaFhhu8sDtrnnSAFoDFab+Y6B26M+wwKg02Cmja FZtKUn4+L//AwmF56a3LBmkwU+Gf73O40ZdT3IsjAB9TSBfkM5YMqEbKnhe86yF3W5YN zAmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696026902; x=1696631702; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PI7+bU5sZTSjaotaSvD3NTN59hI9jZclJGnVyxDxtRU=; b=oS9QLGRamu/DPP16w7Gn5TSGWuDMIRUObjW1hj+gR2GhiobSgnPl8fZ+L1cHcf92lF 9PgFxzT2OPa0cTTAmcldCxHQU93Gh+89dTZ9Je2Ea3V6wxn14XhVGH8g0FGEoDxHU1Mj CdrtiyV8ANOWj6DTLg8Htt27L4tJUBKxMnW2+CqENzkIn94IDWzppx3prTqGE/v7U5DK nngfnYGKQ6kIFYUZZ7gOBiuARXD3dwjQxfh6dBYqS5bs97xJAYbF6Qd6F7hf4+drYHfz RXi5tJMaw85B11ko0JbUL1zt0JVPcXE/wDvz+EDj84ad9H0T71bC0olGNtieQIf8EaOA xoWg== X-Gm-Message-State: AOJu0Yw7yHY1sP6j09tmKBLqU2MKf/n9/1E9LqjmSQoW7TW7M/r6sPeS rHXeqjST5d3grOEJYyi7o8eQAw== X-Google-Smtp-Source: AGHT+IHueDEoNl83/gvtwt1iLt2lEF3YTNcc6SMj0US2KjDBTofBDa8NlIqKkFOOX0R2G/qVse9ciA== X-Received: by 2002:adf:e848:0:b0:31a:dbd1:bf6 with SMTP id d8-20020adfe848000000b0031adbd10bf6mr4662916wrn.68.1696026901998; Fri, 29 Sep 2023 15:35:01 -0700 (PDT) Received: from localhost.localdomain (178-190-168-29.adsl.highway.telekom.at. [178.190.168.29]) by smtp.gmail.com with ESMTPSA id d8-20020a056000114800b0031fe0576460sm22290526wrx.11.2023.09.29.15.35.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 15:35:01 -0700 (PDT) Message-ID: <4977c12e127250fe9777ae57f6f5884b8f5c84ae.camel@cybertec.at> Subject: Re: The documentation for storage type 'plain' actually allows single byte header From: Laurenz Albe To: Bruce Momjian Cc: suchithjn22@gmail.com, pgsql-docs@lists.postgresql.org Date: Sat, 30 Sep 2023 00:35:00 +0200 In-Reply-To: References: <167336599095.2667301.15497893107226841625@wrigleys.postgresql.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2023-09-29 at 18:19 -0400, Bruce Momjian wrote: > On Thu, Jan 12, 2023 at 03:43:57PM +0100, Laurenz Albe wrote: > > On Tue, 2023-01-10 at 15:53 +0000, PG Doc comments form wrote: > > > https://www.postgresql.org/docs/devel/storage-toast.html=C2=A0- This = is the > > > development version. > > >=20 > > > > PLAIN prevents either compression or out-of-line storage; furthermo= re it > > > > disables use of single-byte headers for varlena types. This is the = only > > > > possible strategy for columns of non-TOAST-able data types. > > >=20 > > > However, it does allow "single byte" headers. How to verify this? > > >=20 > > > CREATE EXTENSION pageinspect; > > > CREATE TABLE test(a VARCHAR(10000) STORAGE PLAIN); > > > INSERT INTO test VALUES (repeat('A',10)); > > >=20 > > > Now peek into the page with pageinspect functions > > >=20 > > > SELECT left(encode(t_data, 'hex'), 40) FROM > > > heap_page_items(get_raw_page('test', 0)); > > >=20 > > > This returned value of "1741414141414141414141". > > > Here the first byte 0x17 =3D 0001 0111 in binary. > > > Length + 1 is stored in the length bits (1-7). So Len =3D 0001011-1 = =3D (11-1) > > > [base-10] =3D 10 [base-10] > > > which exactly matches the expected length. Further the data "41" repe= ated 10 > > > times also indicates character A (65 or 0x41 in ASCII) repeated 10 ti= mes. > > >=20 > > > So....This does **not** disable 1-B header. That sentence should be r= emoved > > > from the documentation unless this is a bug. > >=20 > > I think that the documentation is wrong.=C2=A0 The attached patch remov= es the > > offending half-sentence. > >=20 > > Yours, > > Laurenz Albe >=20 > > From 5bf0b43fe73384a21f59d9ad1f7a8d7cbc81f8c4 Mon Sep 17 00:00:00 2001 > > From: Laurenz Albe > > Date: Thu, 12 Jan 2023 15:41:56 +0100 > > Subject: [PATCH] Fix documentation for STORAGE PLAIN > >=20 > > Commit 3e23b68dac0, which introduced single-byte varlena headers, > > added documentation that STORAGE PLAIN would prevent such single-byte > > headers.=C2=A0 This has never been true. > > --- > > =C2=A0doc/src/sgml/storage.sgml | 4 +--- > > =C2=A01 file changed, 1 insertion(+), 3 deletions(-) > >=20 > > diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml > > index e5b9f3f1ff..4795a485d0 100644 > > --- a/doc/src/sgml/storage.sgml > > +++ b/doc/src/sgml/storage.sgml > > @@ -456,9 +456,7 @@ for storing TOAST-able columns o= n disk: > > =C2=A0=C2=A0=C2=A0=C2=A0 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PLAIN prevents = either compression or > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 out-of-line storage; furthermore it dis= ables use of single-byte headers > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for varlena types. > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 This is the only possible strategy for > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 out-of-line storage.=C2=A0 This is the = only possible strategy for > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 columns of non-TOAST-able data types. > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > =C2=A0=C2=A0=C2=A0=C2=A0 > > --=20 > > 2.39.0 > >=20 >=20 > Where did we end with this?=C2=A0 Is a doc patch the solution? I don't think this went anywhere, and a doc patch is not the solution. Tom has argued convincingly that single-byte headers are an effect of the T= OAST system, and that STORAGE PLAIN should disable all effects of TOAST. So this would need a code patch. Yours, Laurenz Albe