Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e52Jv-0007xe-Sx for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Oct 2017 04:20:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e52Ju-0002YD-UW for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Oct 2017 04:20:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e52JA-0001C0-4x for pgsql-bugs@postgresql.org; Thu, 19 Oct 2017 04:19:48 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e52J5-0005ix-6a for pgsql-bugs@postgresql.org; Thu, 19 Oct 2017 04:19:46 +0000 Received: from [192.168.127.1] (port=48485 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1e52J0-000LQ6-Vn; Thu, 19 Oct 2017 04:19:39 +0000 Received: from [127.0.0.1] (port=14053 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1e52J0-0006Ut-AQ; Thu, 19 Oct 2017 04:19:38 +0000 From: Andrew Gierth To: Tom Lane Cc: Heikki Linnakangas , Pg Bugs Subject: Re: Improper const-evaluation of HAVING with grouping sets and subquery pullup In-Reply-To: <26650.1508339040@sss.pgh.pa.us> (Tom Lane's message of "Wed, 18 Oct 2017 11:04:00 -0400") Message-ID: <878tg7yf1e.fsf@news-spur.riddles.org.uk> References: <7dbdcf5c-b5a6-ef89-4958-da212fe10176@iki.fi> <1197.1507820787@sss.pgh.pa.us> <87efq3lq93.fsf@news-spur.riddles.org.uk> <87a80rli2w.fsf@news-spur.riddles.org.uk> <32319.1508163874@sss.pgh.pa.us> <8760bfku2u.fsf@news-spur.riddles.org.uk> <2431.1508166918@sss.pgh.pa.us> <871sm3ktl7.fsf@news-spur.riddles.org.uk> <87tvyyjg2s.fsf@news-spur.riddles.org.uk> <26650.1508339040@sss.pgh.pa.us> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Thu, 19 Oct 2017 05:19:37 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org >>>>> "Tom" == Tom Lane writes: Tom> I don't think I buy this explanation, because the plan tree Tom> doesn't show any indication that we're actually folding (g,g) to Tom> (g): Huh. Yes, you're right. Tom> Digression: this seems like another example in which the "same" Tom> Var can represent two different values. At one point in the evolution of the GS patch it had a new node type, GroupedVar or some such name, to represent the possibly-nulled-out values. I'm not sure that it was being introduced early enough in planning to have prevented this problem (I suspect not, I'd have to dig up the old code). That stuff was all ripped out very late in the development process because as I recall, both you and Andres disliked it. -- Andrew (irc:RhodiumToad) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs