Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sergei Kornilov <sk(at)zsrv(dot)org>
Cc: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18974: Postgresql repeatable crash after pg_upgrade from 15 to 17.5 version in postgresql_fdw queries
Date: 2025-07-02 19:21:50
Message-ID: 3543068.1751484110@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Sergei Kornilov <sk(at)zsrv(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2025-07-03 03:03:05 BUG #18976: -0.0 with float8 will be transformed to 0 in prepare statement but not in normal execution
Previous Message Laurenz Albe 2025-07-02 13:49:50 Re: BUG #18975: PostgreSQL server doesn't process SQL request correctly over Windows replica of Linux server