X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6A414D1B28B for ; Mon, 12 Jul 2004 05:29:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96893-03 for ; Mon, 12 Jul 2004 08:29:27 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 05F94D1B266 for ; Mon, 12 Jul 2004 05:29:19 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i6C8TOi7026968 for ; Mon, 12 Jul 2004 08:29:24 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i6C8Rqf8026827 for pgsql-sql@postgresql.org; Mon, 12 Jul 2004 08:27:52 GMT From: ruggero.maria.rossi@libero.it (Ruggero) X-Newsgroups: comp.databases.postgresql.sql Subject: Sorting problem Date: 12 Jul 2004 01:27:53 -0700 Organization: http://groups.google.com Lines: 30 Message-ID: <3610e3e1.0407120027.2e04f948@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/100 X-Sequence-Number: 18352 Hi all, I have a problem sorting varchar fields. I will explain the problem with a simple example: this query select '##10' as sortfield union select '###1' as sortfield order by sortfield produces this correct output: '###1' '##10' but this one select '##10############--------####79909999' as sortfield union select '###1############--------####79909999' as sortfield order by sortfield produces this wrong output: '##10############--------####79909999' '###1############--------####79909999' I'm using postgresql 7.4.3 on Suse Linux 9.1. I created my db using: initdb --pgdata=../data/ --encoding=LATIN1 --lc-collate=it_IT --lc-ctype=it_IT Any suggestion? Tia Ruggero