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.98.2) (envelope-from ) id 1x7Zsh-00000000UYI-1gl3 for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Sep 2026 14:48:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x7Zrh-00000001geF-2abO for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Sep 2026 14:47:01 +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.98.2) (envelope-from ) id 1x7Zoj-00000001de5-0B80 for pgsql-bugs@lists.postgresql.org; Fri, 18 Sep 2026 14:43:57 +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.98.2) (envelope-from ) id 1x7Zog-000000002tQ-1Oqb for pgsql-bugs@lists.postgresql.org; Fri, 18 Sep 2026 14:43:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68IEhgtT1011469; Fri, 18 Sep 2026 10:43:42 -0400 From: Tom Lane To: chaitanyyachoudhary@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19694: MIN()/MAX() fails with "more than one row returned by a subquery" under FETCH FIRST ... WITH TIES In-reply-to: <19694-4e61bd0475398eef@postgresql.org> References: <19694-4e61bd0475398eef@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 18 Sep 2026 02:42:42 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1011467.1789742622.1@sss.pgh.pa.us> Date: Fri, 18 Sep 2026 10:43:42 -0400 Message-ID: <1011468.1789742622@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > An aggregate query with ORDER BY and FETCH FIRST n ROWS WITH TIES fails > with an error when the planner chooses the index path for MIN() or MAX(). Thanks for the report, will fix. > The same code is present on REL_18_STABLE and master as of 2026-09-17. Seems to have been broken since WITH TIES was implemented. regards, tom lane