Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id D6EB1F6332D for ; Thu, 19 Jul 2012 11:33:21 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Srrn6-0004yC-Hg for pgsql-bugs@postgresql.org; Thu, 19 Jul 2012 14:33:21 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q6JEX7RH020881; Thu, 19 Jul 2012 10:33:07 -0400 (EDT) From: Tom Lane To: spatarel1@yahoo.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6743: BETWEEN operator does not work for char(1) In-reply-to: References: Comments: In-reply-to spatarel1@yahoo.com message dated "Wed, 18 Jul 2012 12:39:30 -0000" Date: Thu, 19 Jul 2012 10:33:07 -0400 Message-ID: <20880.1342708387@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/172 X-Sequence-Number: 33648 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