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 14:46:48
Message-ID: 162867790812260646j70a187f4i37d9152503d27615@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

count has only one argument,

try:

postgres=# select * from fooa;
a | b
----+----
10 | 20
(1 row)

postgres=# select count(distinct a,b) from fooa;
ERROR: function count(integer, integer) does not exist
LINE 1: select count(distinct a,b) from fooa;
^
HINT: No function matches the given name and argument types. You
might need to add explicit type casts.
postgres=# select count(distinct (a,b)) from fooa;
count
-------
1
(1 row)

regards
Pavel Stehule

2008/12/26 Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>:
> I noticed that starting from 8.2 the documentation at
> http://www.postgresql.org/docs/8.2/interactive/sql-expressions.html
> say that multiple distinct expressions are supported
>
> aggregate_name (DISTINCT expression [, expression] )
>
> While previous docs just listed one:
>
> aggregate_name (DISTINCT expression)
>
> Still I'm using 8.3 and
>
> select count(distinct c1, c2) from table1;
>
> report:
>
> No function matches the given name and argument types. You might
> need to add explicit type casts.
>
> What should I write in spite of?
>
> select count(distinct c1, c2) from table1;
>
> --
> 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-12-26 15:06:00 Re: count (DISTINCT expression [ , ... ] ) and documentation
Previous Message Ivan Sergio Borgonovo 2008-12-26 14:34:33 count (DISTINCT expression [ , ... ] ) and documentation