Skip to content

Commit 3e61107

Browse files
committed
Fixes for the new testgres 1.11.0
A new testgres framework was released that makes `PostgresNode::port` read-only. Fixed it by properly set the port when initializing a new node. References: https://github.com/postgrespro/testgres/releases/tag/1.11.0 postgrespro/testgres#234
1 parent f476b7a commit 3e61107

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

scripts/test_pg_upgrade.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def initialize_node(working_dir, prefix, port, bin_dir, base_dir):
4747
pg_node_old = f"pg{pg_version_old}"
4848
pg_node_new = f"pg{pg_version_new}"
4949

50-
pg_port_old = getenv_or_default("PGPORTOLD", "54321")
51-
pg_port_new = getenv_or_default("PGPORTNEW", "54322")
50+
pg_port_old = int(getenv_or_default("PGPORTOLD", "54321"))
51+
pg_port_new = int(getenv_or_default("PGPORTNEW", "54322"))
5252

5353
test_version = getenv_or_default("TEST_VERSION", "v8")
5454

@@ -94,12 +94,10 @@ def initialize_node(working_dir, prefix, port, bin_dir, base_dir):
9494
node_old.safe_psql(dbname=pg_database_test, query="CHECKPOINT")
9595
node_old.safe_psql(dbname=pg_database_test, filename="test/sql/updates/setup.check.sql")
9696

97-
# Run new psql over the old node to have the same psql output
98-
node_new.port = pg_port_old
99-
(code, old_out, old_err) = node_new.psql(
97+
# Run over the old node to check the output
98+
(code, old_out, old_err) = node_old.psql(
10099
dbname=pg_database_test, filename="test/sql/updates/post.pg_upgrade.sql"
101100
)
102-
node_new.port = pg_port_new
103101

104102
# Save output to log
105103
write_bytes_to_file(f"{working_dir}/post.{pg_node_old}.log", old_out)

test/sql/updates/post.catalog.sql

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,43 @@ ORDER BY schema, name, initpriv;
3030

3131
\di _timescaledb_catalog.*
3232
\ds+ _timescaledb_catalog.*
33-
\df _timescaledb_internal.*
34-
\df+ _timescaledb_internal.*
35-
\df public.*;
36-
\df+ public.*;
33+
34+
-- Functions in schemas:
35+
-- * _timescaledb_internal
36+
-- * _timescaledb_functions
37+
-- * public
38+
SELECT n.nspname as "Schema",
39+
p.proname as "Name",
40+
pg_catalog.pg_get_function_result(p.oid) as "Result data type",
41+
pg_catalog.pg_get_function_arguments(p.oid) as "Argument data types",
42+
CASE p.prokind
43+
WHEN 'a' THEN 'agg'
44+
WHEN 'w' THEN 'window'
45+
WHEN 'p' THEN 'proc'
46+
ELSE 'func'
47+
END as "Type",
48+
CASE
49+
WHEN p.provolatile = 'i' THEN 'immutable'
50+
WHEN p.provolatile = 's' THEN 'stable'
51+
WHEN p.provolatile = 'v' THEN 'volatile'
52+
END as "Volatility",
53+
CASE
54+
WHEN p.proparallel = 'r' THEN 'restricted'
55+
WHEN p.proparallel = 's' THEN 'safe'
56+
WHEN p.proparallel = 'u' THEN 'unsafe'
57+
END as "Parallel",
58+
pg_catalog.pg_get_userbyid(p.proowner) as "Owner",
59+
CASE WHEN prosecdef THEN 'definer' ELSE 'invoker' END AS "Security",
60+
CASE WHEN pg_catalog.array_length(p.proacl, 1) = 0 THEN '(none)' ELSE pg_catalog.array_to_string(p.proacl, E'\n') END AS "Access privileges",
61+
l.lanname as "Language",
62+
p.prosrc as "Source code",
63+
CASE WHEN l.lanname IN ('internal', 'c') THEN p.prosrc END as "Internal name",
64+
pg_catalog.obj_description(p.oid, 'pg_proc') as "Description"
65+
FROM pg_catalog.pg_proc p
66+
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
67+
LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang
68+
WHERE n.nspname OPERATOR(pg_catalog.~) '^(_timescaledb_internal|_timescaledb_functions|public)$' COLLATE pg_catalog.default
69+
ORDER BY 1, 2, 4;
3770

3871
\dy
3972
\d public.*

0 commit comments

Comments
 (0)