pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alex Guryanow <gav@nlr.ru>
To: pgsql-sql@postgresql.org
Subject: strange ORDER BY implementation
Date: Thu, 18 May 2000 13:26:44 +0400
Message-ID: <4560.000518@nlr.ru> (raw)

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





Message-ID: <4560.000518@nlr.ru>
Permalink:  ../4560.000518@nlr.ru/
Also on:    postgresql.org/message-id/4560.000518@nlr.ru

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gav@nlr.ru
  Subject: Re: strange ORDER BY implementation
  In-Reply-To: <4560.000518@nlr.ru>
  References: <4560.000518@nlr.ru>

* 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