Marc Mamin <M.Mamin@intershop.de> writes:
>> The * might be a bit tricky, though,
>> since 'select *;' doesn't work.
> That's the point. * has no meaning without FROM
PG regards "count(*)" as a weird spelling of "count()", ie, invoke an
aggregate that takes no arguments. It really doesn't have anything to do
with the meaning of "*" as a SELECT-list item, any more than it does with
the meaning of "*" as multiplication, say. It's just syntax that's
written like that because the SQL standard says we have to.
Another way of making the point is that SELECT without a FROM list can
be seen as implicitly selecting from a dummy table with one row and no
columns. Some other systems such as Oracle make you do that explicitly,
ie the infamous "FROM dual" hack; there's nothing in the SQL standard
saying you can omit FROM. If you suppose that that's the underlying model
then the result of "select count(*)" is completely natural.
regards, tom lane