Re: Table name used as aggregate argument - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Table name used as aggregate argument
Date
Msg-id 27395.1107792687@sss.pgh.pa.us
Whole thread Raw
In response to Table name used as aggregate argument  (Dennis Bjorklund <db@zigo.dhs.org>)
List pgsql-bugs
Dennis Bjorklund <db@zigo.dhs.org> writes:
> How come this work in pg (8.0 and older):
>   CREATE TABLE bug (x int);
>   SELECT count(bug) FROM bug;

> Shouldn't it complain and say that "bug" is not a column?

No.  This is a perfectly good, if somewhat historical, spelling of

    SELECT count(bug.*) FROM bug;

Since count() takes any data type at all, a record type is just as
good as anything else...

            regards, tom lane

pgsql-bugs by date:

Previous
From: Dennis Bjorklund
Date:
Subject: Table name used as aggregate argument
Next
From: Michael Guerin
Date:
Subject: ERROR: cache lookup failed for relation 17442 (repost)