Folks,
Elein Mustain mentioned this, and I came up with a short repro. The
SQL standard does not distinguish between what's available to
aggregates normally and in the windowing context. However...
SELECT count(DISTINCT i) FROM (VALUES (1),(2),(3),(1)) AS s(i);count
------- 3
(1 row)
SELECT count(DISTINCT i) OVER () FROM (VALUES (1),(2),(3),(1)) AS s(i);
ERROR: DISTINCT is not implemented for window functions
LINE 1: SELECT count(DISTINCT i) OVER () FROM (VALUES (1),(2),(3),(1... ^
I see the error set up in src/backend/parser/parse_func.c, but no real
reasoning why.
Anyhow, I think it's a bug and needs back-patching.
Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate