Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing - Mailing list pgsql-committers

From Michael Paquier
Subject Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing
Date
Msg-id Z-huFcVLtZVp2q51@paquier.xyz
Whole thread Raw
In response to Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing
List pgsql-committers
On Sat, Mar 29, 2025 at 09:24:58AM -0700, Jeff Davis wrote:
> This seems to have broken the pg_upgrade test when olddump/oldinstall
> are set to PG14 or earlier:
>
> stderr:
> #   Failed test 'check that locales in new cluster match original
> cluster'
> #   at
> /home/jdavis/git/postgresql/src/bin/pg_upgrade/t/002_pg_upgrade.pl line
> 506.
> #          got: '0|c|C|C|NULL'
> #     expected: '0|c|C|C|'
> # Looks like you failed 1 test of 16.
>
> Looking at the commit, it seems you are escaping NULL as a literal.

Thanks for the report.  It would be possible to switch to a second
approach here, where we use pg_free() if we don't have a
locale->db_locale to make sure that the memory is freed in its correct
context, like in the attached.  What do you think?

This test has been added in v16 via 9637badd9f92, with the buildfarm
not complaining.  Could it be possible to improve the situation so as
we would know about 002_pg_upgrade.pl failing for such cross-upgrades
like what you are doing here?
--
Michael

Attachment

pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: localbuf: Track pincount in BufferDesc as well
Next
From: Tomas Vondra
Date:
Subject: pgsql: Remove incidental md5() function use from test