dbTalk Databases Forums  

[BUGS] Table name used as aggregate argument

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Table name used as aggregate argument in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dennis Bjorklund
 
Posts: n/a

Default [BUGS] Table name used as aggregate argument - 02-07-2005 , 09:52 AM






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?

--
/Dennis Björklund


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Table name used as aggregate argument - 02-07-2005 , 10:17 AM






Dennis Bjorklund <db (AT) zigo (DOT) dhs.org> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.