pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Oliveiros C, <oliveiros.cristina@marktest.pt>
Cc: Adrian Klaver <aklaver@comcast.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to order varchar data by word
Date: Mon, 19 Oct 2009 13:32:49 -0400
Message-ID: <8017.1255973569@sss.pgh.pa.us> (raw)
In-Reply-To: <EDA0AFB36F144EE38143CCE0734312E0@marktestcr.marktest.pt>
References: <6caee9520910140240u13daba93ua20637642727776e@mail.gmail.com>
	<b4399d110910140243q408a3e50y46dd7da936bdfe57@mail.gmail.com>
	<99F66F53142145DE8127EAF7423AF726@marktestcr.marktest.pt>
	<200910141354.17785.aklaver@comcast.net>
	<EDA0AFB36F144EE38143CCE0734312E0@marktestcr.marktest.pt>

"Oliveiros C," <oliveiros.cristina@marktest.pt> writes:
> If any one can explain me exactly how the order by clause works on varchars, 
> I 'd really appreciate it.

It sorts according to the sort order imposed by your locale setting
(see LC_COLLATE in particular).

A lot of locales have weird and wonderful rules that embody somebody's
notion of "dictionary order".  If you don't like it, try switching to
C locale.  Or you could learn enough about locale definitions to create
your own.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <8017.1255973569@sss.pgh.pa.us>
Permalink:  ../8017.1255973569@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8017.1255973569@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, oliveiros.cristina@marktest.pt, aklaver@comcast.net
  Subject: Re: How to order varchar data by word
  In-Reply-To: <8017.1255973569@sss.pgh.pa.us>

* 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