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.96) (envelope-from ) id 1w03cV-001Zwf-1x for pgsql-general@arkaria.postgresql.org; Tue, 10 Mar 2026 20:23:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w03cS-005sDT-2r for pgsql-general@arkaria.postgresql.org; Tue, 10 Mar 2026 20:23:57 +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.96) (envelope-from ) id 1w03cS-005sDH-1h for pgsql-general@lists.postgresql.org; Tue, 10 Mar 2026 20:23:57 +0000 Received: from mail-yx1-xb130.google.com ([2607:f8b0:4864:20::b130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w03cQ-000000021Wm-0pdl for pgsql-general@lists.postgresql.org; Tue, 10 Mar 2026 20:23:56 +0000 Received: by mail-yx1-xb130.google.com with SMTP id 956f58d0204a3-64937edbc9eso12226118d50.2 for ; Tue, 10 Mar 2026 13:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773174232; cv=none; d=google.com; s=arc-20240605; b=ZsjnBmGNdsW1V49JTwQ2USGNnWnyR1Sh7gBniUa+oPKtHZZd9F75EA4ULnm9LAIpaz JlIAA4aKXMIcCeRg8c1OyJpEJ36RzibNP10IPBCmIVpeIYo61Mq4r8Uf9/Yg9/FdsrI7 5CGc5KrkS+lIrd2dywavIBd/od/H+LX/IryBXIR59ltvQX7vd+CQZCgs6SEp/tpGElHj rByMW4cridfGKp4U1o8Iu6LpqsFt+JAqVyePliUgNU6CMscBk7Cxeswaq0kBid+8Z36+ lXoTMihrXcOrXnQ3eRHFbP4mk0810Yt8noFpJtkteq2ZKrTCGc1f5/rhQR3QeaFJpknw 69Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=xKThOZXgCTIE4oZQwW9PiaWtHZ4e3e1EKhLlgOkZQNw=; fh=m06x4jm9dLNV+n3haodnX9sS7g3ex+5d4j4U7Oxo/NA=; b=ZqT1rZQvzMf6iuDj2XjQ0MEN78o5yv6wdIxhhBW0JygHm4ZtYFuV9+fTqllsRrMeex 9HZwJ2TfUfHGpfNztgVZIs9uhyPdKfcipP7u8M5kAYNXMy847Svz6q3Knm2i2cLxhUGh k942BuV+ud0pJ1vrzbo6L28qZeUYoEb/+m0zBnauEufxeVT3OvMgIBKmIAh8aDVlp6Ie LkFvb+ELoQ/joNd0K3x27nyLo/TyTkgu/Te+0k07VrzBhHWVWsFRqiTwimcV+PRmSk+o buETrkgqgrOG1IBBkhK6mqR0Qt4NcKZAaDw1rzkcSbp3klZ0BGiPxdd7d0PNq7d7uWA3 XK/Q==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773174232; x=1773779032; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=xKThOZXgCTIE4oZQwW9PiaWtHZ4e3e1EKhLlgOkZQNw=; b=BXIjEJxTmoalbtExf2nBRmQKesPnSCkzu8YBFLiAlJGXiMftAaTr87ueDzTXiG7XVF FMxz2kx40AodgCk7b46nyzux2RYQiTmYArGmoJkBTvsd7aGUU3WUUhkRjgrVGn7BVzYy RaZ7Swfp0Ueb1DBymQk1juaRVP97q0DODaztPG6VnXp8GzC2YL7t3D9XKGiEEqBlsUsv OqwRMf3+bMdQTAl1FoEZGt8lu4UKm/rdstaGpfGl+xSj3cjFIxuA9r6sDrDQurfu2ELS uUTv8ktWru0Jowa3kEXGwl3Gsk/FjscClRX93gc9gf43f52E6agyrLptZQPw1zyxBIP+ qjXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773174232; x=1773779032; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xKThOZXgCTIE4oZQwW9PiaWtHZ4e3e1EKhLlgOkZQNw=; b=bq8Pr1ajeZ6iasBP1jqfHCzvc1KrL09B/TDEFDjZ2DZrfMMSR1qDEZ+/S9+QcDCm26 24yMzZWmwvIM57o8G+3QqIdZcubm02whAfU2IORImZc8+2mwCBRhEQAv1ocd6cZ5llWJ Spn8gs9jIt+6iWGYZVSr6w3m/0t+crREEy1CmAhwfnP+RtPM1s7SRZb21ocCN85p5NwK C3X2Nw56cEjx3xZONZFTC1cRGiH8z7nUGPUe5cMrwmFEGhw/ABx32rF+YbZMoVpQAPGG 8/1vY3RbCRxdZZPLTyTYCSDCXIovmMfuijelwBy+YhprVXWDKGJC+kRkF0QHAuEDWNmA xgVQ== X-Forwarded-Encrypted: i=1; AJvYcCW4bS0NYaChhvr9fdV8p7wczGZDpPpkwwC2u3S+/u1A58CQBixPS4G7PMrapFtVuxi3aej61o07TEGiob1q@lists.postgresql.org X-Gm-Message-State: AOJu0YyIg0raHH788feP6I6zLOnFDDKw4ffI41W8Pcc3+lKMUsSfVkd4 Vexc5HHJ7FB7i4o6OplrQIFLG4GuUPd7i7KlUj+O3vRZ7ou4PRgu5DIVv8yeUOaxtxQb9VZU86V hDIWPOS0M0rzIXhlxfu4zr168OtiQU+Y= X-Gm-Gg: ATEYQzyiCoQASSqxSARTN1YIpjxNk4CkXNiDcPxOIUH7G0O96lCNGSojU3aRUQ1CSB6 VhU71g6lnH60bhYwTG7PAf/hTB2wen+oNiyge8Z6BiDjN1nxJVdS2lAFDJ0XjvO+eg1uRDJ86eN jkJOr0vKPI36r6X3Gt3ZMfZJjP3Oaq2gC3fXYb8jra3qCcNuS1mcEPEbHyyKEWExpChXkOwg0Gx Tr/sHFSYqgtfHWp+3Ncdo2QnnSNfrSq8kl2zF5iabexy8eKVnLiQZ75rayk8IA31jl8XRTiRPmJ pK5q+7PT4xcNpIAt/hj8l0ZMLFchxgFt94qMwvKXTE8nzT9a/AAL/8tM1on0+ochiKiw20XqWoj 9iJbC4Gvne3UZtzS8o5piZCuARtWoOZ2Y5WsH4MBmm36/JzpJRxU/bhLWtg== X-Received: by 2002:a05:690e:258d:b0:64c:99d7:8d22 with SMTP id 956f58d0204a3-64d656ba535mr21860d50.21.1773174232196; Tue, 10 Mar 2026 13:23:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pavel Stehule Date: Tue, 10 Mar 2026 21:23:14 +0100 X-Gm-Features: AaiRm53rbV5cTUbOnNiVC-h49zjrYqaXVN-7WnwXjBR0i_xC7aB4XTBtuuAnkg8 Message-ID: Subject: =?UTF-8?Q?Re=3A_LISTAGG_=C3=A0_la_Oracle_in_PostgreSQL?= To: Juan Rodrigo Alejandro Burgos Mella Cc: Pierre Forstmann , Paul A Jungwirth , "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000003c2aa8064cb14cae" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003c2aa8064cb14cae Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi =C3=BAt 10. 3. 2026 v 20:58 odes=C3=ADlatel Juan Rodrigo Alejandro Burgos M= ella < rodrigoburgosmella@gmail.com> napsal: > To do something similar, you would have to fork the source code and > implement the declarations with the same syntax, resulting in something > like Postracle. > orafce has listagg function https://github.com/orafce/orafce Regards Pavel > > Atte > JRBM > > El mar, 10 mar 2026 a las 13:53, Pierre Forstmann (< > pierre.forstmann@gmail.com>) escribi=C3=B3: > >> I agree but I just would like to know if there is way to be compatible >> with Oracle syntax using aggregate features in PostgreSQL >> >> Thanks. >> >> Le 09/03/2026 =C3=A0 23:05, Paul A Jungwirth a =C3=A9crit : >> > On Mon, Mar 9, 2026 at 1:21=E2=80=AFPM Pierre Forstmann >> > wrote: >> >> Hello, >> >> >> >> I can write a LISTAGG aggregate for: >> >> >> >> create table emp(deptno numeric, ename text); >> >> >> >> SELECT deptno, LISTAGG(ename, ','::text ORDER BY ename) AS employees >> >> FROM emp GROUP BY deptno ORDER BY deptno; >> >> >> >> I would like to know if is possible to create an aggregate LISTAGG th= at >> >> would work like in Oracle: >> >> >> >> SELECT deptno, >> >> listagg(ename, ',') WITHIN GROUP (ORDER BY ename) AS employe= es >> >> FROM emp >> >> GROUP BY deptno >> >> ORDER BY deptno; >> > I don't think you need a custom aggregate here. In Postgres you can sa= y: >> > >> > select deptno, >> > string_agg(ename, ',' ORDER BY ename) AS employees >> > FROM emp >> > GROUP BY deptno >> > ORDER BY deptno; >> > >> >> >> --0000000000003c2aa8064cb14cae Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

=C3=BAt 10. 3. 2026 v=C2=A020= :58 odes=C3=ADlatel Juan Rodrigo Alejandro Burgos Mella <rodrigoburgosmella@gmail.com> napsa= l:
To do something similar, you would have to fork the source code and imp= lement the declarations with the same syntax, resulting in something like P= ostracle.

orafce has listagg function= =C2=A0https://github.com/orafc= e/orafce

Regards

Pave= l
=C2=A0
<= div dir=3D"ltr">

Atte
JRBM

El mar, 10 mar= 2026 a las 13:53, Pierre Forstmann (<pierre.forstmann@gmail.com>) escribi= =C3=B3:
I agree = but I just would like to know if there is way to be compatible
with Oracle syntax using aggregate features in PostgreSQL

Thanks.

Le 09/03/2026 =C3=A0 23:05, Paul A Jungwirth a =C3=A9crit=C2=A0:
> On Mon, Mar 9, 2026 at 1:21=E2=80=AFPM Pierre Forstmann
> <pi= erre.forstmann@gmail.com> wrote:
>> Hello,
>>
>> I can write a LISTAGG aggregate for:
>>
>> create table emp(deptno numeric, ename text);
>>
>> SELECT deptno, LISTAGG(ename, ','::text ORDER BY ename) AS= employees
>> FROM=C2=A0 =C2=A0emp GROUP BY deptno ORDER BY deptno;
>>
>> I would like to know if is possible to create an aggregate LISTAGG= that
>> would work like in Oracle:
>>
>> SELECT deptno,
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 listagg(ename, ',') WITH= IN GROUP (ORDER BY ename) AS employees
>> FROM emp
>> GROUP BY deptno
>> ORDER BY deptno;
> I don't think you need a custom aggregate here. In Postgres you ca= n say:
>
> select deptno,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 string_agg(ename, ',' ORDER BY enam= e) AS employees
> FROM emp
> GROUP BY deptno
> ORDER BY deptno;
>


--0000000000003c2aa8064cb14cae--