Bug in aggregates in windowing context

From: David Fetter <david(at)fetter(dot)org>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in aggregates in windowing context
Date: 2009-09-09 22:24:19
Message-ID: 20090909222419.GA20190@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2009-09-09 22:31:27 Re: RfD: more powerful "any" types
Previous Message Hannu Krosing 2009-09-09 21:45:35 Re: [PATCH] plpythonu datatype conversion improvements