pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: spatarel1@yahoo.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6743: BETWEEN operator does not work for char(1)
Date: Thu, 19 Jul 2012 10:33:07 -0400
Message-ID: <20880.1342708387@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SrTXO-0003XB-HO@wrigleys.postgresql.org>
References: <E1SrTXO-0003XB-HO@wrigleys.postgresql.org>

spatarel1@yahoo.com writes:
> I use "UTF8" charset and "Romania, Romanian" locale.

> I came across this as I wanted to test if a symbol was a letter:

> SELECT 'a' BETWEEN 'a' AND 'z'; -- true
> SELECT 'z' BETWEEN 'a' AND 'z'; -- true
> SELECT 'A' BETWEEN 'a' AND 'z'; -- true
> SELECT 'Z' BETWEEN 'a' AND 'z'; -- false (!)
> SELECT 'a' BETWEEN 'A' AND 'Z'; -- false (!)
> SELECT 'z' BETWEEN 'A' AND 'Z'; -- true
> SELECT 'A' BETWEEN 'A' AND 'Z'; -- true
> SELECT 'Z' BETWEEN 'A' AND 'Z'; -- true

> It seems that the intent is for the comparison to be case-insensitive, but
> in some limit-cases it fails.

I dunno exactly what sorting rule is implemented by Windows' Romanian
locale, but these examples are consistent with the theory that the
sort order is like aAbBcC ... zZ.  In any case, you need to complain
to Microsoft if you don't like the locale's sort order.  We just do
what the platform's strcoll() function tells us to.

			regards, tom lane



view thread (2+ messages)

Message-ID: <20880.1342708387@sss.pgh.pa.us>
Permalink:  ../20880.1342708387@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20880.1342708387@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, spatarel1@yahoo.com
  Subject: Re: BUG #6743: BETWEEN operator does not work for char(1)
  In-Reply-To: <20880.1342708387@sss.pgh.pa.us>
  References: <E1SrTXO-0003XB-HO@wrigleys.postgresql.org> <20880.1342708387@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