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.96) (envelope-from ) id 1x67Fc-0002VL-2Y for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Sep 2026 14:01:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x67Fc-00DSgQ-0b for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Sep 2026 14:01:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x67Fb-00DSgH-2M for pgsql-hackers@lists.postgresql.org; Mon, 14 Sep 2026 14:01:39 +0000 Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x67FZ-000000001gN-36lk for pgsql-hackers@lists.postgresql.org; Mon, 14 Sep 2026 14:01:38 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2DF621400012; Mon, 14 Sep 2026 10:01:37 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-02.internal (MEProxy); Mon, 14 Sep 2026 10:01:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1789394497; x=1789480897; bh=5Y7Hz1StZXEyBCP9SRwgdE+aAhhwPkXLJxl70pNPHaM=; b= dPmLRxBgoqgCeNF4jleCotdAfl0oyys+jon80Xg9+vLxOKCAB9IWD/cB03jd2Eor w0wigAdXVG7gfI2d5mPUlxah/Us2FIpnDbZVWE2quRh1TDnJyqj/ChVdJzWm0cQr 4MuGnfN5RhEE3rLPv1UYntiiV0uhKybbkScjl1JoiNsq6JSJ6vlLnxNcJupFlAFZ AWLoKCU9ucV2p6MAT2G+GOW1HWovuJaygLsAH02e71V8ttOnnHHjzJhhniGuhtNQ LWyTc/zexGym36ThOnyWB0pZOjZgPTsSTkUxZ6oCwM2PtwGpj7Mu9JxUjJMseMi6 Jf7jZZvTS9oDlKnY8uCEHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1789394497; x= 1789480897; bh=5Y7Hz1StZXEyBCP9SRwgdE+aAhhwPkXLJxl70pNPHaM=; b=T AWBxxzpjr+M84wbx/BndC1WzXsi7CE3cJw7j4MBMWP0gBuE/8mjX5vL4NlD2O0cY 25W6BmwBNobHeHwH8Hm9PMlY6P381LyvRNkAMYIU4KchQXiDvbH921XVl7ybaJPl RTbcYaqSf19fxhcRv/KMARk3/lv3MaW8DY3uYuQWw1aF6xrwq7d0r0L1Ck1StRQ9 IR1wMZLjubrT9qj1pMeaNbYlgsBP+wYh+u9iqMbYUTv/W4fG9ljHR1PmAzYebLuf diNtA4/RAyoG2cjjrdvIJ4r9WsrX8KSv+92pdICTnrApiR5FAPpKq3K0SurelYEg teh5VxUNnTpF8gjtfrXtw== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGO7xBOeFvuX/Ui6e1grTz4H/IJ8RfFM8jDoB5KLyJOMjyXim9LZLVBV31mzIND9o ERV7cpiNpkZXiOKIk51TQwY1kcTwnUlKkwR9fTOmM40TZSqg0MmARmsfqoItBp+/M2aV99 ksLB6dJOUDCi58iw2nvbdzfdD5OMJvubYyhiMldL4ezThkQXYg7Mjt/JT98LzFW/T1LXnN AZcY0UMlFhL4RiqjV653GIm8mEgJpTtYuBWCYvCExrz7zAeBwRT/zIpjoo6qT78vO+x0db Zm/ovKvEYt4+qmqvofFjkwfV/2jsMQXl354TMaD5uoPygiNv+yK2y9KAyLt9/VL9hZa9nH 1fjF2ezuoWhawSF4bvINnV+NSMw9l+MxyWQJw0mxtnh+TAfny0QAK6AxJjWAqpq29KKBb9 vaHw6RsXCueMFRrvW4AUo5fUHtM003bI7eXw3TWVYpZG/MwyyRZNec1rX8BEY2D1cu70XB y5ZEEGcyVNcH8vU6TAsavqUlPNgKBBrCEAl5FbGUS5yWgk3t+nIAmzSN2E7fxyUONzobr3 ZcwiQP0bOgraCmQBXghU88bbt9Y9Ajl2J77XbfV2K3J6dAZJJd0PLuT/ZNn2WbkKbst2lq VgCBb7x2Zph9tZVOlWHCxg+sYmp7YwDC68ldGWid34hZ13O+4qex1idhw0lg X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 4617C700069; Mon, 14 Sep 2026 10:01:36 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AndmbSv9Jwpo Date: Mon, 14 Sep 2026 10:01:15 -0400 From: "Greg Burd" To: "Michael Paquier" , "Bharath Rupireddy" Cc: "Yugo Nagata" , "PostgreSQL Hackers" Message-Id: In-Reply-To: References: <4272005a-ca62-46be-aab3-8678187d84cd@app.fastmail.com> Subject: Re: Support for 8-byte TOAST values, round two Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Sep 14, 2026, at 1:00 AM, Michael Paquier wrote: > On Fri, Sep 11, 2026 at 08:44:26AM -0700, Bharath Rupireddy wrote: >> I reviewed v17 patches, overall they look good to me. >> >> v17-0001-Refactor-some-TOAST-value-ID-code-to-use-Oid8-in.patch: It >> v17-0002-Switch-pg_column_toast_chunk_id-return-value-fro.patch: It > > I have discarded the change of reorderbuffer.c that was in v17-0001, > and added it back to what's now v18-0001. Then applied these two > after an extra round of self-review. > >> v17-0003-Add-support-for-oid8-TOAST-values.patch: It looks good to me >> with one nit. Since chunk_id is always at attnum = 1 and all the >> toast_valueid_scankey_init() callers pass it as 1, and this init >> function is just to fetch the chunk_id, can we just hard-code it >> inside and remove the attnum function parameter? > > If one wants to control which attribute number to look after, that > could be extended more later on, yes. I have removed the argument > from the function in v18-0001. > >> v17-0004-Add-battery-of-tests-related-oid8.patch: It looks good to me. > > Okay, thanks. > >> pg_dump/pg_restore for demoing OID4 to OID8 migration for >> existing tables and TOAST table tests during pg_upgrade could be >> follow-up patches. This makes me think, if someone does an OID8 to >> OID4 migration and the chunk_ids are beyond the 4-billion limit, the >> restore should fail rather than silently wrapping the chunk_ids and >> causing TOAST index insert failures. My point is, we need to test this >> case as well. > > Nah, I don't buy that this is worth the cycles. If one has the idea > to create an oid8 TOAST table, inserts more than 4 billion values into > it, dumps and restores into a table that uses a oid TOAST then the > result is an infinite loop in the backend on restored INSERTs. > > Something that I still see as a hole is that we have the tables from > the strings test in the main regression test suite and we could > exploit that a bit more. Hmm. How about resetting the OID in the > control file earlier in the pg_upgrade test and check with a SELECT > post-upgrade that the counters generated by the main regression test > suite are more than 2^32? > > Added also some tests for REPACK here in what's now 0002, based on the > feedback of upthread, to check that the a REPACK's rewrite does not > touch the TOAST table definition. > >> v17-0005-Add-support-for-TOAST-pointers-as-oid8.patch: It looks good to me. > > And rebased is a v18 with the three remaining pieces, plus two more > test patches: the tests of Rui with decoding and oid8 values higher > than 2^32, and my test to have the main regression test suite of > pg_upgrade run with a default oid8 in the control file higher than > 2^32, checking that assigned chunk numbers are handled correctly. > -- > Michael > > Attachments: > * v18-0001-Add-support-for-oid8-TOAST-values.patch > * v18-0002-Add-battery-of-tests-related-oid8.patch > * v18-0003-Add-support-for-TOAST-pointers-as-oid8.patch > * v18-0004-Decode-an-oid8-TOAST-value-with-an-ID-past-2-32.patch > * v18-0005-Add-check-for-2-32-oid8-chunk-values-across-the-.patch > * signature.asc Hello Michael, all, I tried v18 out, as expected patches/tests/etc. all good on my macOS/arm64 laptop. I agree with Bharath that dropping the attnum argument from toast_valueid_scankey_init() was right, and I see it is gone in 0001. I like what you did in 0005 with the test, moving the pg_resetwal call ahead of the main regression suite means the whole suite now runs with the counter already past 2^32, rather than just one case checking a large value. ok 1 - set an 8-byte OID counter in the old instance ok 7 - oid8 chunk_ids are past 2^32 ok 25 - 8-byte OID counter is carried over by pg_upgrade I'd say that closes the gap Bharath identified, where every oid8 test still produced chunk_ids that fit in four bytes. Rui's decoding test in 0004 covers the other half, and I checked separately that it fails when it should: with ReorderBufferToastAppendChunk() put back to the truncating 4-byte read it reports not ok 23 - oid8 TOAST value past 2^32 is decoded in full # table public.toasted_oid8: INSERT: id[integer]:1 data[text]:unchanged-toast-datum and passes again once restored. The REPACK additions in 0002 match what I measured by hand: with the reloption flipped, VACUUM FULL, CLUSTER and REPACK all leave the TOAST table's chunk_id type alone. A quick check of my own on top of v18, counter preset to 5000000000: chunk_ids 5000000005 through 5000000054, all past 2^32, data intact, verify_heapam() reports nothing on either the TOAST relation or the main table, and REPACK leaves chunk_id as oid8 with the data still intact. Nothing blocking from me on v18. best. -greg