varchar sort ordering ignore blanks

Поиск
Список
Период
Сортировка
От Luca Arzeni
Тема varchar sort ordering ignore blanks
Дата
Msg-id 200801151819.05440.l.arzeni@amadego.com
обсуждение исходный текст
Ответы Re: varchar sort ordering ignore blanks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi there,
I have a table with a single column, pk of varchar type

The table contains few names, say:

XXXX A
XXXX C
XXXXB

In the first two records there is a between the XXXX and the following letter
A and C  while, the third one has a B immediately following the XXXX (without
blanks).

In postgres 7.4.7 (debian sarge), if I issue a select to sort the record I
(correctly) obtain:
XXXX A
XXXX C
XXXXB

In postgres 8.1.9 (debian etch), if I issue a select to sort the record I
(mistakenly) obtain:
XXXX A
XXXXB
XXXX C

That is: the sort order in postgres 8.1.9 seems to ignore the blank.

In all cases I'm using locale LATIN9 during DB creation, but I tested also
with ASCII, UTF8 and LATIN1 encoding.

Can someone help me to get the correct order in postgres 8.1.9 ?

=== Sample code  ===

CREATE TABLE t_table
(
  c_column varchar(30) NOT NULL,
  CONSTRAINT t_table_pk PRIMARY KEY (c_column)
)
WITHOUT OIDS;

INSERT INTO t_table(c_column) VALUES ('XXXX A');
INSERT INTO t_table(c_column) VALUES ('XXXXB');
INSERT INTO t_table(c_column) VALUES ('XXXX C');

select * from t_table order by c_column asc;

=============

Thanks, Luca Arzeni


В списке pgsql-general по дате отправления:

Предыдущее
От: "blackwater dev"
Дата:
Сообщение: bulk copy
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Segmentation fault with 8.3 FTS ISpell