From: Bill MacArthur <webmaster@dhs-club.com>
To: pgsql-admin@postgresql.org
Subject: Re: Weird sorting order
Date: Fri, 16 Jul 2010 11:34:59 -0400
Message-ID: <4C407C23.8040506@dhs-club.com> (raw)
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.voinea@topex.ro>
Organization: Topex
To: pgsql-admin@postgresql.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
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-adminAttachments:SpamAssassinReport.txt (text/plain, 974B) download
Spam detection software, running on the system "mail.dhs-club.com", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email. If you have any questions, see
postmaster@dhs-club.com for details.
Content preview: Hi... I have the following table: CREATE TABLE test ( id SERIAL
PRIMARY KEY, val VARCHAR(32) NOT NULL ); [...]
Content analysis details: (2.0 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.6 RCVD_IN_SORBS_WEB RBL: SORBS: sender is a abuseable web server
[89.38.174.194 listed in dnsbl.sorbs.net]
0.0 BAYES_50 BODY: Bayesian spam probability is 40 to 60%
[score: 0.5015]
1.4 AWL AWL: From: address is in the auto white-list
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: webmaster@dhs-club.com
Subject: Re: Weird sorting order
In-Reply-To: <4C407C23.8040506@dhs-club.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