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 1s8NMY-00CA7W-6O for pgsql-bugs@arkaria.postgresql.org; Sat, 18 May 2024 16:56:51 +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 1s8NMX-008m4I-St for pgsql-bugs@arkaria.postgresql.org; Sat, 18 May 2024 16:56:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8NMX-008m4A-K8 for pgsql-bugs@lists.postgresql.org; Sat, 18 May 2024 16:56:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s8NMU-000u6u-8x for pgsql-bugs@lists.postgresql.org; Sat, 18 May 2024 16:56:49 +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 44IGuiRp2787681; Sat, 18 May 2024 12:56:44 -0400 From: Tom Lane To: Dmitry Dolgov <9erthalion6@gmail.com> cc: mtakahar@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18465: Wrong results from SELECT DISTINCT MIN in scalar subquery using HashAggregate In-reply-to: <20240518141801.cobd5aup2pnogeo2@ddolgov.remote.csb> References: <18465-2fae927718976b22@postgresql.org> <20240518141801.cobd5aup2pnogeo2@ddolgov.remote.csb> Comments: In-reply-to Dmitry Dolgov <9erthalion6@gmail.com> message dated "Sat, 18 May 2024 16:18:01 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2787679.1716051404.1@sss.pgh.pa.us> Date: Sat, 18 May 2024 12:56:44 -0400 Message-ID: <2787680.1716051404@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dmitry Dolgov <9erthalion6@gmail.com> writes: > Thanks, I could reproduce this in v15 and v16. Interestingly enough it > was fixed in d0d44049d1, but looks like due to lack of error reports the > fix was applied only on the main branch. I assume this one makes it > necessary to back-patch the fix. Hah. Nothing like fixing a bug that you know is there but you can't demonstrate it ;-). I confirm the problem appears in d0d44049d1^ (and at least as far back as v12), but not in d0d44049d1 or HEAD. So yeah, add test case and back-patch. Many thanks for the test case! regards, tom lane