=== Applying patches on top of PostgreSQL commit ID 76ac7f718d86dc0b6444668b53bf3e340517a9e8 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Fri Dec 4 09:26:33 UTC 2026 On branch cf/7742 nothing to commit, working tree clean === using 'git am' to apply patch ./v2-0001-Check-LP_DEAD-index-entries-before-reusing-an-OID.patch === Applying: Check LP_DEAD index entries before reusing an OID Using index info to reconstruct a base tree... M src/backend/catalog/catalog.c M src/test/modules/test_misc/Makefile M src/test/modules/test_misc/meson.build Falling back to patching base and 3-way merge... CONFLICT (add/add): Merge conflict in src/test/modules/test_misc/t/017_toast_oid_reuse.pl Auto-merging src/test/modules/test_misc/t/017_toast_oid_reuse.pl error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Check LP_DEAD index entries before reusing an OID When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v2-0001-Check-LP_DEAD-index-entries-before-reusing-an-OID.patch === patching file src/backend/catalog/catalog.c Hunk #1 FAILED at 22. Hunk #2 succeeded at 522 with fuzz 2 (offset 6 lines). Hunk #3 succeeded at 579 with fuzz 2 (offset 10 lines). 1 out of 3 hunks FAILED -- saving rejects to file src/backend/catalog/catalog.c.rej patching file src/test/modules/test_misc/Makefile Hunk #1 FAILED at 3. 1 out of 1 hunk FAILED -- saving rejects to file src/test/modules/test_misc/Makefile.rej patching file src/test/modules/test_misc/meson.build Hunk #1 FAILED at 25. 1 out of 1 hunk FAILED -- saving rejects to file src/test/modules/test_misc/meson.build.rej The next patch would create the file src/test/modules/test_misc/t/017_toast_oid_reuse.pl, which already exists! Skipping patch. 1 out of 1 hunk ignored Unstaged changes after reset: M src/backend/catalog/catalog.c Removing src/backend/catalog/catalog.c.rej Removing src/test/modules/test_misc/Makefile.rej Removing src/test/modules/test_misc/meson.build.rej === using 'git apply' to apply patch ./v2-0001-Check-LP_DEAD-index-entries-before-reusing-an-OID.patch === Applied patch to 'src/backend/catalog/catalog.c' cleanly. Applied patch to 'src/test/modules/test_misc/Makefile' cleanly. Applied patch to 'src/test/modules/test_misc/meson.build' cleanly. Performing three-way merge... Applied patch to 'src/test/modules/test_misc/t/017_toast_oid_reuse.pl' with conflicts. U src/test/modules/test_misc/t/017_toast_oid_reuse.pl diff --cc src/test/modules/test_misc/t/017_toast_oid_reuse.pl index d78dd2efe85,0cfd546ee5f..00000000000 --- a/src/test/modules/test_misc/t/017_toast_oid_reuse.pl +++ b/src/test/modules/test_misc/t/017_toast_oid_reuse.pl @@@ -1,7 -1,9 +1,15 @@@ # Copyright (c) 2026, PostgreSQL Global Development Group ++<<<<<<< ours +# +# A new TOAST value must not reuse the ID of a deleted value whose chunks +# are still in the heap, even if their index entries are marked LP_DEAD. ++======= + + # A new TOAST value must not get the value ID of a deleted value whose chunks + # are still in the TOAST table, even when the index entries for those chunks + # are marked LP_DEAD. A hot standby does not skip LP_DEAD entries, so it + # would find the chunks of both values. ++>>>>>>> theirs use strict; use warnings FATAL => 'all'; @@@ -17,7 -19,7 +25,11 @@@ $node_primary->start $node_primary->safe_psql('postgres', 'CREATE EXTENSION pageinspect'); ++<<<<<<< ours +# Each value is stored uncompressed, in two chunks. ++======= + # With STORAGE EXTERNAL, each value is stored uncompressed in two chunks. ++>>>>>>> theirs my $toastrel = $node_primary->safe_psql( 'postgres', q{ CREATE TABLE toast_reuse (v text) @@@ -36,8 -38,8 +48,13 @@@ $node_primary->safe_psql('postgres', 'D $node_primary->safe_psql('postgres', 'CHECKPOINT'); # Fetch the deleted chunks through the index. The heap tuples are dead to ++<<<<<<< ours +# everyone, so the scan marks their index entries with LP_DEAD, while the +# heap page has too much free space to be pruned. ++======= + # everyone, so the scan marks their index entries LP_DEAD, while the heap + # page has too much free space to be pruned. ++>>>>>>> theirs $node_primary->safe_psql( 'postgres', qq{ SET enable_seqscan = off; @@@ -47,10 -49,10 +64,17 @@@ SELECT count(*) FROM $toastrel WHERE ch my $ndead = $node_primary->safe_psql('postgres', "SELECT count(*) FROM bt_page_items('${toastrel}_index', 1) WHERE dead"); is($ndead, '2', ++<<<<<<< ours + 'index entries of the deleted TOAST value are marked with LP_DEAD'); + +# Make the deleted value's ID the next OID to be assigned. This emulates +# a wraparound of the OID counter. ++======= + 'index entries of the deleted TOAST value are marked LP_DEAD'); + + # Make the deleted value's ID the next OID to be assigned, as if the OID + # counter had wrapped around. ++>>>>>>> theirs $node_primary->stop; command_ok( [ 'pg_resetwal', '--next-oid' => $valueid, $node_primary->data_dir ],