Re: select count(*);

From: Marc Mamin <M(dot)Mamin(at)intershop(dot)de>
To: "'Adrian Klaver'" <adrian(dot)klaver(at)aklaver(dot)com>, "'Geoff Winkless'" <pgsqladmin(at)geoff(dot)dj>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: select count(*);
Date: 2015-06-11 14:41:59
Message-ID: B6F6FD62F2624C4C9916AC0175D56D8828BE8045@jenmbs01.ad.intershop.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: Adrian Klaver [mailto:adrian(dot)klaver(at)aklaver(dot)com]
> Sent: Donnerstag, 11. Juni 2015 16:31
> To: Marc Mamin; 'Geoff Winkless'; Postgres General
> Subject: Re: [GENERAL] 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Asma Riyaz 2015-06-11 14:46:56 Re: GCC error and libmpfr.so.4 not found
Previous Message Geoff Winkless 2015-06-11 14:39:59 Re: select count(*);