pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix crash in postgres_fdw for provably-empty remote UPDATE/DELET
Date: Wed, 07 Jul 2021 19:21:34 +0000
Message-ID: <E1m1D70-0008FD-DM@gemulon.postgresql.org> (raw)

Fix crash in postgres_fdw for provably-empty remote UPDATE/DELETE.

In 86dc90056, I'd written find_modifytable_subplan with the assumption
that if the immediate child of a ModifyTable is a Result, it must be
a projecting Result with a subplan.  However, if the UPDATE or DELETE
has a provably-constant-false WHERE clause, that's not so: we'll
generate a dummy subplan with a childless Result.  Add the missing
null-check so we don't crash on such cases.

Per report from Alexander Pyhalov.

Discussion: https://postgr.es/m/b9a6f53549456b2f3e2fd150dcd79d72@postgrespro.ru

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/30a35bca3f9306f87ca8db095ddac2ba62156934

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 20 ++++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c            |  4 +++-
contrib/postgres_fdw/sql/postgres_fdw.sql      |  4 ++++
3 files changed, 27 insertions(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1m1D70-0008FD-DM@gemulon.postgresql.org>
Permalink:  ../E1m1D70-0008FD-DM@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m1D70-0008FD-DM@gemulon.postgresql.org

 · 

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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix crash in postgres_fdw for provably-empty remote UPDATE/DELET
  In-Reply-To: <E1m1D70-0008FD-DM@gemulon.postgresql.org>
  References: <E1m1D70-0008FD-DM@gemulon.postgresql.org>

* 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