Received: from double.nlr.ru (double.nlr.ru [212.193.3.3]) by hub.org (8.9.3/8.9.3) with ESMTP id FAA46510 for ; Thu, 18 May 2000 05:26:55 -0400 (EDT) (envelope-from gav@nlr.ru) Received: from GURYANOW ([172.16.2.2]) by double.nlr.ru (8.9.3/8.9.3) with ESMTP id NAA15527 for ; Thu, 18 May 2000 13:26:45 +0400 Date: Thu, 18 May 2000 13:26:44 +0400 From: Alex Guryanow X-Mailer: The Bat! (v1.34a) UNREG / CD5BF9353B3B7091 Reply-To: gav X-Priority: 3 (Normal) Message-ID: <4560.000518@nlr.ru> To: pgsql-sql@postgresql.org Subject: strange ORDER BY implementation Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit X-Archive-Number: 200005/44 Hi, I use Postgresql 7.0 on RedHat 6.1 . Postgres was configured with locale support and started using the following command su postgres -c 'LC_CTYPE=ru_RU.cp1251; LC_COLLATE=ru_RU.cp1251; export LC_CTYPE LC_COLLATE; \ /postgress/pgsql/bin/postmaster -i -D/postgress/pgsql/data > /postgress/pm.log 2>&1 &' It seems that localisation works fine (at least function lower()). I have a table bookmarks with field label: CREATE TABLE bookmarks (id serial, label varchar(250)); But when I use in my SELECT-query ORDER BY clause I receive strange results - not all lines are sorted. Here is an example (sorry, it's in russian): SELECT id, label FROM bookmarks WHERE id=51463 OR id=50102 OR id=51466 OR id=50103 OR id=51474 ORDER BY label; id | label -------+----------------------------------------------------------------- 50102 | Иванов А. А. Акушер. Д-р мед. наук 51463 | Иванова А. В. Канд. мед. наук 51466 | Иванова А. И. Канд. техн. наук 50103 | Иванов А. А. Канд. геол.-мин. наук (Вятская зона) 51474 | Иванова Александра Михайловна Педагог-методист, канд. пед. наук (5 rows) For people that do not have russian support in the e-mail client or do not speak russian here is the hexadecimal representation of the above lines maded by PHP3 function bin2hex: | 1 2 3 4 5 6 7 8 9 10 11 ------------------------------------- 1 | c8 e2 e0 ed ee e2 20 c0 2e 20 c0 2 | c8 e2 e0 ed ee e2 e0 20 c0 2e 20 3 | c8 e2 e0 ed ee e2 e0 20 c0 2e 20 4 | c8 e2 e0 ed ee e2 20 c0 2e 20 c0 5 | c8 e2 e0 ed ee e2 e0 20 c0 eb e5 ^^ The error is after 6th symbol: the line number 4 should be after 1st line and not after 3rd. Why this happens? Best regards, Alex