Re: Support for 8-byte TOAST values, round two

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Greg Burd <greg(at)burd(dot)me>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Support for 8-byte TOAST values, round two
Date: 2026-09-14 23:43:44
Message-ID: CALj2ACUmBhBGb+4d8SRq9JT_ZsObCAvY6-10CKgSWX98zdv2DQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sun, Sep 13, 2026 at 10:00 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Sep 11, 2026 at 08:44:26AM -0700, Bharath Rupireddy wrote:
>
> > 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?

I think I found an issue related to pg_dump/pg_restore where a dump
and restore after an ALTER TABLE RESET on the reloption would
downgrade the TOAST table from oid8 back to oid. More details in the
attached 0001 patch.

I also attached some more patches that I think would help with the
overall pg_dump and pg_restore along with the migration path for
existing oid TOAST tables.

I used the nocfbot prefix for these patches to not come in the way of
the main patches, and they can go after them. Please find them
attached.

0001 - fixes the pg_dump/pg_restore downgrade issue
0002 - adds a doc section on the migration
0003 - adds tests for the oid to oid8 migration and vice versa

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
nocfbot-v1-0001-pg_dump-Preserve-the-chunk_id-type-of-a-TOAST-rel.patch application/octet-stream 12.4 KB
nocfbot-v1-0002-doc-Describe-how-to-change-the-chunk_id-type-of-a.patch application/octet-stream 3.7 KB
nocfbot-v1-0003-pg_dump-Test-a-requested-change-of-the-chunk_id-t.patch application/octet-stream 5.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2026-09-14 23:47:26 Re: pg_createsubscriber does not check output_plugin_libraries
Previous Message Robert Haas 2026-09-14 23:30:59 Re: Trying to break online checksums with LLMs