From: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
---|---|
To: | Marc Mamin <M(dot)Mamin(at)intershop(dot)de> |
Cc: | Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: select count(*); |
Date: | 2015-06-11 14:30:25 |
Message-ID: | CA+bJJbxtLorjbHpobQBYWPSKhf0acjRiSaG5W55Ts7RBFYSYAQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Marc:
On Thu, Jun 11, 2015 at 4:17 PM, Marc Mamin <M(dot)Mamin(at)intershop(dot)de> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2015-06-11 14:30:33 | Re: select count(*); |
Previous Message | Charles Clavadetscher | 2015-06-11 14:27:44 | Re: Prevent roles not having admin option from granting themselves to other roles |