Bug in aggregates in windowing context - Mailing list pgsql-hackers

From David Fetter
Subject Bug in aggregates in windowing context
Date
Msg-id 20090909222419.GA20190@fetter.org
Whole thread Raw
Responses Re: Bug in aggregates in windowing context
Re: Bug in aggregates in windowing context
List 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@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


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: [PATCH] plpythonu datatype conversion improvements
Next
From: Dimitri Fontaine
Date:
Subject: Re: RfD: more powerful "any" types