Обсуждение: Solved: SQL Query Problem

Поиск
Список
Период
Сортировка

Solved: SQL Query Problem

От
Kristian Lance
Дата:
This message is a follow up to this thread:

http://archives.postgresql.org/pgsql-bugs/2001-12/msg00008.php

I finally got a chance to rebuild the DB server using C locale, and it made
no difference to my ORDER BY problem.  PostgreSQL did not distinguish
between slashes, dashes, and spaces when sorting the records.

Then, in a last-ditch attempt to try anything to get this working, I
recreated my table and changed the data type of my path column from varchar
to "bytea" (never used that one before) because I suspected that it would
sort using a binary string comparison instead of a language-oriented
one.  It worked!!!  Here's the output:

/usr/local/data/x/a
/usr/local/data/x/b
/usr/local/data/x/d
/usr/local/data/xc
/usr/local/data/xc/e

Thanks to Tom and Stephan for their feedback.  However, the problem was not
related to the locale settings.



Kristian T. Lance
Database Application Developer (IS/Web)

Client Support Services
Information Networks and Systems

Communications Research Centre Canada
3701 Carling Avenue
Ottawa, Ontario
Canada K2H 8S2

Tel.: (613) 991-6812
Fax: (613) 991-5795

http://www.crc.ca

The Communications Research Centre Canada
is an agency of Industry Canada.

http://www.ic.gc.ca

Re: Solved: SQL Query Problem

От
Tom Lane
Дата:
Kristian Lance <kristian.lance@crc.ca> writes:
> This message is a follow up to this thread:
> http://archives.postgresql.org/pgsql-bugs/2001-12/msg00008.php

> I finally got a chance to rebuild the DB server using C locale, and it made
> no difference to my ORDER BY problem.  PostgreSQL did not distinguish
> between slashes, dashes, and spaces when sorting the records.

I don't believe you did it right then :-(.  That sure sounds like a
locale-driven behavior.  Try examining the pg_control file with
contrib/pg_controldata to confirm for certain what the collation is.

            regards, tom lane