Lists: | pgsql-hackers |
---|
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 |
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
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in aggregates in windowing context |
Date: | 2009-09-09 22:35:05 |
Message-ID: | 8949.1252535705@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
David Fetter <david(at)fetter(dot)org> writes:
> SELECT count(DISTINCT i) OVER () FROM (VALUES (1),(2),(3),(1)) AS s(i);
> ERROR: DISTINCT is not implemented for window functions
Which part of that message isn't clear to you?
> Anyhow, I think it's a bug and needs back-patching.
"Not implemented" is not a bug. Nice try though.
regards, tom lane
From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in aggregates in windowing context |
Date: | 2009-09-09 23:15:43 |
Message-ID: | 20090909231543.GB20190@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Sep 09, 2009 at 06:35:05PM -0400, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> writes:
> > SELECT count(DISTINCT i) OVER () FROM (VALUES (1),(2),(3),(1)) AS s(i);
> > ERROR: DISTINCT is not implemented for window functions
>
> Which part of that message isn't clear to you?
A bug that's documented in the source code is still a bug.
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
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in aggregates in windowing context |
Date: | 2009-09-09 23:30:18 |
Message-ID: | 9990.1252539018@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
David Fetter <david(at)fetter(dot)org> writes:
> A bug that's documented in the source code is still a bug.
Sorry, but we are not going to define every unimplemented feature in
SQL:2008 as being a back-patchable bug fix candidate. As for the "it's
not documented" argument, I direct you to section 4.2.8, which is pretty
explicit about what the allowed syntax is. (And btw, I'm equally
uninterested in the other omissions in that compared to SQL:2008.
We did what we could for 8.4.)
regards, tom lane
From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in aggregates in windowing context |
Date: | 2009-09-10 00:45:06 |
Message-ID: | 603c8f070909091745j67fae33fjea2b2acb12018935@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Sep 9, 2009 at 6:24 PM, David Fetter<david(at)fetter(dot)org> wrote:
> Anyhow, I think it's a bug and needs back-patching.
I suspect if it were as easy as removing the error test it would have
been done already. Perhaps you'd care to submit a patch?
...Robert
From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in aggregates in windowing context |
Date: | 2009-09-10 00:46:07 |
Message-ID: | 20090910004607.GC20190@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Sep 09, 2009 at 08:45:06PM -0400, Robert Haas wrote:
> On Wed, Sep 9, 2009 at 6:24 PM, David Fetter<david(at)fetter(dot)org> wrote:
> > Anyhow, I think it's a bug and needs back-patching.
>
> I suspect if it were as easy as removing the error test it would
> have been done already. Perhaps you'd care to submit a patch?
Working on that at the moment :)
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