pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David G Johnston <david.g.johnston@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #12603: Results Ordering not correct
Date: Tue, 20 Jan 2015 10:27:11 -0700 (MST)
Message-ID: <1421774831530-5834765.post@n5.nabble.com> (raw)
In-Reply-To: <CAECtzeUhERY-tQLtCKmM39Pwy4wmcFckA0wySYuLTuU=e3nOTA@mail.gmail.com>
References: <20150119235837.5765.61481@wrigleys.postgresql.org>
	<CAECtzeUhERY-tQLtCKmM39Pwy4wmcFckA0wySYuLTuU=e3nOTA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)

Message-ID: <1421774831530-5834765.post@n5.nabble.com>
Permalink:  ../1421774831530-5834765.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1421774831530-5834765.post@n5.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: david.g.johnston@gmail.com
  Subject: Re: BUG #12603: Results Ordering not correct
  In-Reply-To: <1421774831530-5834765.post@n5.nabble.com>
  References: <20150119235837.5765.61481@wrigleys.postgresql.org> <CAECtzeUhERY-tQLtCKmM39Pwy4wmcFckA0wySYuLTuU=e3nOTA@mail.gmail.com> <1421774831530-5834765.post@n5.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox