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 1sZbOi-0028Cd-8H for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Aug 2024 19:23:36 +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 1sZbOg-00Cr8E-F9 for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Aug 2024 19:23:34 +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 1sZbOg-00Cr86-6c for pgsql-bugs@lists.postgresql.org; Thu, 01 Aug 2024 19:23:34 +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 1sZbOd-002eed-Fz for pgsql-bugs@lists.postgresql.org; Thu, 01 Aug 2024 19:23:33 +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 471JNT8b3781618; Thu, 1 Aug 2024 15:23:29 -0400 From: Tom Lane To: Christophe Pettus cc: iuritomazini.dev@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18563: Where is tha "FIRST" aggregate function?? In-reply-to: <8E8D05C8-329E-4D3E-9C31-25A6EB339C4D@thebuild.com> References: <18563-bed7c7e283cc81b5@postgresql.org> <8E8D05C8-329E-4D3E-9C31-25A6EB339C4D@thebuild.com> Comments: In-reply-to Christophe Pettus message dated "Thu, 01 Aug 2024 10:38:29 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3781616.1722540209.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 01 Aug 2024 15:23:29 -0400 Message-ID: <3781617.1722540209@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Christophe Pettus writes: >> On Aug 1, 2024, at 09:25, PG Bug reporting form wrote: >> I am migrating for >> other database, bacause of the dificulty to get a similar resource to >> substitute the "FIRST" in PostgreSQL and I hope you can recognize this = bad >> error and implement something to suppply this lack. Good bye! > It's trivial to implement in PostgreSQL: > https://wiki.postgresql.org/wiki/First/last_(aggregate) The built-in (since v16) "any_value()" aggregate is actually just like what that page shows for "first()". The name is chosen to reflect the fact that the aggregate itself isn't promising anything: you have to use it in the correct way to get useful behavior. regards, tom lane