Re: pgsql: Trial fix for old cross-version upgrades.

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Jeff Davis <pgsql(at)j-davis(dot)com>, Jeff Davis <jdavis(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Trial fix for old cross-version upgrades.
Date: 2025-02-28 18:15:52
Message-ID: CAA5RZ0udD=7o6pjBSiEEzN60Jd3X1=vrXed+0YivYCVrqvav=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

> 5.16 is still supported according to our install instructions,
> so let's see if we can adjust that regex so it works with 5.16.
> The first thing I'd try is
>
> - $dump =~ s {(^\s+'version',) '\d+'::integer,$}
> + $dump =~ s {^(\s+'version',) '\d+'::integer,$}
>

With the diff below, I still observed the same issue.

@@ -296,7 +296,7 @@ sub adjust_old_dumpfile

# Same with version argument to pg_restore_relation_stats() or
# pg_restore_attribute_stats().
- $dump =~ s {(^\s+'version',) '\d+'::integer,$}
+ $dump =~ s {^(\s+'version',) '\d+'::integer,$}
{$1 '000000'::integer,}mg;

if ($old_version < 16)
@@ -645,7 +645,7 @@ sub adjust_new_dumpfile

# Same with version argument to pg_restore_relation_stats() or
# pg_restore_attribute_stats().
- $dump =~ s {(^\s+'version',) '\d+'::integer,$}
+ $dump =~ s {^(\s+'version',) '\d+'::integer,$}
{$1 '000000'::integer,}mg;

I also tested the same regexp expression in isolation
and I could not repro the issue. Will try a real dumpfile next.

/tmp/test.pl
"""
use strict;

my $dump = " 'version', '180000'::integer,";
print "$dump\n";

$dump =~ s [(^\s+'version',) '\d+'::integer,$] [$1 '000000'::integer,]mg;

print "$dump\n";

"""

simseih % /usr/bin/perl -v | grep "This is perl"
This is perl 5, version 16, subversion 3 (v5.16.3) built for
x86_64-linux-thread-multi

simseih % /usr/bin/perl /tmp/test.pl
'version', '180000'::integer,
'version', '000000'::integer,

--

Sami

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2025-02-28 18:27:18 pgsql: Avoid including explain.h in explain_format.h and explain_dr.h
Previous Message Robert Haas 2025-02-28 18:08:10 pgsql: Fix missing space in EXPLAIN ANALYZE output.