From: aruggiero@codarex.com
To: pgsql-bugs@postgresql.org
Subject: BUG #12603: Results Ordering not correct
Date: Mon, 19 Jan 2015 23:58:37 +0000
Message-ID: <20150119235837.5765.61481@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 12603
Logged by: Antonio Ruggiero
Email address: aruggiero@codarex.com
PostgreSQL version: 9.2.9
Operating system: Windows 7 SP1
Description:
Summary: A field is Integer but results ordered as if it is text.
/* START */
DROP TABLE IF EXISTS bug_test;
create table Bug_test (businessunit integer, businessunitname character
varying(15));
INSERT INTO bug_test VALUES (10,'North');
INSERT INTO bug_test VALUES (20,'NorthEast');
INSERT INTO bug_test VALUES (100,'East');
INSERT INTO bug_test VALUES (110,'SouthEast');
INSERT INTO bug_test VALUES (2000,'South');
INSERT INTO bug_test VALUES (2100,'SouthWest');
INSERT INTO bug_test VALUES (10000,'West');
INSERT INTO bug_test VALUES (10100,'NorthWest');
SELECT DISTINCT businessunit AS bu_id,
'('||businessunit::TEXT||')'||businessunitname as businessunit FROM bug_test
ORDER BY businessunit;
/* Output */
/* --Notice results ordered as if businessunit is TEXT--
bu_id, businessunit
integer, text
10;'(10)North'
100;'(100)East'
10000;'(10000)West'
10100;'(10100)NorthWest'
110;'(110)SouthEast'
20;'(20)NorthEast'
2000;'(2000)South'
2100;'(2100)SouthWest'
*/
SELECT DISTINCT businessunit AS bu_id,
'('||businessunit::TEXT||')'||businessunitname as businessunit FROM bug_test
ORDER BY 1;
/* Output */
/* --Notice results ordered as if businessunit is INTEGER--
bu_id, businessunit
integer, text
10;'(10)North'
20;'(20)NorthEast'
100;'(100)East'
110;'(110)SouthEast'
2000;'(2000)South'
2100;'(2100)SouthWest'
10000;'(10000)West'
10100;'(10100)NorthWest'
*/
DROP TABLE IF EXISTS bug_test;
/* END */
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: aruggiero@codarex.com
Subject: Re: BUG #12603: Results Ordering not correct
In-Reply-To: <20150119235837.5765.61481@wrigleys.postgresql.org>
References: <20150119235837.5765.61481@wrigleys.postgresql.org>
* 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