Sorting problem

From: ruggero(dot)maria(dot)rossi(at)libero(dot)it (Ruggero)
To: pgsql-sql(at)postgresql(dot)org
Subject: Sorting problem
Date: 2004-07-12 08:27:53
Message-ID: 3610e3e1.0407120027.2e04f948@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,
I have a problem sorting varchar fields.
I will explain the problem with a simple example:

this query
select '##10' as sortfield
union
select '###1' as sortfield
order by sortfield
produces this correct output:
'###1'
'##10'

but this one

select '##10############--------####79909999' as sortfield
union
select '###1############--------####79909999' as sortfield
order by sortfield
produces this wrong output:
'##10############--------####79909999'
'###1############--------####79909999'

I'm using postgresql 7.4.3 on Suse Linux 9.1.
I created my db using: initdb --pgdata=../data/ --encoding=LATIN1
--lc-collate=it_IT --lc-ctype=it_IT

Any suggestion?
Tia
Ruggero

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2004-07-12 08:46:06 Comparing tsearch2 vectors.
Previous Message Theodore Petrosky 2004-07-11 18:52:16 Re: please help me with text cast to int ....