pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Cc: Atri Sharma <atri.jiit@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Postgres-Bugs <pgsql-bugs@postgresql.org>
Subject: Re: GSets: Fix bug involving GROUPING and HAVING together
Date: Sun, 26 Jul 2015 17:14:56 +0200
Message-ID: <20150726151456.GD12755@awork2.anarazel.de> (raw)
In-Reply-To: <874mkt3l59.fsf@news-spur.riddles.org.uk>
References: <CAM2+6=WG9omG5rFOMAYBweJxmpTaapvVp5pCeMrE6BfpCwr4Og@mail.gmail.com>
	<87si8rqba3.fsf@news-spur.riddles.org.uk>
	<874mkt3l59.fsf@news-spur.riddles.org.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (8+ messages)

Message-ID: <20150726151456.GD12755@awork2.anarazel.de>
Permalink:  ../20150726151456.GD12755@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20150726151456.GD12755@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, andrew@tao11.riddles.org.uk, jeevan.chalke@enterprisedb.com, atri.jiit@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: GSets: Fix bug involving GROUPING and HAVING together
  In-Reply-To: <20150726151456.GD12755@awork2.anarazel.de>
  References: <CAM2+6=WG9omG5rFOMAYBweJxmpTaapvVp5pCeMrE6BfpCwr4Og@mail.gmail.com> <87si8rqba3.fsf@news-spur.riddles.org.uk> <874mkt3l59.fsf@news-spur.riddles.org.uk> <20150726151456.GD12755@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox