Search Postgresql Archives

Re: select count(*);

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

 



Hi Marc:

On Thu, Jun 11, 2015 at 4:17 PM, Marc Mamin <M.Mamin@xxxxxxxxxxxx> wrote:
>>But COUNT(*)
>>does have meaning - it means "the number of rows".
> which rows? :-)

Well, docs could use a little polish there, as the select page says """

Compatibility

Of course, the SELECT statement is compatible with the SQL standard.
But there are some extensions and some missing features.

Omitted FROM Clauses

PostgreSQL allows one to omit the FROM clause. It has a
straightforward use to compute the results of simple expressions:

SELECT 2+2;

 ?column?
----------
        4

Some other SQL databases cannot do this except by introducing a dummy
one-row table from which to do the SELECT.
""""

Old time users have grown used to use it without questioning, and I
think it's sometimes needed to call functions, but some words along
the "a magic one row zero columns table is used when it is omited",
which is what it seems to be done, would be nice.

And, as I said, * only means the columns in a select, I think on no
from Pg may be generating a fake one row table to satisfy the
requirements ( maybe not, but is one easy way to make this work given
how select is explained to work in the docs ).

Francisco Olarte.


-- 
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