Re: postgres_fdw can crash on malformed remote results

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Subject: Re: postgres_fdw can crash on malformed remote results
Date: 2026-12-02 03:29:45
Message-ID: CAHGQGwGbtzzv39WgPF5O20Lj9OUSrSws1axfgoSPAWob0BwM_Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 2, 2026 at 4:10 AM Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
> It's a trivial and lightweight fix, with cited precedent for making the same change, applies clean and passes tests.

+1

+ if (PQntuples(res) < 1 || PQnfields(res) < 1)
+ elog(ERROR, "unexpected result from remote EXPLAIN command");

Since EXPLAIN always returns one column, isn't it better to use
"PQnfields(res) != 1", consistent with the "PQnfields(res) != 8" check
for IMPORT FOREIGN SCHEMA?

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajin Cherian 2026-12-02 03:42:09 Re: Exported snapshot of CREATE_REPLICATION_SLOT can lose tuples to pruning
Previous Message Zhijie Hou 2026-12-02 03:08:49 Re: Fix race between copying and dropping a replication slot