pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sergei Kornilov <sk@zsrv.org>
Cc: Maxim Boguk <maxim.boguk@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries
Date: Wed, 02 Jul 2025 15:21:50 -0400
Message-ID: <3543068.1751484110@sss.pgh.pa.us> (raw)
In-Reply-To: <5088921751442291@mail-sendbernar-production-main-45.klg.yp-c.yandex.net>
References: <18974-575f02b2168b36b3@postgresql.org>
	<CAK-MWwT683+wrt+twkRMLedMN_6y7Lj4k7CXr7sSHCV_GO5iLA@mail.gmail.com>
	<CAK-MWwRyND1W1-t=EaLmpgkXYCr8G7qtinqHpTv_GK6t+Ykj+A@mail.gmail.com>
	<CAK-MWwT0_riUDmr1DGJFv1WrEmR9EUYa=w1+1hOZAX47uiuK=A@mail.gmail.com>
	<5088921751442291@mail-sendbernar-production-main-45.klg.yp-c.yandex.net>

Sergei Kornilov <sk@zsrv.org> writes:
> Yeah, I think there is a missing copy of the type field:

> --- a/src/interfaces/libpq/fe-cancel.c
> +++ b/src/interfaces/libpq/fe-cancel.c
> @@ -119,6 +119,7 @@ PQcancelCreate(PGconn *conn)
>          goto oom_error;
 
>      originalHost = conn->connhost[conn->whichhost];
> +    cancelConn->connhost[0].type = originalHost.type;
>      if (originalHost.host)
>      {
>          cancelConn->connhost[0].host = strdup(originalHost.host);

> Other fields of the pg_conn_host structure are copied below in the code, excepts type.

Good catch!

For the archives: it's easy to reproduce this crash by modifying
the postgres_fdw regression tests, along the lines of

diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql
index e534b40de3c..883dc669deb 100644
--- a/contrib/postgres_fdw/sql/postgres_fdw.sql
+++ b/contrib/postgres_fdw/sql/postgres_fdw.sql
@@ -8,7 +8,7 @@ CREATE SERVER testserver1 FOREIGN DATA WRAPPER postgres_fdw;
 DO $d$
     BEGIN
         EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
-            OPTIONS (dbname '$$||current_database()||$$',
+            OPTIONS (hostaddr '127.0.0.1', dbname '$$||current_database()||$$',
                      port '$$||current_setting('port')||$$'
             )$$;
         EXECUTE $$CREATE SERVER loopback2 FOREIGN DATA WRAPPER postgres_fdw

I'll see to fixing this.

			regards, tom lane





view thread (6+ messages)

Message-ID: <3543068.1751484110@sss.pgh.pa.us>
Permalink:  ../3543068.1751484110@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3543068.1751484110@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sk@zsrv.org, maxim.boguk@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries
  In-Reply-To: <3543068.1751484110@sss.pgh.pa.us>

* 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