Re: Why lower's not accept an AS declaration ? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why lower's not accept an AS declaration ?
Date
Msg-id 14956.1061253898@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why lower's not accept an AS declaration ?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: Why lower's not accept an AS declaration ?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
Stephan Szabo <sszabo@megazone.bigpanda.com> writes:
> Okay, I think many of the random restrictions (in 2a, the grouping,
> distinct, set function spec) are to stop you from doing things like:

>  select distinct a from table order by b;
>  select a,min(b) from table group by a order by c;
>  select count(*) from table order by a;

> All of which seem badly defined to me

Agreed, but restrictions on those grounds should be identical to the
restrictions on what you can write in a SELECT-list item.  AFAICT the
restrictions actually cited here are quite different.

> The whole definition of simple table query seems to boil down to the fact
> that the query expression must be a query specification (which would
> appear to kill UNION/INTERSECT/EXCEPT, which makes sense since input
> column names aren't necessarily meaningful in that case).

Right, you could only use output column names for an ORDER BY on a
UNION/etc.  We have that restriction already.  But is that really all
they're saying here?

            regards, tom lane

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: 3 way outer join dilemma
Next
From: Jeffrey Melloy
Date:
Subject: 'now' vs now() performance