From dee849e3d11995616a13cfcd88a5d319eb5d3915 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Mon, 14 Sep 2026 13:54:44 +0900 Subject: [PATCH v18 5/5] Add check for 2^32 oid8 chunk values across the main regression test suite As a matter of making this cheaper, this check is included in pg_upgrade, where we also need to check that oid8 values are carried across upgrades. --- src/bin/pg_upgrade/t/002_pg_upgrade.pl | 41 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 728fd6b0b120..f426074ce6bf 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -229,6 +229,21 @@ $oldnode->append_conf('postgresql.conf', 'log_statement = none'); # Set wal_level = replica to run the regression tests in the same # wal_level as when 'make check' runs. $oldnode->append_conf('postgresql.conf', 'wal_level = replica'); + +# The OID counter is 8 bytes wide, check that it is carried across the +# test. Older versions may not support 8-byte OIDs, so skip in this case. +my $big_next_oid = '4295067296'; # 2^32 + 100000 +if (!defined($ENV{oldinstall})) +{ + command_ok( + [ + 'pg_resetwal', + '--next-oid' => $big_next_oid, + $oldnode->data_dir + ], + 'set an 8-byte OID counter in the old instance'); +} + $oldnode->start; my $result; @@ -296,6 +311,18 @@ else 'regression tests in old instance'); } +# Checks for 8-byte OIDs +if (!defined($ENV{oldinstall})) +{ + # Table with 8-byte OID values, past 2^32. + is( $oldnode->safe_psql( + 'regression', + "SELECT max(pg_column_toast_chunk_id(f1)) > '$big_next_oid'::oid8 FROM toasttest_oid8" + ), + 't', + 'oid8 chunk_ids are past 2^32'); +} + # Initialize a new node for the upgrade. my $newnode = PostgreSQL::Test::Cluster->new('new_node'); @@ -588,20 +615,6 @@ $oldnode->start; $oldnode->safe_psql('postgres', 'DROP DATABASE regression_invalid'); $oldnode->stop; -# The OID counter is 8 bytes wide, check that it is carried. Older versions -# may not support 8-byte OIDs, so skip in this case. -my $big_next_oid = '4295067296'; # 2^32 + 100000 -if (!defined($ENV{oldinstall})) -{ - command_ok( - [ - 'pg_resetwal', - '--next-oid' => $big_next_oid, - $oldnode->data_dir - ], - 'set an 8-byte OID counter in the old instance'); -} - # --check command works here, cleans up pg_upgrade_output.d. command_ok( [ -- 2.55.0