public inbox for [email protected]  
help / color / mirror / Atom feed
pgsql: pg_upgrade: Preserve default char signedness value from old clus
6+ messages / 3 participants
[nested] [flat]

* pgsql: pg_upgrade: Preserve default char signedness value from old clus
@ 2025-02-21 18:20  Masahiko Sawada <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Masahiko Sawada @ 2025-02-21 18:20 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: pg_upgrade: Preserve default char signedness value from old clus
@ 2025-03-17 17:20  Robert Haas <[email protected]>
  parent: Masahiko Sawada <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Robert Haas @ 2025-03-17 17:20 UTC (permalink / raw)
  To: Masahiko Sawada <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>

On Fri, Feb 21, 2025 at 1:20 PM Masahiko Sawada <[email protected]> wrote:
> pg_upgrade: Preserve default char signedness value from old cluster.

Hi,

I noticed that after running 'meson test --suite setup --suite
pg_upgrade', the file delete_old_cluster.sh is left behind in the
source directory, which should not happen. Everything created for the
tests should be created in the meson directories. I traced the problem
down to 005_char_signedness.pl. I believe the problem is likely that
other pg_upgrade TAP tests include this locution, whereas
005_char_signedness.pl does not:

# In a VPATH build, we'll be started in the source directory, but we want
# to run pg_upgrade in the build directory so that any files generated finish
# in it, like delete_old_cluster.{sh,bat}.
chdir ${PostgreSQL::Test::Utils::tmp_check};

Regards,

-- 
Robert Haas
EDB: http://www.enterprisedb.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: pg_upgrade: Preserve default char signedness value from old clus
@ 2025-03-17 22:01  Masahiko Sawada <[email protected]>
  parent: Robert Haas <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Masahiko Sawada @ 2025-03-17 22:01 UTC (permalink / raw)
  To: Robert Haas <[email protected]>; +Cc: Masahiko Sawada <[email protected]>; PostgreSQL Hackers <[email protected]>

On Mon, Mar 17, 2025 at 10:20 AM Robert Haas <[email protected]> wrote:
>
> On Fri, Feb 21, 2025 at 1:20 PM Masahiko Sawada <[email protected]> wrote:
> > pg_upgrade: Preserve default char signedness value from old cluster.
>
> Hi,
>
> I noticed that after running 'meson test --suite setup --suite
> pg_upgrade', the file delete_old_cluster.sh is left behind in the
> source directory, which should not happen. Everything created for the
> tests should be created in the meson directories. I traced the problem
> down to 005_char_signedness.pl. I believe the problem is likely that
> other pg_upgrade TAP tests include this locution, whereas
> 005_char_signedness.pl does not:
>
> # In a VPATH build, we'll be started in the source directory, but we want
> # to run pg_upgrade in the build directory so that any files generated finish
> # in it, like delete_old_cluster.{sh,bat}.
> chdir ${PostgreSQL::Test::Utils::tmp_check};

Thank you for the report.

I've confirmed the issue and attached a patch to fix it.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com


Attachments:

  [application/octet-stream] 0001-Fix-the-test-005_char_signedness.patch (1.4K, 2-0001-Fix-the-test-005_char_signedness.patch)
  download | inline diff:
From 6fe1578bcbf7f579869684a71dd463bb2939d82c Mon Sep 17 00:00:00 2001
From: Masahiko Sawada <[email protected]>
Date: Mon, 17 Mar 2025 14:52:13 -0700
Subject: [PATCH] Fix the test 005_char_signedness.

pg_upgrade test 003_char_signedness was leaving files like
delete_old_cluster.sh in the source directory for VPATH and meson
builds. The fix is to change the directory to tmp_check before running
the test.

Reported-by: Robert Haas <[email protected]>
Reviewed-by:
Discussion: http://postgr.es/m/CA+TgmoYg5e4oznn0XGoJ3+mceG1qe_JJt34rF2JLwvGS5T1hgQ@mail.gmail.com
---
 src/bin/pg_upgrade/t/005_char_signedness.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bin/pg_upgrade/t/005_char_signedness.pl b/src/bin/pg_upgrade/t/005_char_signedness.pl
index 0190747758c..17fa0d48b15 100644
--- a/src/bin/pg_upgrade/t/005_char_signedness.pl
+++ b/src/bin/pg_upgrade/t/005_char_signedness.pl
@@ -45,6 +45,11 @@ command_like(
 	qr/Default char data signedness:\s+unsigned/,
 	'updated default char signedness is unsigned in control file');
 
+# In a VPATH build, we'll be started in the source directory, but we want
+# to run pg_upgrade in the build directory so that any files generated finish
+# in it, like delete_old_cluster.{sh,bat}.
+chdir ${PostgreSQL::Test::Utils::tmp_check};
+
 # Cannot use --set-char-signedness option for upgrading from v18+
 command_checks_all(
 	[
-- 
2.43.5



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: pg_upgrade: Preserve default char signedness value from old clus
@ 2025-03-18 03:02  Robert Haas <[email protected]>
  parent: Masahiko Sawada <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Robert Haas @ 2025-03-18 03:02 UTC (permalink / raw)
  To: Masahiko Sawada <[email protected]>; +Cc: Masahiko Sawada <[email protected]>; PostgreSQL Hackers <[email protected]>

On Mon, Mar 17, 2025 at 6:02 PM Masahiko Sawada <[email protected]> wrote:
> I've confirmed the issue and attached a patch to fix it.

Cool. The commit message refers to 003_char_signedness, but the test
name is 005, not 003.

-- 
Robert Haas
EDB: http://www.enterprisedb.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: pg_upgrade: Preserve default char signedness value from old clus
@ 2025-03-18 04:35  Masahiko Sawada <[email protected]>
  parent: Robert Haas <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Masahiko Sawada @ 2025-03-18 04:35 UTC (permalink / raw)
  To: Robert Haas <[email protected]>; +Cc: Masahiko Sawada <[email protected]>; PostgreSQL Hackers <[email protected]>

On Mon, Mar 17, 2025 at 8:02 PM Robert Haas <[email protected]> wrote:
>
> On Mon, Mar 17, 2025 at 6:02 PM Masahiko Sawada <[email protected]> wrote:
> > I've confirmed the issue and attached a patch to fix it.
>
> Cool. The commit message refers to 003_char_signedness, but the test
> name is 005, not 003.

Thank you for reviewing the patch. I've pushed the patch after fixing it.


Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: pgsql: pg_upgrade: Preserve default char signedness value from old clus
@ 2025-03-18 12:28  Robert Haas <[email protected]>
  parent: Masahiko Sawada <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Robert Haas @ 2025-03-18 12:28 UTC (permalink / raw)
  To: Masahiko Sawada <[email protected]>; +Cc: Masahiko Sawada <[email protected]>; PostgreSQL Hackers <[email protected]>

On Tue, Mar 18, 2025 at 12:36 AM Masahiko Sawada <[email protected]> wrote:
> > Cool. The commit message refers to 003_char_signedness, but the test
> > name is 005, not 003.
>
> Thank you for reviewing the patch. I've pushed the patch after fixing it.

Thanks for taking care of it (and so quickly!).

-- 
Robert Haas
EDB: http://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2025-03-18 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-21 18:20 pgsql: pg_upgrade: Preserve default char signedness value from old clus Masahiko Sawada <[email protected]>
2025-03-17 17:20 ` Robert Haas <[email protected]>
2025-03-17 22:01   ` Masahiko Sawada <[email protected]>
2025-03-18 03:02     ` Robert Haas <[email protected]>
2025-03-18 04:35       ` Masahiko Sawada <[email protected]>
2025-03-18 12:28         ` Robert Haas <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox