Nondeterministic collations and the value returned by GROUP BY x

From: Jim Finnerty <jfinnert(at)amazon(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Nondeterministic collations and the value returned by GROUP BY x
Date: 2021-03-15 21:31:52
Message-ID: 1615843912441-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


PostgreSQL 12 and onward supports nondeterministic collations. For "GROUP
BY x", which value of 'x' will PostgreSQL return in this case? The first
value of x?

The SQL standard (section 8.2) states that the specific value returned is
implementation-defined, but requires that the value must be one of the
specific values in the set of values that compare equally:

d) Depending on the collation, two strings may compare as equal even if they
are of different lengths or contain different sequences of characters. When
any of the operations MAX, MIN, and DISTINCT reference a grouping column,
and the UNION, EXCEPT, and INTERSECT operators refer to character strings,
*the specific value selected by these operations from a set of such equal
values is implementation- dependent*.

-----
Jim Finnerty, AWS, Amazon Aurora PostgreSQL
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2021-03-15 21:32:29 Re: Enhance traceability of wal_level changes for backup management
Previous Message Peter Geoghegan 2021-03-15 20:58:02 Re: New IndexAM API controlling index vacuum strategies