From: Stu <stu@santa-li.com>
To: pgsql-sql@postgresql.org
Subject: Re: Sorting problem
Date: Tue, 13 Jul 2004 06:54:44 -0400
Message-ID: <BLGdnano8-joIm7dRVn-vg@comcast.com> (raw)
References: <3610e3e1.0407120027.2e04f948@posting.google.com>
Pop text in front of that first value and it works:
template1=# select text '##10############--------####79909999'
template1=# as "sortfield"
template1-# union
template1-# select '###1############--------####79909999'
template1-# order by sortfield;
sortfield
--------------------------------------
###1############--------####79909999
##10############--------####79909999
(2 rows)
Stu
Ruggero wrote:
> 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
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: stu@santa-li.com
Subject: Re: Sorting problem
In-Reply-To: <BLGdnano8-joIm7dRVn-vg@comcast.com>
* 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