Re: SQL feature requests

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Glaesemann <grzm(at)seespotcode(dot)net>, Ben Tilly <btilly(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQL feature requests
Date: 2007-08-23 17:38:10
Message-ID: 20070823173810.GC31461@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark escribió:

> I get this about once a day because I frequently type this ad-hoc query and
> always forget to put the alias in the first time:
>
> postgres=# select count(*),n from (select count(*) as n from test group by i) group by n;
> ERROR: subquery in FROM must have an alias
> HINT: For example, FROM (SELECT ...) [AS] foo.

Exactly one extra keystroke gets you a non-error answer:

alvherre=# select count(*),n from (select count(*) as n from test group by i)a group by n;

--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"Si quieres ser creativo, aprende el arte de perder el tiempo"

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-08-23 17:38:30 Re: [COMMITTERS] pgsql: Add configure option --with-system-tzdata to use operating system
Previous Message Alvaro Herrera 2007-08-23 17:35:11 Re: [COMMITTERS] pgsql: Add configure option --with-system-tzdata to use operating system