On Mon, 2024-03-11 at 17:08 -0400, Tom Lane wrote:
> Jeff Davis <[email protected]> writes:
>
> was perfectly correct as it stood, because pg_version is a
> PostgreSQL::Version object. Why did you feel a need to
> editorialize on that?
The goal was to do a version check for 17 that's inclusive of
development versions.
Patch attached, following the example in AdjustUpgrade.pm. It feels a
bit inconsistent to sometimes use $oldnode->pg_version and sometimes
use $old_major_version, but it's certainly better than what I had done
in f696c0cd5f.
Regards,
Jeff Davis
From ad3ba667553d8c2862b74939676244340631d192 Mon Sep 17 00:00:00 2001
From: Jeff Davis <[email protected]>
Date: Mon, 11 Mar 2024 15:32:41 -0700
Subject: [PATCH v1] Another fix to 002_pg_upgrade.pl.
Properly use PostgreSQL::Version, rather than the hacks introduced by
f696c0cd5f.
Discussion: https://postgr.es/m/[email protected]
Reported-by: Tom Lane
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 5ef78691cb..18335070c8 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -92,9 +92,9 @@ my $oldnode =
PostgreSQL::Test::Cluster->new('old_node',
install_path => $ENV{oldinstall});
-# Numeric major version of old cluster, ignoring "devel" suffix.
-# Needed for testing upgrades from development version to itself.
-my $old_major_version = int($oldnode->pg_version =~ s/devel//rg);
+# Needed in some cases for testing upgrades from a development or beta
+# version to itself.
+my $old_major_version = PostgreSQL::Version->new($oldnode->pg_version->major);
my %node_params = ();
@@ -118,7 +118,7 @@ my $original_locale = "C";
my $original_datlocale = "";
my $provider_field = "'c' AS datlocprovider";
my $old_datlocale_field = "NULL AS datlocale";
-if ($old_major_version >= 15 && $ENV{with_icu} eq 'yes')
+if ($oldnode->pg_version >= 15 && $ENV{with_icu} eq 'yes')
{
$provider_field = "datlocprovider";
if ($old_major_version >= 17)
--
2.34.1