Search Postgresql Archives

Re: select count(*);

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Adrian Klaver [mailto:adrian.klaver@xxxxxxxxxxx]
> Sent: Donnerstag, 11. Juni 2015 16:31
> To: Marc Mamin; 'Geoff Winkless'; Postgres General
> Subject: Re:  select count(*);
> 
> On 06/11/2015 07:17 AM, Marc Mamin wrote:
> >>> That's the point. * has no meaning without FROM
> >
> >
> >> But COUNT(*)
> >>
> >> does have meaning - it means "the number of rows".
> >
> > which rows? :-)
> 
> To follow up on the post from Chris Mair:
> 
> test=> select count(*), 'foo';
>   count | ?column?
> -------+----------
>       1 | foo


Fine, This explains why the result must be 1 :)

Marc

> 
> See also:
> 
> http://www.postgresql.org/docs/9.4/interactive/functions-aggregate.html
> 
> 
> count(*) 	  	bigint 	number of input rows
> >
> >> It's not counting the number of columns in the row, so postgres
> doesn't need to know what columns exist in the row to return a row
> count.
> >
> >> Geoff
> >
> >
> 
> 
> --
> Adrian Klaver
> adrian.klaver@xxxxxxxxxxx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux