Package: release.debian.org
Severity: normal
X-Debbugs-Cc: postgresql-com...@packages.debian.org
Control: affects -1 + src:postgresql-common
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package postgresql-common

[ Reason ]
The new version prepares compatibility with PostgreSQL 18 due in
September, making it easier to upgrade to that version later.

[ Impact ]
The update is not required.

[ Tests ]
postgresql-common tests (the vacuumdb/analyze part is specifically
tested by the changes)

unblock postgresql-common/278

Christoph
No differences were encountered between the control files

diff -Nru postgresql-common-277/debian/changelog postgresql-common-278/debian/changelog
--- postgresql-common-277/debian/changelog	2025-04-09 12:17:57.000000000 +0200
+++ postgresql-common-278/debian/changelog	2025-05-07 17:58:33.000000000 +0200
@@ -1,3 +1,11 @@
+postgresql-common (278) unstable; urgency=medium
+
+  * pg_upgradecluster: Do two vacuumdb runs in analyze hook for PG18+.
+  * t/040_upgrade.t: Verify presence of stats after upgrade.
+  * pg_virtualenv: Adjust to extension_control_path change in PG18.
+
+ -- Christoph Berg <m...@debian.org>  Wed, 07 May 2025 17:58:33 +0200
+
 postgresql-common (277) unstable; urgency=medium
 
   * Updated ro translation by Remus-Gabriel Chelu, thanks! (Closes: #1101817)
diff -Nru postgresql-common-277/pg_upgradecluster.d/analyze postgresql-common-278/pg_upgradecluster.d/analyze
--- postgresql-common-277/pg_upgradecluster.d/analyze	2025-03-24 12:53:25.000000000 +0100
+++ postgresql-common-278/pg_upgradecluster.d/analyze	2025-04-23 19:41:04.000000000 +0200
@@ -9,28 +9,27 @@
 newversion="$3"
 phase="$4"
 
-case $newversion in
-    9.2|9.3)
-        analyze="--analyze-only"
-        ;;
-    9.[4-6]|1[0-7])
-        analyze="--analyze-in-stages"
-        ;;
-    *)
-        analyze="--analyze-in-stages --missing-stats-only"
-        ;;
-esac
+[ "$phase" = "finish" ] || exit 0
+
+flags="--cluster $newversion/$cluster --all"
 
 case $newversion in
     9.5|9.6|[1-7]*)
-        [ "${PGJOBS:-}" ] && jobs="--jobs=$PGJOBS"
+        [ "${PGJOBS:-}" ] && flags="$flags --jobs=$PGJOBS"
         ;;
 esac
 
-case $phase in
-    finish)
-        vacuumdb --cluster "$newversion/$cluster" --all $analyze ${jobs:-}
+case $newversion in
+    9.2|9.3)
+        vacuumdb $flags --analyze-only
+        ;;
+    9.[4-6]|1[0-7])
+        vacuumdb $flags --analyze-in-stages
+        ;;
+    *)
+        # fill in missing stats
+        vacuumdb $flags --analyze-in-stages --missing-stats-only
+        # re-analyze everything to update row statistics
+        vacuumdb $flags --analyze-only
         ;;
 esac
-
-exit 0
diff -Nru postgresql-common-277/pg_virtualenv postgresql-common-278/pg_virtualenv
--- postgresql-common-277/pg_virtualenv	2025-03-19 15:41:26.000000000 +0100
+++ postgresql-common-278/pg_virtualenv	2025-05-02 18:29:14.000000000 +0200
@@ -191,7 +191,7 @@
     if [ "${PACKAGE:-}" ]; then
         case $v in
             18|19|[2-7]*) # find extension using extension_control_path
-                PKGARGS="--pgoption extension_control_path=$PWD/debian/$PACKAGE/usr/share/postgresql/$v/extension:\$system --pgoption dynamic_library_path=$PWD/debian/$PACKAGE/usr/lib/postgresql/$v/lib:/usr/lib/postgresql/$v/lib"
+                PKGARGS="--pgoption extension_control_path=$PWD/debian/$PACKAGE/usr/share/postgresql/$v:\$system --pgoption dynamic_library_path=$PWD/debian/$PACKAGE/usr/lib/postgresql/$v/lib:/usr/lib/postgresql/$v/lib"
                 ;;
             *) # older versions have a Debian-specific patch
                 if grep -q 'extension_destdir' /usr/share/postgresql/$v/postgresql.conf.sample; then
diff -Nru postgresql-common-277/t/040_upgrade.t postgresql-common-278/t/040_upgrade.t
--- postgresql-common-277/t/040_upgrade.t	2025-01-23 17:14:24.000000000 +0100
+++ postgresql-common-278/t/040_upgrade.t	2025-04-23 19:44:28.000000000 +0200
@@ -15,7 +15,7 @@
 use TestLib;
 use PgCommon;
 
-use Test::More tests => (@MAJORS == 1) ? 1 : 127 * 3;
+use Test::More tests => (@MAJORS == 1) ? 1 : 130 * 3;
 
 if (@MAJORS == 1) {
     pass 'only one major version installed, skipping upgrade tests';
@@ -40,7 +40,7 @@
 	0, 'Create nobody user and test databases');
 is ((exec_as 'nobody', 'psql test -c "CREATE TABLE phone (name varchar(255) PRIMARY KEY, tel int NOT NULL)"'), 
     0, 'create table');
-is ((exec_as 'nobody', 'psql test -c "INSERT INTO phone VALUES (\'Alice\', 2)"'), 0, 'insert Alice into phone table');
+is ((exec_as 'nobody', 'psql test -c "INSERT INTO phone VALUES (\'Alice\', 222)"'), 0, 'insert Alice into phone table');
 SKIP: {
     skip 'datallowconn = f not supported with pg_upgrade', 1 if $upgrade_options =~ /upgrade/;
     is ((exec_as 'postgres', 'psql template1 -c "UPDATE pg_database SET datallowconn = \'f\' WHERE datname = \'testnc\'"'),
@@ -113,8 +113,8 @@
 # exercise ACL on old database to ensure they are working
 is_program_out 'nobody', 'psql -U foo -qc "CREATE SCHEMA s_foo" test', 0, '',
     'CREATE SCHEMA on old cluster (ACL)';
-is_program_out 'nobody', 'psql -U foo -qc "INSERT INTO phone VALUES (\'Bob\', 1)" test', 
-    0, '', 'insert Bob into phone table (ACL)';
+is_program_out 'nobody', 'psql -U foo -qc "INSERT INTO phone VALUES (\'Bob\', 111), (\'Denise\', 222)" test',
+    0, '', 'insert Bob and Denise into phone table (ACL)';
 
 # set config parameters
 is_program_out 'postgres', "pg_conftool $MAJORS[0] upgr set log_statement all",
@@ -152,8 +152,9 @@
 # Check SELECT in original cluster
 my $select_old;
 is ((exec_as 'nobody', 'psql -tAc "SELECT * FROM phone ORDER BY name" test', $select_old), 0, 'SELECT in original cluster succeeds');
-is ($$select_old, 'Alice|2
-Bob|1
+is ($$select_old, 'Alice|222
+Bob|111
+Denise|222
 ', 'check SELECT output in original cluster');
 
 # create inaccessible cwd, to check for confusing error messages
@@ -163,9 +164,12 @@
 chdir '/tmp/pgtest';
 
 # Upgrade to latest version
+note "Running pg_upgradecluster -v $MAJORS[-1] $upgrade_options $MAJORS[0] upgr";
 my $outref;
 is ((exec_as 0, "(env LC_MESSAGES=C pg_upgradecluster -v $MAJORS[-1] $upgrade_options $MAJORS[0] upgr | sed -e 's/^/STDOUT: /')", $outref, 0), 0, 'pg_upgradecluster succeeds');
+note $$outref;
 like $$outref, qr/Starting upgraded cluster/, 'pg_upgradecluster reported cluster startup';
+like $$outref, qr/Running finish phase upgrade hook scripts/, 'pg_upgradecluster reported running upgrade hook scripts';
 like $$outref, qr/Success. Please check/, 'pg_upgradecluster reported successful operation';
 my @err = grep (!/^STDOUT: /, split (/\n/, $$outref));
 if (@err) {
@@ -190,8 +194,10 @@
     "1\n", 'SELECT output is the same in original and upgraded testro';
 
 # Check that table was analyzed
-like_program_out 'nobody', "psql -XAtc \"select analyze_count from pg_stat_user_tables where relname = 'phone'\" test", 0, qr/^[1-3]$/,
-    'check analyze count'; # --analyze-in-stages does 3 passes
+like_program_out 'nobody', "psql -XAtc \"select most_common_vals from pg_stats where tablename = 'phone' and attname = 'tel'\" test", 0, qr/\{222\}/,
+    'phone table has optimizer stats';
+like_program_out 'nobody', "psql -XAtc \"select n_live_tup from pg_stat_user_tables where relname = 'phone'\" test", 0, qr/3/,
+    'phone table has row stats';
 
 # Check sequence value
 is_program_out 'nobody', 'psql -Atc "SELECT nextval(\'odd10\')" test', 0, "5\n",
@@ -231,7 +237,7 @@
 # check ACLs
 is_program_out 'nobody', 'psql -U foo -qc "CREATE SCHEMA s_bar" test', 0, '',
     'CREATE SCHEMA on new cluster (ACL)';
-is_program_out 'nobody', 'psql -U foo -qc "INSERT INTO phone VALUES (\'Chris\', 5)" test', 
+is_program_out 'nobody', 'psql -U foo -qc "INSERT INTO phone VALUES (\'Chris\', 555)" test',
     0, '', 'insert Chris into phone table (ACL)';
 
 # check default transaction r/o

Reply via email to