Re: BUG #4030: Inconsistency: ORDER BY clauses involving column aliases - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4030: Inconsistency: ORDER BY clauses involving column aliases
Date
Msg-id 17223.1205505729@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4030: Inconsistency: ORDER BY clauses involving column aliases  ("Dave Gurnell" <d.j.gurnell@gmail.com>)
List pgsql-bugs
"Dave Gurnell" <d.j.gurnell@gmail.com> writes:
> Run a query ordered on an expression involving these aliases:

>     test=# select x.a as xa, x.b as xb, x.c as xc from numbers as x order by
> (xa + xb + xc);
>     ERROR:  column "xa" does not exist
>     LINE 1: ... x.b as xb, x.c as xc from numbers as x order by (xa + xb +
> ...

> Is this expected behaviour or is it a bug?

It's expected and documented.  No, it isn't very consistent :-(.
We're trying to support both the SQL92 and SQL99 approaches to ORDER BY,
and they're not the same.

            regards, tom lane

pgsql-bugs by date:

Previous
From: divya shree
Date:
Subject: Further problems
Next
From: "RGF"
Date:
Subject: BUG #4035: sql table aliases do not work