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 <da...@fetter.org> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fet...@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers