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 1pHSge-0005WH-Pr for pgsql-docs@arkaria.postgresql.org; Mon, 16 Jan 2023 16:50:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHSgd-0000tR-H8 for pgsql-docs@arkaria.postgresql.org; Mon, 16 Jan 2023 16:50:19 +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 1pHSgd-0000sf-9Q for pgsql-docs@lists.postgresql.org; Mon, 16 Jan 2023 16:50:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHSgb-0001EM-2v for pgsql-docs@lists.postgresql.org; Mon, 16 Jan 2023 16:50:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 30GGoBRS1887217; Mon, 16 Jan 2023 11:50:12 -0500 From: Tom Lane To: Laurenz Albe cc: Andres Freund , suchithjn22@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: The documentation for storage type 'plain' actually allows single byte header In-reply-to: <245d0f085c68fe0b877235d76a7c32a71454f39b.camel@cybertec.at> References: <167336599095.2667301.15497893107226841625@wrigleys.postgresql.org> <1698750.1673818827@sss.pgh.pa.us> <245d0f085c68fe0b877235d76a7c32a71454f39b.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Mon, 16 Jan 2023 14:07:48 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1887215.1673887811.1@sss.pgh.pa.us> Date: Mon, 16 Jan 2023 11:50:11 -0500 Message-ID: <1887216.1673887811@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. > I see. But what is the reason for that anyway? Why not allow short varlena > headers if TOAST storage is set to PLAIN? 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. So I was worried that this behavior would somehow break those cases (which still exist, eg oidvector and int2vector). 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. If that's the case then every tupdesc we ever create for such a column will say PLAIN, so there's no opportunity for the wrong thing to happen. 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. I wonder though whether short-header is the only case that can slide through. In particular, for "INSERT ... SELECT FROM othertable", I suspect it's possible for a compressed-in-line datum to slide through without decompression. (We certainly must fix out-of-line datums, but that doesn't necessarily mean we undo compression.) So I'm not convinced that the proposed wording is fully correct yet. regards, tom lane