Re: count (DISTINCT expression [ , ... ] ) and documentation - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject Re: count (DISTINCT expression [ , ... ] ) and documentation
Date
Msg-id 20081226160600.275674fa@dawn.webthatworks.it
Whole thread Raw
In response to Re: count (DISTINCT expression [ , ... ] ) and documentation  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Responses Re: count (DISTINCT expression [ , ... ] ) and documentation
List pgsql-general
On Fri, 26 Dec 2008 15:46:48 +0100
"Pavel Stehule" <pavel.stehule@gmail.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])

Does the change reflect the change in the possibility to write user
defined aggregates that support more then one distinct expression?

The first thing that comes to my mind to emulate
count(distinct a,b)
would be to

create table test.dist (a int, b int);
insert into test.dist values(1,0);
insert into test.dist values(1,0);
insert into test.dist values(1,1);
insert into test.dist values(0,0);
select count(*) from (select distinct a,b from test.dist ) a;

but still I can't think of anything that would work with
aggregate(distinct a,b)
not just count.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


pgsql-general by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: count (DISTINCT expression [ , ... ] ) and documentation
Next
From: "Pavel Stehule"
Date:
Subject: Re: count (DISTINCT expression [ , ... ] ) and documentation