Re: select count(*);

From: Chris Mair <chris(at)1006(dot)org>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: select count(*);
Date: 2015-06-11 13:56:24
Message-ID: 544af1b38f98fe02604349075f00af88@smtp.hushmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> select *;
> ----------
> ERROR: SELECT * with no tables specified is not valid
>
> select count(*);
> ----------------
> 1
>
> Is this a must? and why 1?

Hi,

regarding the "why 1" part:

I think that if we accept that

chris=> select 'foo';
?column?
----------
foo
(1 row)

returns 1 row, then naturally

chris=> select count('foo');
count
-------
1
(1 row)

should give a count of 1...

The * might be a bit tricky, though,
since 'select *;' doesn't work.

Bye,
Chris.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message asmariyaz23 2015-06-11 14:00:37 Installing Postgres manually GCC error and libmpfr.so.4 not found
Previous Message Marc Mamin 2015-06-11 13:46:10 select count(*);