Bug? Changing where distinct occurs produces error?

Поиск
Список
Период
Сортировка
От Michael Loftis
Тема Bug? Changing where distinct occurs produces error?
Дата
Msg-id DE7D6281F4C40F472F6E0A6A@d216-220-25-20.dynip.modwest.com
обсуждение исходный текст
Ответы Re: Bug? Changing where distinct occurs produces error?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: Bug? Changing where distinct occurs produces error?  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список pgsql-general
OK I'm either insane or found a bug in 8.1.3

If you execute say:

SELECT DISTINCT(ua.user_id),pa.poll_id FROM user_answers ua, poll_answers
pa WHERE pa.poll_answer_id = ua.poll_answer_id AND ua.active='Y';

Everything is fine, however if you run

SELECT pa.poll_id,DISTINCT(ua.user_id) FROM user_answers ua, poll_answers
pa WHERE pa.poll_answer_id = ua.poll_answer_id AND ua.active='Y';

ERROR:  syntax error at or near "DISTINCT" at character 19
LINE 1: SELECT pa.poll_id,DISTINCT(ua.user_id) FROM user_answers ua,...
                          ^
Further if I wrap it in a SUM (with a group by pa.poll_id) I get no error.

I'm a little confused as to what is wrong with my second example there?

--
"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler

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

Предыдущее
От: Stephane Bortzmeyer
Дата:
Сообщение: Re: How to optimize query that concatenates strings?
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Bug? Changing where distinct occurs produces error?