Thread: lexicographical ordering in postgres

lexicographical ordering in postgres

From
Paramveer.Singh@trilogy.com
Date:
Hi!
I created a table in postgres with varchar values in it, and I noticed that
postgres lexicographical ordering is weird in the sense that it ignores
whitespaces.
please look at the result I got:

select * from tablename order by columnname;
            cloumnname
      -------------------------------------
            one 1
            one  1
            one 12
            one 2
            one 30
      (5 rows)
      This means that 'one<space>1' and 'one<space><space>1' are the same
lexicographically.
Is this correct?
thanks
paraM



Re: lexicographical ordering in postgres

From
Martijn van Oosterhout
Date:
Check your locale settings. The en_US locale sorts like that for
example...

On Thu, Sep 16, 2004 at 04:00:43AM -0500, Paramveer.Singh@trilogy.com wrote:
> Hi!
> I created a table in postgres with varchar values in it, and I noticed that
> postgres lexicographical ordering is weird in the sense that it ignores
> whitespaces.
> please look at the result I got:
>
> select * from tablename order by columnname;
>             cloumnname
>       -------------------------------------
>             one 1
>             one  1
>             one 12
>             one 2
>             one 30
>       (5 rows)
>       This means that 'one<space>1' and 'one<space><space>1' are the same
> lexicographically.
> Is this correct?
> thanks
> paraM
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment