Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table - Mailing list pgsql-bugs

From Kyotaro Horiguchi
Subject Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table
Date
Msg-id 20210114.133024.160907178608761711.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table  (Etsuro Fujita <etsuro.fujita@gmail.com>)
Responses Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table
List pgsql-bugs
At Thu, 14 Jan 2021 11:56:08 +0900, Etsuro Fujita <etsuro.fujita@gmail.com> wrote in 
> On Wed, Jan 6, 2021 at 12:15 PM Etsuro Fujita <etsuro.fujita@gmail.com> wrote:
> > Reproduced.  Will look into this closely.
> 
> If foreignrel->tuples is set to zero, the retrieved_rows estimate will
> also be set to zero, so the assertion pointed out upthread is not
> correct.  I think I mistakenly assumed that foreignrel->tuples would
> have been forced to be at least one row, like foreignrel->rows, before
> we get to estimate_path_cost_size(), which is not correct.
> 
> To fix, I think it would be better to adjust the assertion accordingly
> than removing it, since it was added to make sure that the
> retrieved_rows estimate is set to a sensible value.  Attached is a
> patch for that.  I added a simpler test case as well.

FWIW I drew the same conclusion.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-bugs by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table
Next
From: Tim Kelly
Date:
Subject: questions about porting postgresql to older operating system