Re: Nondeterministic collations and the value returned by GROUP BY x

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Nondeterministic collations and the value returned by GROUP BY x
Дата
Msg-id 3085260.1615844781@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Nondeterministic collations and the value returned by GROUP BY x  (Jim Finnerty <jfinnert@amazon.com>)
Список pgsql-hackers
Jim Finnerty <jfinnert@amazon.com> writes:
> 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*.

As I recall, "implementation-dependent" means specifically that we *don't*
have to make any promise about which particular value will be selected.
If it said "implementation-defined" then we would.

I expect that in practice it'd be the first of the group that arrives at
the grouping plan node --- but that doesn't really get you any closer
to being able to say which one it is exactly.  The input is either not
ordered at all, or ordered by something like a Sort node, which itself
is not going to make any promises about which one of a group of peers
is delivered first.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Enhance traceability of wal_level changes for backup management
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: Calendar support in localization