Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 10622632A78 for ; Fri, 16 Jul 2010 12:57:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 98959-06 for ; Fri, 16 Jul 2010 15:56:54 +0000 (UTC) X-Greylist: delayed 00:21:50.488695 by SQLgrey-1.7.6 Received: from mail.dhs-club.com (mail.dhs-club.com [208.69.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 8FF0F632A32 for ; Fri, 16 Jul 2010 12:56:54 -0300 (ADT) Received: from [192.168.0.3] (hq.clubshop.com [208.78.129.189]) (authenticated bits=0) by mail.dhs-club.com (8.13.1/8.13.1) with ESMTP id o6GFZ159003663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 16 Jul 2010 11:35:02 -0400 Message-ID: <4C407C23.8040506@dhs-club.com> Date: Fri, 16 Jul 2010 11:34:59 -0400 From: Bill MacArthur User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Weird sorting order Content-Type: multipart/mixed; boundary="------------020401090705090308060301" X-Scanned-By: MIMEDefang 2.67 on 208.69.229.2 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-10 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/110 X-Sequence-Number: 35129 This is a multi-part message in MIME format. --------------020401090705090308060301 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 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 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-admin --------------020401090705090308060301 Content-Type: text/plain; name="SpamAssassinReport.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="SpamAssassinReport.txt" U3BhbSBkZXRlY3Rpb24gc29mdHdhcmUsIHJ1bm5pbmcgb24gdGhlIHN5c3RlbSAibWFpbC5k aHMtY2x1Yi5jb20iLCBoYXMNCmlkZW50aWZpZWQgdGhpcyBpbmNvbWluZyBlbWFpbCBhcyBw b3NzaWJsZSBzcGFtLiAgVGhlIG9yaWdpbmFsIG1lc3NhZ2UNCmhhcyBiZWVuIGF0dGFjaGVk IHRvIHRoaXMgc28geW91IGNhbiB2aWV3IGl0IChpZiBpdCBpc24ndCBzcGFtKSBvciBsYWJl bA0Kc2ltaWxhciBmdXR1cmU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