Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
Date
Msg-id 3243867.1659563610@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY  (Martijn van Oosterhout <kleptog@gmail.com>)
List pgsql-bugs
Martijn van Oosterhout <kleptog@gmail.com> writes:
> The part I haven't seen explained is why the generate_series() is
> important. My guess is that if you replace it with an expression it is no
> longer an SRF and it produces some completely different plan that prevents
> the problematic path being triggered.

I think the generate_series() forces a ProjectSet to be put atop the
join, where we'd probably not have done that without it, having made
the bogus assumption that we could evaluate the sort-key SRF at scan
level.  Why that changes the costs enough to mask or not mask the bug
is still obscure.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
Next
From: Richard Guo
Date:
Subject: Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY