From: | Bill MacArthur <webmaster(at)dhs-club(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Weird sorting order |
Date: | 2010-07-16 15:34:59 |
Message-ID: | 4C407C23.8040506@dhs-club.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
It's ignoring the hash marks. It's like they are invisible characters.
Tested on 8.1.16
-------- Original Message --------
Subject: [ADMIN] Weird sorting order
Date: Fri, 16 Jul 2010 15:14:09 +0300
From: Robert Voinea <robert(dot)voinea(at)topex(dot)ro>
Organization: Topex
To: pgsql-admin(at)postgresql(dot)org
Hi...
I have the following table:
CREATE TABLE test
(
id SERIAL PRIMARY KEY,
val VARCHAR(32) NOT NULL
);
INSERT INTO test VALUES
(DEFAULT, '##34''),
(DEFAULT, '##32'),
(DEFAULT, '##31'),
(DEFAULT, '2ff'),
(DEFAULT, '##26'),
(DEFAULT, '2##33'),
(DEFAULT, '2##25'),
(DEFAULT, '2##24'),
(DEFAULT, '2##23'),
(DEFAULT, '211'),
(DEFAULT, '210'),
(DEFAULT, '203'),
(DEFAULT, '202'),
(DEFAULT, '201'),
(DEFAULT, '200');
Why is it that when running the query:
SELECT * FROM test ORDER BY val;
I get the following result?
id | val
----+-------
1 | 200
2 | 201
3 | 202
4 | 203
5 | 210
6 | 211
7 | 2##23
8 | 2##24
9 | 2##25
10 | 2##33
11 | ##26
12 | 2ff
13 | ##31
14 | ##32
15 | ##34
(15 rows)
Shouldn't value '2ff' be placed right after '211' but before '2##23'?
Tested on PostgreSQL 8.2, 8.4, Linux SuSE & Kubuntu.
Thank you!...
--
Robert Voinea <robert (dot) voinea (at) topex (dot) ro>
Software Developer
Phone: +40 21 408 38 00 / ext. 343
Fax: +40 21 408 38 08
Local time: GMT+2
http://www.topex.ro
Attachment | Content-Type | Size |
---|---|---|
SpamAssassinReport.txt | text/plain | 973 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2010-07-16 15:48:12 | Re: conditional backup |
Previous Message | Kevin Grittner | 2010-07-16 15:34:06 | Re: Weird sorting order |