Re: GSets: Fix bug involving GROUPING and HAVING together

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: GSets: Fix bug involving GROUPING and HAVING together
Дата
Msg-id 20150726151456.GD12755@awork2.anarazel.de
обсуждение исходный текст
Ответ на Re: GSets: Fix bug involving GROUPING and HAVING together  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
On 2015-07-24 11:34:22 +0100, Andrew Gierth wrote:
> >>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> 
>  Andrew> The other is that in subquery_planner, the optimization of
>  Andrew> converting HAVING clauses to WHERE clauses is suppressed if
>  Andrew> parse->groupingSets isn't empty. (It is empty if there's either
>  Andrew> no group by clause at all, or if there's exactly one grouping
>  Andrew> set, which must not be empty, however derived.) This is costing
>  Andrew> us some optimizations, especially in the case of an explicit
>  Andrew> GROUP BY () clause; I'll look into this.
> 
> I'm inclined to go with the simplest approach here, which copies the
> quals if there are grouping sets. The only way we could safely move a
> qual without copying is if we can show that none of the grouping sets is
> empty, that is (), and at this point the grouping set list has not been
> expanded so it's not trivial to determine that.

I pushed this to both master and 9.5. While this isn't strictly a
bugfix, it seemed better to keep the branches the same at this point.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: GSets: Fix bug involving GROUPING and HAVING together
Следующее
От: Tom Lane
Дата:
Сообщение: Re: CustomScan and readfuncs.c