From f0014cf0df539ca6dc372b3a4f93ef300a356469 Mon Sep 17 00:00:00 2001 From: Naisila Puka <37271756+naisila@users.noreply.github.com> Date: Thu, 9 Oct 2025 16:50:41 +0300 Subject: [PATCH] PG18 compatibility: misc output diffs pt2 (#8234) 3 minor changes to reduce some noise from the regression diffs. 1 - Reduce verbosity when ALTER EXTENSION fails PG18 has improved reporting of errors in extension script files Relevant PG commit: https://github.com/postgres/postgres/commit/774171c4f There was more context in PG18, so reducing verbosity ``` ALTER EXTENSION citus UPDATE TO '11.0-1'; ERROR: cstore_fdw tables are deprecated as of Citus 11.0 HINT: Install Citus 10.2 and convert your cstore_fdw tables to the columnar access method before upgrading further CONTEXT: PL/pgSQL function inline_code_block line 4 at RAISE +SQL statement "DO LANGUAGE plpgsql +$$ +BEGIN + IF EXISTS (SELECT 1 FROM pg_dist_shard where shardstorage = 'c') THEN + RAISE EXCEPTION 'cstore_fdw tables are deprecated as of Citus 11.0' + USING HINT = 'Install Citus 10.2 and convert your cstore_fdw tables to the columnar access method before upgrading further'; + END IF; +END; +$$" +extension script file "citus--10.2-5--11.0-1.sql", near line 532 ``` 2 - Fix backend type order in tests for PG18 PG18 added another backend type which messed the order in this test Adding a separate IF condition for PG18 Relevant PG commit: https://github.com/postgres/postgres/commit/18d67a8d7d 3 - Ignore "DEBUG: find_in_path" lines in output Relevant PG commit: https://github.com/postgres/postgres/commit/4f7f7b0375 The new GUC extension_control_path specifies a path to look for extension control files. --- src/test/regress/bin/normalize.sed | 4 ++++ src/test/regress/expected/multi_extension.out | 11 ++++++----- .../regress/expected/multi_mx_hide_shard_names.out | 11 +++++++++-- src/test/regress/sql/multi_extension.sql | 6 ++++++ src/test/regress/sql/multi_mx_hide_shard_names.sql | 11 +++++++++-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/test/regress/bin/normalize.sed b/src/test/regress/bin/normalize.sed index 6df3087cb..1ebf4392e 100644 --- a/src/test/regress/bin/normalize.sed +++ b/src/test/regress/bin/normalize.sed @@ -365,3 +365,7 @@ s/^([ \t]*)List of sequences$/\1List of relations/g s/violates RESTRICT setting of foreign key constraint/violates foreign key constraint/g # DETAIL line changed "is referenced" -> old "is still referenced" s/\/is still referenced from table/g + +# pg18 extension_control_path GUC debugs +# ignore any "find_in_path:" lines in test output +/DEBUG: find_in_path: trying .*/d diff --git a/src/test/regress/expected/multi_extension.out b/src/test/regress/expected/multi_extension.out index d3ed19f21..ce6a053ff 100644 --- a/src/test/regress/expected/multi_extension.out +++ b/src/test/regress/expected/multi_extension.out @@ -1120,10 +1120,11 @@ DROP TABLE columnar_schema_members, columnar_schema_members_pg_depend; -- Use a synthetic pg_dist_shard record to show that upgrade fails -- when there are cstore_fdw tables INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage) VALUES ('pg_dist_shard', 1, 'c'); +-- reduce verbosity since there is more context in PG18 (774171c4f) +\set VERBOSITY terse ALTER EXTENSION citus UPDATE TO '11.0-1'; ERROR: cstore_fdw tables are deprecated as of Citus 11.0 -HINT: Install Citus 10.2 and convert your cstore_fdw tables to the columnar access method before upgrading further -CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE +\set VERBOSITY default DELETE FROM pg_dist_shard WHERE shardid = 1; -- partitioned table count is tracked on Citus 11 upgrade CREATE TABLE e_transactions(order_id varchar(255) NULL, transaction_id int) PARTITION BY LIST(transaction_id); @@ -1510,11 +1511,11 @@ SELECT create_distributed_table('null_shard_key', null); -- Show that we cannot downgrade to 11.3-2 becuase the cluster has a -- distributed table with single-shard. +-- reduce verbosity since there is more context in PG18 (774171c4f) +\set VERBOSITY terse ALTER EXTENSION citus UPDATE TO '11.3-2'; ERROR: cannot downgrade Citus because there are distributed tables without a shard key. -DETAIL: To downgrade Citus to an older version, you should first convert those tables to Postgres tables by executing SELECT undistribute_table("%s"). -HINT: You can find the distributed tables without a shard key in the cluster by using the following query: "SELECT * FROM citus_tables WHERE distribution_column = '' AND colocation_id > 0". -CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE +\set VERBOSITY default DROP TABLE null_shard_key; ALTER EXTENSION citus UPDATE TO '11.3-2'; -- Should be empty result since upgrade+downgrade should be a no-op diff --git a/src/test/regress/expected/multi_mx_hide_shard_names.out b/src/test/regress/expected/multi_mx_hide_shard_names.out index 1f6e06ab1..bcc77db8f 100644 --- a/src/test/regress/expected/multi_mx_hide_shard_names.out +++ b/src/test/regress/expected/multi_mx_hide_shard_names.out @@ -476,11 +476,18 @@ SELECT relname FROM pg_catalog.pg_class WHERE relnamespace = 'mx_hide_shard_name -- Relevant PG16 commit: -- https://github.com/postgres/postgres/commit/0c679464a837079acc75ff1d45eaa83f79e05690 -- Relevant Pg17 commit: --- https://github.com/postgres/postgres/commit/067701f57758f9baed5bd9d868539738d77bfa92#diff-afc0ebd67534b71b5b94b29a1387aa6eedffe342a5539f52d686428be323e802 +-- https://github.com/postgres/postgres/commit/067701f57758f9baed5bd9d868539738d77bfa92 +-- Relevant PG18 commit: +-- https://github.com/postgres/postgres/commit/18d67a8d7d30884655d65910b82781d9360819a6 SHOW server_version \gset +SELECT substring(:'server_version', '\d+')::int >= 18 AS server_version_ge_18 \gset SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17 \gset SELECT substring(:'server_version', '\d+')::int >= 16 AS server_version_ge_16 \gset -\if :server_version_ge_17 +\if :server_version_ge_18 + SELECT 1 AS client_backend \gset + SELECT 5 AS bgworker \gset + SELECT 6 AS walsender \gset +\elif :server_version_ge_17 SELECT 1 AS client_backend \gset SELECT 4 AS bgworker \gset SELECT 5 AS walsender \gset diff --git a/src/test/regress/sql/multi_extension.sql b/src/test/regress/sql/multi_extension.sql index 0a82075c3..b7d69255b 100644 --- a/src/test/regress/sql/multi_extension.sql +++ b/src/test/regress/sql/multi_extension.sql @@ -534,7 +534,10 @@ DROP TABLE columnar_schema_members, columnar_schema_members_pg_depend; -- Use a synthetic pg_dist_shard record to show that upgrade fails -- when there are cstore_fdw tables INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage) VALUES ('pg_dist_shard', 1, 'c'); +-- reduce verbosity since there is more context in PG18 (774171c4f) +\set VERBOSITY terse ALTER EXTENSION citus UPDATE TO '11.0-1'; +\set VERBOSITY default DELETE FROM pg_dist_shard WHERE shardid = 1; -- partitioned table count is tracked on Citus 11 upgrade @@ -699,7 +702,10 @@ SELECT create_distributed_table('null_shard_key', null); -- Show that we cannot downgrade to 11.3-2 becuase the cluster has a -- distributed table with single-shard. +-- reduce verbosity since there is more context in PG18 (774171c4f) +\set VERBOSITY terse ALTER EXTENSION citus UPDATE TO '11.3-2'; +\set VERBOSITY default DROP TABLE null_shard_key; diff --git a/src/test/regress/sql/multi_mx_hide_shard_names.sql b/src/test/regress/sql/multi_mx_hide_shard_names.sql index 70f87a875..c275f3b0b 100644 --- a/src/test/regress/sql/multi_mx_hide_shard_names.sql +++ b/src/test/regress/sql/multi_mx_hide_shard_names.sql @@ -249,11 +249,18 @@ SELECT relname FROM pg_catalog.pg_class WHERE relnamespace = 'mx_hide_shard_name -- Relevant PG16 commit: -- https://github.com/postgres/postgres/commit/0c679464a837079acc75ff1d45eaa83f79e05690 -- Relevant Pg17 commit: --- https://github.com/postgres/postgres/commit/067701f57758f9baed5bd9d868539738d77bfa92#diff-afc0ebd67534b71b5b94b29a1387aa6eedffe342a5539f52d686428be323e802 +-- https://github.com/postgres/postgres/commit/067701f57758f9baed5bd9d868539738d77bfa92 +-- Relevant PG18 commit: +-- https://github.com/postgres/postgres/commit/18d67a8d7d30884655d65910b82781d9360819a6 SHOW server_version \gset +SELECT substring(:'server_version', '\d+')::int >= 18 AS server_version_ge_18 \gset SELECT substring(:'server_version', '\d+')::int >= 17 AS server_version_ge_17 \gset SELECT substring(:'server_version', '\d+')::int >= 16 AS server_version_ge_16 \gset -\if :server_version_ge_17 +\if :server_version_ge_18 + SELECT 1 AS client_backend \gset + SELECT 5 AS bgworker \gset + SELECT 6 AS walsender \gset +\elif :server_version_ge_17 SELECT 1 AS client_backend \gset SELECT 4 AS bgworker \gset SELECT 5 AS walsender \gset