Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjoZz-00043N-1j for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Jan 2019 17:02:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gjoZx-00039l-GL for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Jan 2019 17:02:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjoZx-00039e-5q for pgsql-hackers@lists.postgresql.org; Wed, 16 Jan 2019 17:02:13 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjoZt-0008WP-UT for pgsql-hackers@postgresql.org; Wed, 16 Jan 2019 17:02:11 +0000 Received: from [192.168.127.1] (port=34742 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 1gjoZr-0006du-Pu for pgsql-hackers@postgresql.org; Wed, 16 Jan 2019 17:02:07 +0000 Received: from [127.0.0.1] (port=16956 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1gjoZr-000Azb-3M for pgsql-hackers@postgresql.org; Wed, 16 Jan 2019 17:02:07 +0000 From: Andrew Gierth To: pgsql-hackers@postgresql.org Subject: parseCheckAggregates vs. assign_query_collations Message-ID: <87muo0k0c7.fsf@news-spur.riddles.org.uk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Wed, 16 Jan 2019 17:02:07 +0000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Looking into a bug report on the -general list about grouping sets, which turns out to be an issue of collation assignment: if the query has CASE GROUPING(expr) WHEN 1 ... then the expression is rejected as not matching the one in the GROUP BY clause, because CASE already assigned collations to the expression (as a special case in its transform function) while the rest of the query hasn't yet had them assigned, because parseCheckAggregates gets run before assign_query_collations. I'll be looking into this in detail later, but right now, cam anyone think of any reason why parseCheckAggregates couldn't be moved to after assign_query_collations? -- Andrew (irc:RhodiumToad)