dbTalk Databases Forums  

[BUGS] BUG #6743: BETWEEN operator does not work for char(1)

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #6743: BETWEEN operator does not work for char(1) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
spatarel1@yahoo.com
 
Posts: n/a

Default [BUGS] BUG #6743: BETWEEN operator does not work for char(1) - 07-18-2012 , 07:39 AM






The following bug has been logged on the website:

Bug reference: 6743
Logged by: Spătărel Dan
Email address: spatarel1 (AT) yahoo (DOT) com
PostgreSQL version: 9.1.4
Operating system: Windows Vista SP2
Description:

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.

Please let me know if this turns out to be a real bug on not.


--
Sent via pgsql-bugs mailing list (pgsql-bugs (AT) postgresql (DOT) org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #6743: BETWEEN operator does not work for char(1) - 07-19-2012 , 09:33 AM






spatarel1 (AT) yahoo (DOT) com writes:
Quote:
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

--
Sent via pgsql-bugs mailing list (pgsql-bugs (AT) postgresql (DOT) org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.