BUG #5563: Odd behavior with aggregate_func(DISTINCT foo ORDER BY foo)

Поиск
Список
Период
Сортировка
От Daniel Grace
Тема BUG #5563: Odd behavior with aggregate_func(DISTINCT foo ORDER BY foo)
Дата
Msg-id 201007170004.o6H0485p075061@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5563: Odd behavior with aggregate_func(DISTINCT foo ORDER BY foo)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5563
Logged by:          Daniel Grace
Email address:      dgrace@wingsnw.com
PostgreSQL version: 9.0beta3
Operating system:   Windows XP 32-bit
Description:        Odd behavior with aggregate_func(DISTINCT foo ORDER BY
foo)
Details:

The manual states:
"If DISTINCT is specified in addition to an order_by_clause, then all the
ORDER BY expressions must match regular arguments of the aggregate; that is,
you cannot sort on an expression that is not included in the DISTINCT  list.
"

However, in some circumstances Postgres will fail

DROP TABLE IF EXISTS foo;
CREATE TABLE foo (
    t VARCHAR
);

INSERT INTO foo (t) VALUES ('a'), ('a'), ('b'), ('b'), ('c');

SELECT STRING_AGG(DISTINCT t::TEXT ORDER BY t::TEXT) FROM foo;

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

Предыдущее
От: "Heinz Groote"
Дата:
Сообщение: BUG #5562: icon "terrestrial globe" much too big
Следующее
От: "Daniel Grace"
Дата:
Сообщение: BUG #5564: Odd behavior with aggregate_func(DISTINCT foo ORDER BY foo)