Re: BUG #12603: Results Ordering not correct - Mailing list pgsql-bugs

From David G Johnston
Subject Re: BUG #12603: Results Ordering not correct
Date
Msg-id 1421774831530-5834765.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #12603: Results Ordering not correct  (Guillaume Lelarge <guillaume@lelarge.info>)
List pgsql-bugs
Guillaume Lelarge-3 wrote
>> SELECT DISTINCT businessunit AS bu_id,
>> '('||businessunit::TEXT||')'||businessunitname as businessunit FROM
> bug_test
>> ORDER BY businessunit;
>
> It is text. You renamed the second column businessunit.

To be more specific, the ORDER BY chooses an output column name before an
input column name.

http://www.postgresql.org/docs/9.1/static/sql-select.html

"Each expression can be the name or ordinal number of an output column
(SELECT list item), or it can be an arbitrary expression formed from
input-column values."

David J.



--
View this message in context:
http://postgresql.nabble.com/BUG-12603-Results-Ordering-not-correct-tp5834749p5834765.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

pgsql-bugs by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: BUG #12603: Results Ordering not correct
Next
From: Asif Naeem
Date:
Subject: Re: pg_upgrade failure on Windows Server