pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Ruggero <ruggero.maria.rossi@libero.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sorting problem
Date: Fri, 16 Jul 2004 12:14:38 -0700 (PDT)
Message-ID: <20040716120950.J75128@megazone.bigpanda.com> (raw)
In-Reply-To: <3610e3e1.0407120027.2e04f948@posting.google.com>
References: <3610e3e1.0407120027.2e04f948@posting.google.com>

On Mon, 12 Jul 2004, 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?

it_IT looks like it's sorting based on the strings with the symbols
removed.  I get similar behavior on my system using the unix sort command
with it_IT.  This looks like it's a mismatch between what you want and the
collation you've provided.




view thread (8+ messages)

Message-ID: <20040716120950.J75128@megazone.bigpanda.com>
Permalink:  ../20040716120950.J75128@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040716120950.J75128@megazone.bigpanda.com

 · 

reply

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: sszabo@megazone.bigpanda.com, ruggero.maria.rossi@libero.it
  Subject: Re: Sorting problem
  In-Reply-To: <20040716120950.J75128@megazone.bigpanda.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