pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Gustafsson <daniel@yesql.se>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove support for SSL compression
Date: Tue, 9 Mar 2021 16:11:17 +0100
Message-ID: <0ABE2652-9850-43D4-A7A3-57C8F6834038@yesql.se> (raw)
In-Reply-To: <YEdZ2PKDA8ZuDB8L@paquier.xyz>
References: <E1lJRxU-00051U-47@gemulon.postgresql.org>
	<YEbq15JKJwIX+S6m@paquier.xyz>
	<YEdZ2PKDA8ZuDB8L@paquier.xyz>

> On 9 Mar 2021, at 12:19, Michael Paquier <michael@paquier.xyz> wrote:
> 
> On Tue, Mar 09, 2021 at 12:26:15PM +0900, Michael Paquier wrote:
>> It looks like it is not that much a good idea to define it as a debug
>> option after all.  So I guess that the attached would fix the failure,
>> where FDW servers can still pass down the parameter at will for
>> backward-compatibility, and where libpq keeps ignoring its value.  Any
>> thoughts?
> 
> So, I have been thinking more about this one, and applied the previous
> patch to bring back crake to green.  There are a couple of options
> that could be considered to make the option non-visible, but nothing
> looks really appealing to me:
> - Tweak the regression tests on the back-branches to bypass the
> failure, but this won't change the potential impact of anybody using
> sslcompression in a FDW server, or even dblink.
> - Create specific exceptions in postgres_fdw and perhaps dblink.
> - Extend libpq with a special status to mark a parameter as
> to-be-removed, but that feels like a mix of a normal option and a
> debug option.
> - Make pg_upgrade complain if such a server is detected (?), bringing
> in the ring the first point of this list.

Having tried a number of different ways to fix this I think the least intrusive
fix is to teach pg_upgrade and dblink about sslcompression, like how've already
taught it about other options.  Building any infrastructure to handle
deprecated options and extending the dispchar with a classification for
deprecation for just this one option seems overkill.  Deprecating options is
also not something frequently done, so the cost/benefit for something
complicated seems off.

The attached is a version of the simple fix.

--
Daniel Gustafsson		https://vmware.com/

Attachments:

v1-0001-Fix-sslcompression-in-postgres_fdw-and-dblink.patch (application/octet-stream, 5.5K) download From f13390a1922266906e949510b93a979bb1575b0f Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson <daniel@yesql.se> Date: Tue, 9 Mar 2021 15:40:13 +0100 Subject: [PATCH v1] Fix sslcompression in postgres_fdw and dblink Commit f9264d1524ba deprecated sslcompression leaving the libpq option as a debug option to preserve backwards compatibility by silently eating it when passed in. postgres_fdw and dblink does however skip over debug options when validating the set of options and would thus fail with an invalid option. This teaches postgres_fdw and dblink to treat the option in the same way to avoid upgrades breaking. This reverts commit 096bbf7c934a4288c9 which was a temporary fix of the test failure in f9264d1524ba. Discussion: https://postgr.es/m/7E384D48-11C5-441B-9EC3-F7DB1F8518F6@yesql.se Discussion: https://postgr.es/m/E1lJRxU-00051U-47@gemulon.postgresql.org --- contrib/dblink/dblink.c | 13 ++++++++++--- contrib/postgres_fdw/expected/postgres_fdw.out | 3 +-- contrib/postgres_fdw/option.c | 13 ++++++++++--- contrib/postgres_fdw/sql/postgres_fdw.sql | 1 - src/interfaces/libpq/fe-connect.c | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 3a0beaa88e..d589886aa2 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -2035,14 +2035,21 @@ dblink_fdw_validator(PG_FUNCTION_ARGS) if (!is_valid_dblink_option(options, def->defname, context)) { + StringInfoData buf; + const PQconninfoOption *opt; + + /* + * sslcompression is deprecated and should be silently ignored to + * preserve backwards compatibility. + */ + if (strcmp(def->defname, "sslcompression") == 0) + continue; + /* * Unknown option, or invalid option for the context specified, so * complain about it. Provide a hint with list of valid options * for the context. */ - StringInfoData buf; - const PQconninfoOption *opt; - initStringInfo(&buf); for (opt = options; opt->keyword; opt++) { diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out index f17f3b6c29..c2565dfc70 100644 --- a/contrib/postgres_fdw/expected/postgres_fdw.out +++ b/contrib/postgres_fdw/expected/postgres_fdw.out @@ -167,7 +167,6 @@ ALTER SERVER testserver1 OPTIONS ( sslcert 'value', sslkey 'value', sslrootcert 'value', - sslcompression 'value', sslcrl 'value', --requirepeer 'value', krbsrvname 'value', @@ -8946,7 +8945,7 @@ DO $d$ END; $d$; 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, 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, fetch_size, batch_size +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, sslcert, sslkey, sslrootcert, sslcrl, sslcrldir, 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, fetch_size, batch_size CONTEXT: SQL statement "ALTER SERVER loopback_nopw OPTIONS (ADD password 'dummypw')" PL/pgSQL function inline_code_block line 3 at EXECUTE -- If we add a password for our user mapping instead, we should get a different diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c index 64698c4da3..6fb0288018 100644 --- a/contrib/postgres_fdw/option.c +++ b/contrib/postgres_fdw/option.c @@ -81,13 +81,20 @@ postgres_fdw_validator(PG_FUNCTION_ARGS) if (!is_valid_option(def->defname, catalog)) { + PgFdwOption *opt; + StringInfoData buf; + + /* + * sslcompression is deprecated and should be silently ignored to + * preserve backwards compatibility. + */ + if (strcmp(def->defname, "sslcompression") == 0) + continue; + /* * Unknown option specified, complain about it. Provide a hint * with list of valid options for the object. */ - PgFdwOption *opt; - StringInfoData buf; - initStringInfo(&buf); for (opt = postgres_fdw_options; opt->keyword; opt++) { diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql index be5618f759..a143a70406 100644 --- a/contrib/postgres_fdw/sql/postgres_fdw.sql +++ b/contrib/postgres_fdw/sql/postgres_fdw.sql @@ -181,7 +181,6 @@ ALTER SERVER testserver1 OPTIONS ( sslcert 'value', sslkey 'value', sslrootcert 'value', - sslcompression 'value', sslcrl 'value', --requirepeer 'value', krbsrvname 'value', diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index aeb64c5bca..318c45ec19 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -280,7 +280,7 @@ static const internalPQconninfoOption PQconninfoOptions[] = { * compatibility. */ {"sslcompression", NULL, NULL, NULL, - "SSL-Compression", "", 1, -1}, + "SSL-Compression", "D", 1, -1}, {"sslcert", "PGSSLCERT", NULL, NULL, "SSL-Client-Cert", "", 64, -- 2.21.1 (Apple Git-122.3) =

view thread (11+ messages)  latest in thread

Message-ID: <0ABE2652-9850-43D4-A7A3-57C8F6834038@yesql.se>
Permalink:  ../0ABE2652-9850-43D4-A7A3-57C8F6834038@yesql.se/
Also on:    postgresql.org/message-id/0ABE2652-9850-43D4-A7A3-57C8F6834038@yesql.se

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: daniel@yesql.se, michael@paquier.xyz
  Subject: Re: pgsql: Remove support for SSL compression
  In-Reply-To: <0ABE2652-9850-43D4-A7A3-57C8F6834038@yesql.se>
  References: <E1lJRxU-00051U-47@gemulon.postgresql.org> <YEbq15JKJwIX+S6m@paquier.xyz> <YEdZ2PKDA8ZuDB8L@paquier.xyz> <0ABE2652-9850-43D4-A7A3-57C8F6834038@yesql.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox