Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rXxKp-00DUTI-L7 for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Feb 2024 05:52:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rXxKo-00FElt-NC for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Feb 2024 05:52:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rXxKo-00FEll-Aw for pgsql-bugs@lists.postgresql.org; Thu, 08 Feb 2024 05:52:30 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rXxKj-005f4o-OG for pgsql-bugs@lists.postgresql.org; Thu, 08 Feb 2024 05:52:29 +0000 Received: from [172.30.8.38] (unknown [172.30.8.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.lepikhov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 41892E210CC; Thu, 8 Feb 2024 08:52:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1707371542; bh=luYFXTgm7eUQcJmbMtNEtequwWUn7DGbB+Z7bm83KL8=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=bEltF6PMpQVdcYp7ZBmLt5p8FwCIAKab3242tH75I694Nrb8+4lO5dZggonSwZDZl R3MRFuD64arD/sISZzNoGJxlWf66wbJ6NhfsKigmtnhbQOYE/tSm1bfaydYKHo8564 xnW99V/YtSW6PkSA27Kdb03rG1NKKhLVhPoXZ3NLhlAxcJRiGbka+jddB3rYVx8sl3 mDX/Qp6apErOVsKKg1OiBdToB0x2UHklL6R2B/QLB4o2CfIB2LPHDshnGkw3bOnGzy M7Vd1TZdolTyEP1VQQVcLkq/GNfgmqwHFrZmE88bNKAXA72a8my9VRIYhb5QwgeX0t uHKjtNTqN+mTw== Message-ID: <7e8c5fc5-efcd-4e6e-b1f7-84446568d6f9@postgrespro.ru> Date: Thu, 8 Feb 2024 12:52:17 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: v17 Possible Union All Bug Content-Language: en-US To: Alexander Korotkov Cc: "David G. Johnston" , Tom Lane , David Rowley , Alexander Korotkov , PostgreSQL Bug List , Richard Guo References: <41499cc3-31a1-4c9e-85d6-45e6d901ea6a@postgrespro.ru> From: Andrei Lepikhov Organization: Postgres Professional In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/2/2024 16:28, Alexander Korotkov wrote: > On Sun, Feb 4, 2024 at 6:57 AM Andrei Lepikhov > wrote: >> The simple fix is in the attachment. But I'm not sure we should fix >> GROUP-BY optimization instead of the more general issue. >> The source of the problem is root->group_pathkeys, which contains >> grouping pathkeys and aggregate pathkeys. For now, their 'sortref' >> values could intersect, and we can differ which one references the query >> target list and which one the target list of the aggregate. >> So, I would like to get advice here: should we make a quick fix here, or >> is such a mess in the sortref values not a mess and designed for some >> purposes? > > Thank you, Andrei. I think we should apply this fix for now, while > better refactoring could be done in future. I've revised your fix > with more comments and a commit message. I'm going to push it if > there are no objections. I looked into the patch and found only one typo, 'pahtkeys'. -- regards, Andrei Lepikhov Postgres Professional