Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16807: Assert failed in postgres_fdw/estimate_path_cost_size with an empty foreign table
Date: 2021-02-04 09:56:22
Message-ID: CAPmGK141OhAhUQu9MyvFWDGuWJUMTbDZGO0N-hLEFJsF7ZQ17A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Jan 14, 2021 at 1:30 PM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
> At Thu, 14 Jan 2021 11:56:08 +0900, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com> wrote in
> > 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.

Ok, thanks for reviewing!

I tweaked a regression test comment a little bit and added the commit
message. Attached is an updated patch. I’ll commit the patch.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
0001-postgres_fdw-Fix-assertion-in-estimate_path_cost_siz.patch application/octet-stream 4.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Mahendra Singh Thalor 2021-02-04 16:42:58 Re: BUG #16846: "retrieved too many tuples in a bounded sort"
Previous Message Neil Chen 2021-02-04 03:42:06 Re: BUG #16846: "retrieved too many tuples in a bounded sort"