Skip site navigation (1) Skip section navigation (2)

Re: count (DISTINCT expression [ , ... ] ) and documentation

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Ivan Sergio Borgonovo" <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: count (DISTINCT expression [ , ... ] ) and documentation
Date: 2008-12-26 18:47:06
Message-ID: 162867790812261047pbbbe725k2fe1bdef44f081c2@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
2008/12/26 Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>:
> On Fri, 26 Dec 2008 16:23:52 +0100
> "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> wrote:
>
>> 2008/12/26 Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>:
>> > On Fri, 26 Dec 2008 15:46:48 +0100
>> > "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> >
>> >> count has only one argument,
>> >
>> > then what was changed between 8.1 and 8.2 to change the docs?
>> > None of the functions listed in:
>> > http://www.postgresql.org/docs/8.2/static/functions-aggregate.html
>> > seems to support
>> > aggregate(distinct exp [,exp])
>>
>> http://www.postgresql.org/docs/8.2/interactive/functions-aggregate.html
>>
>> http://www.postgresql.org/docs/8.2/interactive/functions-aggregate.html#FUNCTIONS-AGGREGATE-STATISTICS-TABLE
>
>
> yeah but no function seems to support
>
> aggregate(distinct x, y)
>
>> CREATE AGGREGATE name ( input_data_type [ , ... ] ) (
>>     SFUNC = sfunc,
>>     STYPE = state_data_type
>>     [ , FINALFUNC = ffunc ]
>>     [ , INITCOND = initial_condition ]
>>     [ , SORTOP = sort_operator ]
>> )
>
>
> OK... but how am I going to implement an user defined aggregate that
> support without resorting to C?
>
> myaggfunc(distinct x, y)?
>
> Otherwise to what is it referring
>
> http://www.postgresql.org/docs/8.2/interactive/sql-expressions.html
>
> aggregate_name (DISTINCT expression [ , ... ] )
>

ok, I tested and it isn't supported yet. This is documentation bug.
DISTINCT is allowed only for single argument aggregate.

Regards
Pavel Stehule

> --
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

pgsql-general by date

Next:From: Ivan Sergio BorgonovoDate: 2008-12-26 19:03:30
Subject: Re: count (DISTINCT expression [ , ... ] ) and documentation
Previous:From: David FetterDate: 2008-12-26 18:43:25
Subject: Re: count (DISTINCT expression [ , ... ] ) anddocumentation

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group