aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
authorEtsuro Fujita <efujita@postgresql.org>2021-02-05 15:30:00 +0900
committerEtsuro Fujita <efujita@postgresql.org>2021-02-05 15:30:00 +0900
commit5e7fa189ee92d5ecf42a295c336625d71bfe876d (patch)
tree10ad11babfbb7d16e4e93ad1c846428ebbb5b887 /contrib/postgres_fdw/postgres_fdw.c
parent0ff865fbe50e82f17df8a9280fa01faf270b7f3f (diff)
downloadpostgresql-5e7fa189ee92d5ecf42a295c336625d71bfe876d.tar.gz
postgresql-5e7fa189ee92d5ecf42a295c336625d71bfe876d.zip
postgres_fdw: Fix assertion in estimate_path_cost_size().
Commit 08d2d58a2 added an assertion assuming that the retrieved_rows estimate for a foreign relation, which is re-used to cost pre-sorted foreign paths with local stats, is set to at least one row in estimate_path_cost_size(), which isn't correct because if the relation is a foreign table with tuples=0, the estimate would be set to 0 there when not using remote estimates. Per bug #16807 from Alexander Lakhin. Back-patch to v13 where the aforementioned commit went in. Author: Etsuro Fujita Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/16807-9fe4e08fbaa5c7ce%40postgresql.org
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 2ce42ce3f11..0e977066a8f 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -2923,7 +2923,7 @@ estimate_path_cost_size(PlannerInfo *root,
*/
if (fpinfo->rel_startup_cost >= 0 && fpinfo->rel_total_cost >= 0)
{
- Assert(fpinfo->retrieved_rows >= 1);
+ Assert(fpinfo->retrieved_rows >= 0);
rows = fpinfo->rows;
retrieved_rows = fpinfo->retrieved_rows;