0002-postgres_fdw-Avoid-listing-all-libpq-connection-opti.patch

text/plain

Filename: 0002-postgres_fdw-Avoid-listing-all-libpq-connection-opti.patch
Type: text/plain
Part: 1
Message: postgres_fdw hint messages

Patch

Format: format-patch
Series: patch 0002
Subject: postgres_fdw: Avoid listing all libpq connection options in error hint
File+
contrib/postgres_fdw/expected/postgres_fdw.out 6 1
contrib/postgres_fdw/sql/postgres_fdw.sql 6 0
From 986ea253cd887b472e8040580f8c1a2642f3cada Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Thu, 25 Aug 2022 15:31:11 +0200
Subject: [PATCH 2/2] postgres_fdw: Avoid listing all libpq connection options
 in error hint

---
 contrib/postgres_fdw/expected/postgres_fdw.out | 7 ++++++-
 contrib/postgres_fdw/sql/postgres_fdw.sql      | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out
index a42c9720c3..3678428b95 100644
--- a/contrib/postgres_fdw/expected/postgres_fdw.out
+++ b/contrib/postgres_fdw/expected/postgres_fdw.out
@@ -9621,9 +9621,14 @@ ERROR:  password is required
 DETAIL:  Non-superusers must provide a password in the user mapping.
 -- If we add a password to the connstr it'll fail, because we don't allow passwords
 -- in connstrs only in user mappings.
+--
+-- Set to terse verbosity to avoid hint listing all possible libpq
+-- connection options, which causes annoying test failures when doing
+-- libpq work.
+\set VERBOSITY terse
 ALTER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
 ERROR:  invalid option "password"
-HINT:  Valid options in this context are: service, passfile, channel_binding, connect_timeout, dbname, host, hostaddr, port, options, application_name, keepalives, keepalives_idle, keepalives_interval, keepalives_count, tcp_user_timeout, sslmode, sslcompression, sslcert, sslkey, sslrootcert, sslcrl, sslcrldir, sslsni, requirepeer, ssl_min_protocol_version, ssl_max_protocol_version, gssencmode, krbsrvname, gsslib, target_session_attrs, use_remote_estimate, fdw_startup_cost, fdw_tuple_cost, extensions, updatable, truncatable, fetch_size, batch_size, async_capable, parallel_commit, keep_connections
+\set VERBOSITY default
 -- If we add a password for our user mapping instead, we should get a different
 -- error because the password wasn't actually *used* when we run with trust auth.
 --
diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql
index 63581a457d..a8b65cdc88 100644
--- a/contrib/postgres_fdw/sql/postgres_fdw.sql
+++ b/contrib/postgres_fdw/sql/postgres_fdw.sql
@@ -2885,8 +2885,14 @@ CREATE FOREIGN TABLE pg_temp.ft1_nopw (
 
 -- If we add a password to the connstr it'll fail, because we don't allow passwords
 -- in connstrs only in user mappings.
+--
+-- Set to terse verbosity to avoid hint listing all possible libpq
+-- connection options, which causes annoying test failures when doing
+-- libpq work.
 
+\set VERBOSITY terse
 ALTER SERVER loopback_nopw OPTIONS (ADD password 'dummypw');
+\set VERBOSITY default
 
 -- If we add a password for our user mapping instead, we should get a different
 -- error because the password wasn't actually *used* when we run with trust auth.
-- 
2.37.1