pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Etsuro Fujita <efujita@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: postgres_fdw: Fix assertion in estimate_path_cost_size().
Date: Thu, 15 Dec 2022 12:21:25 +0000
Message-ID: <E1p5nEq-003hvp-RG@gemulon.postgresql.org> (raw)

postgres_fdw: Fix assertion in estimate_path_cost_size().

Commit 08d2d58a2 added this assertion assuming that the retrieved_rows
estimate for a foreign relation is set to at least one row in
estimate_path_cost_size(), but the assumption isn't correct because if
the relation is a foreign table with tuples=0, the estimate would be set
to 0 in there when using local stats, and if the query's WHERE clause
has a NULL condition, the estimate could be set to 0 in there when using
remote estimates.  (Note: even in the latter case the assertion could be
reachable when costing foreign final paths.)  Repair.

Per bug #17713 from Robins Tharakan.  This patch was already applied to
v13 or later; apply it to v12 as well where the aforementioned commit
was added.  Thanks to Richard Guo for investigation.

Discussion: http://postgr.es/m/17713-92cce66de7e81c04%40postgresql.org
Discussion: http://postgr.es/m/CAEP4nAza%2B0fTCLkgkKYux3JDo3tUBTQORehP%2BaCxSNURpSFpHw%40mail.gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/69f75bf825f83dc506e73cf88f0adde541c39004

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 18 ++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c            |  2 +-
contrib/postgres_fdw/sql/postgres_fdw.sql      | 12 ++++++++++++
3 files changed, 31 insertions(+), 1 deletion(-)



view thread (5+ messages)

Message-ID: <E1p5nEq-003hvp-RG@gemulon.postgresql.org>
Permalink:  ../E1p5nEq-003hvp-RG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p5nEq-003hvp-RG@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: efujita@postgresql.org
  Subject: Re: pgsql: postgres_fdw: Fix assertion in estimate_path_cost_size().
  In-Reply-To: <E1p5nEq-003hvp-RG@gemulon.postgresql.org>
  References: <E1p5nEq-003hvp-RG@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