Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uX31p-005173-Jz for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Jul 2025 19:21:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uX31n-005dAp-64 for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Jul 2025 19:21:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uX31m-005dAg-Tc for pgsql-bugs@lists.postgresql.org; Wed, 02 Jul 2025 19:21:55 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uX31l-005MU5-0u for pgsql-bugs@lists.postgresql.org; Wed, 02 Jul 2025 19:21:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 562JLoQR3543069; Wed, 2 Jul 2025 15:21:50 -0400 From: Tom Lane To: Sergei Kornilov cc: Maxim Boguk , 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: <5088921751442291@mail-sendbernar-production-main-45.klg.yp-c.yandex.net> References: <18974-575f02b2168b36b3@postgresql.org> <5088921751442291@mail-sendbernar-production-main-45.klg.yp-c.yandex.net> Comments: In-reply-to Sergei Kornilov message dated "Wed, 02 Jul 2025 10:44:51 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3543067.1751484110.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Jul 2025 15:21:50 -0400 Message-ID: <3543068.1751484110@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Sergei Kornilov 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 =3D conn->connhost[conn->whichhost]; > + cancelConn->connhost[0].type =3D originalHost.type; > if (originalHost.host) > { > cancelConn->connhost[0].host =3D 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_fd= w; DO $d$ BEGIN EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fd= w - 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_f= dw I'll see to fixing this. regards, tom lane