Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHgyU-00048q-In for pgsql-docs@arkaria.postgresql.org; Tue, 17 Jan 2023 08:05:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHgyT-0004x3-Eb for pgsql-docs@arkaria.postgresql.org; Tue, 17 Jan 2023 08:05:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHgyT-0004wQ-3s for pgsql-docs@lists.postgresql.org; Tue, 17 Jan 2023 08:05:41 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pHgyO-0000Wm-Ny for pgsql-docs@lists.postgresql.org; Tue, 17 Jan 2023 08:05:39 +0000 Received: by mail-ej1-x62f.google.com with SMTP id az20so54328950ejc.1 for ; Tue, 17 Jan 2023 00:05:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; 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=FEnBv79o4N1HZlvqLqLiyy4A0d0FubKfwEnQQO8w8LA=; b=zUahM3rBZT9RWfsf3fEF/63mOA2SS7clOeM81cFFRbAkcVJBYD+X5nORaxTCwn/Y5j jgqL8kjGgkkJaNuu+P+uKQJjBBlRcKp6sjoa+kI5UZzwuhtPL1DEzm0eTdTXbpHTV/Kz xAVfljm0lg32ise9ISzVgDg1Dt7obj2u2nO7QAYLrO84oGM2hHZERCB24nt+5Ih3ldL/ 0K8g0kZadweusuNbFigf1rbKYQZ5vzVzddGMABM1bg7L0/Dqxog/7OOqJvM8NUWxijP7 X0+5256ovXbqyel68Ua+R4xinEV1enRYtCHXfyGSoVDBeAa36mTxdWhfyUprmv+96rny YGxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=FEnBv79o4N1HZlvqLqLiyy4A0d0FubKfwEnQQO8w8LA=; b=vZsyj9w9rr55bzrQX96uEWbNz19hctji6agd3YeLFQVZ+rfqMDRh5W4M8AR+FVxAbP YhVmiNufZDnXf0FCI6N+k6iORmKOFSlaIMrobE32r3zgDx4SGLNt8w5CSVZIuBS6kDos i73Zg4/sdR9yT1XrnSgbV/gWcjx+CT1LPET4P0QXmf56h5Ao78m2yWQCMrX01bIztODu e9hFqlxAC94dxxiHyVt61HjCDS9K2JikzIts/JS0V6vGaCBLPDmCOgI9noTPt5PpWlNV YjWf5D/V7afxQG0DWj7BwLggADGXFLm4y6jvGfbQouhPNOIWFEfMvAoK9URK1d4jIsLL 5qNw== X-Gm-Message-State: AFqh2kq0ktK2x/jn3YbLrqmQ/S3+tvyoLJZ7AgNM+y4MMg98QuU76wwo 7akyEaTeIOAtBBWOnJdJA6jUlA== X-Google-Smtp-Source: AMrXdXsfamXJvmX6NGrxnbTXn2Gawv/ZWKGhTP2lZyU2gOuyZT0GsvAFFfjSMPbGhPIjiY/5OxEoRw== X-Received: by 2002:a17:906:53ce:b0:86b:36a1:919c with SMTP id p14-20020a17090653ce00b0086b36a1919cmr12510179ejo.44.1673942735154; Tue, 17 Jan 2023 00:05:35 -0800 (PST) Received: from dynamic-pd01.res.v6.highway.a1.net ([2001:871:5e:539:1b2c:c52a:475d:310c]) by smtp.gmail.com with ESMTPSA id 11-20020a170906300b00b008675df83251sm5865570ejz.34.2023.01.17.00.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 00:05:34 -0800 (PST) Message-ID: <8591e9bbfe0891eed832c44f98f85c4c608a61a7.camel@cybertec.at> Subject: Re: The documentation for storage type 'plain' actually allows single byte header From: Laurenz Albe To: Tom Lane Cc: Andres Freund , suchithjn22@gmail.com, pgsql-docs@lists.postgresql.org Date: Tue, 17 Jan 2023 09:05:34 +0100 In-Reply-To: <1887216.1673887811@sss.pgh.pa.us> References: <167336599095.2667301.15497893107226841625@wrigleys.postgresql.org> <1698750.1673818827@sss.pgh.pa.us> <245d0f085c68fe0b877235d76a7c32a71454f39b.camel@cybertec.at> <1887216.1673887811@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 (3.46.3-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2023-01-16 at 11:50 -0500, Tom Lane wrote: > Laurenz Albe writes: > > On Sun, 2023-01-15 at 16:40 -0500, Tom Lane wrote: > > > The documentation is correct, what is broken is the code. >=20 > > I see.=C2=A0 But what is the reason for that anyway?=C2=A0 Why not allo= w short varlena > > headers if TOAST storage is set to PLAIN? >=20 > The original motivation for that whole mechanism was to protect data > types for which the C functions haven't been upgraded to support > non-traditional varlena headers.=C2=A0 So I was worried that this behavio= r > would somehow break those cases (which still exist, eg oidvector and > int2vector).=C2=A0 However, the thing that actually marks such a datatype > is that pg_type.typstorage is PLAIN, and as far as I can find we do > still honor that case in full.=C2=A0 If that's the case then every tupdes= c > we ever create for such a column will say PLAIN, so there's no > opportunity for the wrong thing to happen. >=20 > So maybe it's okay to move the goalposts and acknowledge that setting > attstorage to PLAIN isn't a complete block on applying toast-related > transformations.=C2=A0 I wonder though whether short-header is the only > case that can slide through.=C2=A0 In particular, for "INSERT ... SELECT > FROM othertable", I suspect it's possible for a compressed-in-line > datum to slide through without decompression.=C2=A0 (We certainly must > fix out-of-line datums, but that doesn't necessarily mean we undo > compression.)=C2=A0 So I'm not convinced that the proposed wording is > fully correct yet. I see, thanks for the explanation. Since the only storage format I have ever had use for are EXTENDED and EXTERNAL, it is not very important for me if PLAIN supports short headers or not. Since single-byte headers are part of the TOAST mechanism (and documented as such), it makes sense to disable them in PLAIN. Then the documentation could describe PLAIN as "skip all TOAST processing". So we should probably go with the simplest fix that restores consistency. Yours, Laurenz Albe