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 19901.1061266808@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why lower's not accept an AS declaration ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Why lower's not accept an AS declaration ?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
I said:
> After reading over the spec again I finally realized the significance of
> this bit:

>               i) Let X be any <column reference> directly contained in K(i).
>              ii) If X does not contain an explicit <table or query name> or
>                  <correlation name>, then K(i) shall be a <column name> that
>                  shall be equivalent to the name of exactly one column of
>                  ST.

Wait a second ... this is a classic case of reading what you expected
rather than what's there.  I thought that (ii) said "If X does not ...
then X shall be ..." but that's not what it says --- the "then" says
that the whole sort-key K(i) must be an output-column name.

In other words, SQL99 does not allow expressions over output-column
names.  An output-column reference can only appear as a simple name
(same as SQL92, and same as what we allow).  SQL99 allows expressions
over input-column names ... but only if the expressions use
fully-qualified input-column names.

This last is such a stupid restriction that I can't believe I'm reading
it right; is it just too late at night for me?

If I am reading it right, then we already support every case that is
legal per SQL99, and more besides.

            regards, tom lane

pgsql-general by date:

Previous
From: Dustin Sallings
Date:
Subject: Re: Simulating sequences
Next
From: Dustin Sallings
Date:
Subject: Re: Example Database