Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid.

Read Original

This article discusses the new min() and max() aggregate support for the UUID data type in PostgreSQL 20, committed on July 1, 2026. The UUID type already had comparison operators and a btree operator class, making it totally ordered, but min() and max() were missing. The patch adds uuid_larger() and uuid_smaller() functions and registers the aggregates. For UUIDv7, which encodes a Unix timestamp in its most significant bits, min() and max() return the oldest and newest values chronologically. The article demonstrates the feature with a practical example, creating a table, inserting UUIDv7 values, and querying with min() and max() to show chronological ordering.

Waiting for PostgreSQL 20 – Add min() and max() aggregate support for uuid.

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet