Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1Evv-0005sE-JP for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Jul 2021 21:18:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m1Evs-0001Bl-3d for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Jul 2021 21:18:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1Evr-0001Bd-TL for pgsql-bugs@lists.postgresql.org; Wed, 07 Jul 2021 21:18:11 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m1Evp-0007Ia-NN for pgsql-bugs@lists.postgresql.org; Wed, 07 Jul 2021 21:18:11 +0000 Received: from [192.168.127.1] (port=16158 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1m1Evh-0009kY-Mc; Wed, 07 Jul 2021 21:18:01 +0000 Received: from localhost ([127.0.0.1]:30302 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.93.0.4 (FreeBSD)) (envelope-from ) id 1m1Evh-000Ar5-8o; Wed, 07 Jul 2021 21:18:01 +0000 From: Andrew Gierth To: Tom Lane Cc: Michael Paquier , cyg0810@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17088: FailedAssertion in prepagg.c In-Reply-To: <1908212.1625690962@sss.pgh.pa.us> (Tom Lane's message of "Wed, 07 Jul 2021 16:49:22 -0400") Message-ID: <87a6mxrggq.fsf@news-spur.riddles.org.uk> References: <17088-e33882b387de7f5c@postgresql.org> <1908212.1625690962@sss.pgh.pa.us> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) Date: Wed, 07 Jul 2021 22:18:01 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >>>>> "Tom" == Tom Lane writes: Tom> An alternative theory is that we should never have done anything Tom> at all to the argument tree of a GroupingFunc. Since it's not Tom> supposed to be evaluated, treating it as a target for expression Tom> preprocessing might be a mistake altogether. I wonder why its Tom> arguments aren't stored as sortgroupref indexes or the like. The arguments are stored as sortgrouprefs (the "refs" list) for actual use; the "args" list is only kept for the benefit of EXPLAIN and deparsing. A number of places in the planner have to explicitly avoid recursing into GroupingFunc->args when walking trees specifically because they are not evaluated. It looks to me like some places where that should have been checked for were missed. Looking into it. -- Andrew (irc:RhodiumToad)