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.
pull/8239/head
Naisila Puka 2025-10-09 16:50:41 +03:00 committed by GitHub
parent d9652bf5f9
commit f0014cf0df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 9 deletions

View File

@ -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 referenced from table\>/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

View File

@ -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 = '<none>' 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

View File

@ -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

View File

@ -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;

View File

@ -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