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 1pHg2B-0007Li-22 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 07:05:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHg29-0004sg-Th for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 07:05:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHg29-0004sV-L9 for pgsql-hackers@lists.postgresql.org; Tue, 17 Jan 2023 07:05:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHg27-0008Tb-Cx for pgsql-hackers@lists.postgresql.org; Tue, 17 Jan 2023 07:05:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 30H75JjE2909365; Tue, 17 Jan 2023 02:05:19 -0500 From: Tom Lane To: Richard Guo cc: David Rowley , Dean Rasheed , Ronan Dunklau , Justin Pryzby , Pavel Luzanov , pgsql-hackers@lists.postgresql.org, Ranier Vilela Subject: Re: Add proper planner support for ORDER BY / DISTINCT aggregates In-reply-to: References: <3163474.aeNJFYEL58@aivenronan> <9f61ddbf-2989-1536-b31e-6459370a6baa@postgrespro.ru> <2202180.iZASKD2KPV@aivenlaptop> <416296.1673411524@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Tue, 17 Jan 2023 14:29:56 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2909363.1673939119.1@sss.pgh.pa.us> Date: Tue, 17 Jan 2023 02:05:19 -0500 Message-ID: <2909364.1673939119@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > BTW, I wonder if we should have checked CoercionForm before > fix_upper_expr_mutator steps into CoerceViaIO->arg to adjust the expr > there. I will just quote what it says in primnodes.h: * NB: equal() ignores CoercionForm fields, therefore this *must* not carry * any semantically significant information. If you think the planner should act differently for different values of CoercionForm, you are mistaken. Maybe this is evidence of some previous bit of brain-fade, but if so we need to fix that. regards, tom lane