Re: Select count(*) /*from*/ table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Shulgin <alex(dot)shulgin(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Select count(*) /*from*/ table
Date: 2011-07-05 16:25:57
Message-ID: 19739.1309883157@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexander Shulgin <alex(dot)shulgin(at)gmail(dot)com> writes:
> I understand that there's really not much point in running COUNT w/o
> the FROM list, but maybe we should just disallow COUNT(*) with empty
> FROM list?

While I don't offhand see a use case for aggregates without FROM,
it's a long way from there to asserting that there is no use case.

The real foot-gun here IMO is the ability to omit "AS", which
unfortunately we're kind of stuck with because it's in the SQL standard.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2011-07-05 16:28:51 Re: Read MS-SQL data into Postgres via ODBC link?
Previous Message Francisco Figueiredo Jr. 2011-07-05 15:14:12 Re: Pgfoundry problem with Npgsql bug tracker