strange ORDER BY implementation

From: Alex Guryanow <gav(at)nlr(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: strange ORDER BY implementation
Date: 2000-05-18 09:26:44
Message-ID: 4560.000518@nlr.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message christine 2000-05-18 09:35:55 translate from oracle
Previous Message christine 2000-05-18 09:21:01 Translaye from Oracle