agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Masahiko Sawada <msawada@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add min() and max() aggregate support for uuid.
Date: Wed, 01 Jul 2026 18:43:14 +0000
Message-ID: <E1wezty-000zKr-0l@gemulon.postgresql.org> (raw)
Add min() and max() aggregate support for uuid.
The uuid type already has a full set of comparison operators and a
btree operator class, so it is totally ordered. min() and max() were
the only common aggregates missing for it. Add the uuid_larger() and
uuid_smaller() support functions and register the min(uuid) and
max(uuid) aggregates that use them.
uuid values are compared lexicographically over their 128 bits. For
UUIDv7, whose most significant bits encode a Unix timestamp, this
coincides with chronological order, so min() and max() return the
oldest and newest values.
Bump catalog version.
Author: Tristan Partin <tristan@partin.io>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/DJGML0T9FCDV.3VA29JLODXEHZ@partin.io
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/2e606d75c0bf9c867b51ad228eae384a9d1de21a
Modified Files
--------------
doc/src/sgml/datatype.sgml | 4 ++++
doc/src/sgml/func/func-aggregate.sgml | 6 ++++--
src/backend/utils/adt/uuid.c | 18 ++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_aggregate.dat | 6 ++++++
src/include/catalog/pg_proc.dat | 12 ++++++++++++
src/test/regress/expected/opr_sanity.out | 2 ++
src/test/regress/expected/uuid.out | 7 +++++++
src/test/regress/sql/uuid.sql | 3 +++
9 files changed, 57 insertions(+), 3 deletions(-)
Message-ID: <E1wezty-000zKr-0l@gemulon.postgresql.org>
Permalink: ../E1wezty-000zKr-0l@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wezty-000zKr-0l@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: msawada@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Add min() and max() aggregate support for uuid.
In-Reply-To: <E1wezty-000zKr-0l@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox