pgsql: pg_upgrade: Preserve default char signedness value from old clus

From: Masahiko Sawada <msawada(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_upgrade: Preserve default char signedness value from old clus
Date: 2025-02-21 18:20:37
Message-ID: E1tlXde-000VTE-1s@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

pg_upgrade: Preserve default char signedness value from old cluster.

Commit 44fe30fdab6 introduced the 'default_char_signedness' field in
controlfile. Newly created database clusters always set this field to
'signed'.

This change ensures that pg_upgrade updates the
'default_char_signedness' to 'unsigned' if the source database cluster
has signedness=false. For source clusters from v17 or earlier, which
lack the 'default_char_signedness' information, pg_upgrade assumes the
source cluster was initialized on the same platform where pg_upgrade
is running. It then sets the 'default_char_signedness' value according
to the current platform's default character signedness.

Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/CB11ADBC-0C3F-4FE0-A678-666EE80CBB07%40amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a8238f87f980848c2d69c105555c4383e20e7670

Modified Files
--------------
src/bin/pg_upgrade/controldata.c | 44 ++++++++++++++++++-
src/bin/pg_upgrade/pg_upgrade.c | 28 +++++++++++++
src/bin/pg_upgrade/pg_upgrade.h | 6 +++
src/bin/pg_upgrade/t/005_char_signedness.pl | 65 +++++++++++++++++++++++++++++
4 files changed, 142 insertions(+), 1 deletion(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2025-02-21 18:24:13 pgsql: pg_upgrade: Add --set-char-signedness to set the default char si
Previous Message Masahiko Sawada 2025-02-21 18:15:28 pgsql: pg_resetwal: Add --char-signedness option to change the default

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2025-02-21 18:22:28 Re: Amcheck verification of GiST and GIN
Previous Message Alvaro Herrera 2025-02-21 18:19:10 Re: Psql meta-command conninfo+