lc_collate issue

From: Cody Pisto <cpisto(at)rvweb(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: lc_collate issue
Date: 2007-08-24 17:35:53
Message-ID: 46CF16F9.5020807@rvweb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I'm looking for any kind of a reason (and potential workarounds), be it
bug or otherwise, why the following two queries produce different
results under a database encoding of UTF8 and lc_collate of en_US.UTF-8:

SELECT x FROM (SELECT 'Something else' AS x UNION SELECT '-SOMETHING
ELSE-' AS x UNION SELECT 'Somethang' AS x) y ORDER BY LOWER(x)

x
------------------
Somethang
-SOMETHING ELSE-
Something else
(3 rows)

*AND*

SELECT x FROM (SELECT 'Somethingelse' AS x UNION SELECT
'-SOMETHINGELSE-' AS x UNION SELECT 'Somethang' AS x) y ORDER BY LOWER(x)

x
-----------------
Somethang
Somethingelse
-SOMETHINGELSE-

The removal of spaces from the strings gives "more correct" sorting
results, with the spaces and '-' characters, '-SOMETHING ELSE-' is
strangely sorted in the middle?
It does not matter if you use LOWER or UPPER, and the "problem" does not
occur on databases with encoding SQL_ASCII and lc_collate of C

I have tested this on Postgres 8.1.9, 8.2, 8.2.4 with database encoding
of UTF8 and lc_collate of en_US.UTF8
and on 7.4.16 with database encoding of SQL_ASCII and lc_collate of C

Thank in advance for any consideration!

-Cody

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-08-24 17:50:37 Re: FATAL: could not reattach to shared memory (Win32)
Previous Message Shelby Cain 2007-08-24 17:28:33 Re: FATAL: could not reattach to shared memory (Win32)