Re: sort order with < & > in varchar fields

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rolf Johansson <rojo(at)nocrew(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: sort order with < & > in varchar fields
Date: 2001-01-17 15:28:15
Message-ID: 16929.979745295@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rolf Johansson <rojo(at)nocrew(dot)org> writes:
> Is there documentation on how >= and <= works with varchar
> fields? Does pg count in the "," character or ignore it?

That depends. If you compiled with --enable-locale then it's
whatever strcoll() says for the locale you are running the
postmaster in. If not, it's whatever strcmp() says, which is
normally plain ASCII collation order.

Note: beware of changing the postmaster's locale on the fly;
this can leave your indexes on textual columns out of order and
hence effectively corrupt. You can fix that by dropping/rebuilding
such indexes, or with REINDEX.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mikael Hedin 2001-01-17 15:51:34 problem to count (distinct number)
Previous Message Rolf Johansson 2001-01-17 13:39:46 sort order with < & > in varchar fields