Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-26 Thread Andres Freund
On 2015-07-24 11:34:22 +0100, Andrew Gierth wrote: Andrew == Andrew Gierth and...@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

Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-26 Thread Andres Freund
On 2015-07-14 14:51:09 +0530, Jeevan Chalke wrote: Fix this by adding GroupingFunc node in this walker. We do it correctly in contain_aggs_of_level_walker() in which we have handling for GroupingFunc there. Attached patch to fix this. Pushed, thanks for fix! -- Sent via pgsql-hackers

Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-24 Thread Andrew Gierth
Andrew == Andrew Gierth and...@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

Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-24 Thread Jeevan Chalke
Hi, This will fail too. Note that, when we have only one element in GROUPING SETS, we add that in group by list and set parse-groupingSets to NULL. And hence it will have same issue. However tests added in my patch failing too. Thanks -- Jeevan B Chalke Principal Software Engineer, Product

Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-24 Thread Andrew Gierth
Jeevan == Jeevan Chalke jeevan.cha...@enterprisedb.com writes: Jeevan Hi, Jeevan This will fail too. This is in addition to your patch, not instead of it. -- Andrew (irc:RhodiumToad) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-14 Thread Andrew Gierth
Jeevan == Jeevan Chalke jeevan.cha...@enterprisedb.com writes: Jeevan Basically, when we have only one element in GROUING SETS, we Jeevan are assuming it as a simple GROUP BY with one column. Due to Jeevan which we are ending up with this error. Jeevan If we have ROLLUP/CUBE or GROUPING

Re: [HACKERS] GSets: Fix bug involving GROUPING and HAVING together

2015-07-14 Thread Jeevan Chalke
On Tue, Jul 14, 2015 at 4:23 PM, Andrew Gierth and...@tao11.riddles.org.uk wrote: Jeevan == Jeevan Chalke jeevan.cha...@enterprisedb.com writes: Jeevan Basically, when we have only one element in GROUING SETS, we Jeevan are assuming it as a simple GROUP BY with one column. Due to Jeevan