pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6743: BETWEEN operator does not work for char(1)
2+ messages / 2 participants
[nested] [flat]

* BUG #6743: BETWEEN operator does not work for char(1)
@ 2012-07-18 12:39 spatarel1@yahoo.com
  2012-07-19 14:33 ` Re: BUG #6743: BETWEEN operator does not work for char(1) Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: spatarel1@yahoo.com @ 2012-07-18 12:39 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6743
Logged by:          Spătărel Dan
Email address:      spatarel1@yahoo.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.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #6743: BETWEEN operator does not work for char(1)
  2012-07-18 12:39 BUG #6743: BETWEEN operator does not work for char(1) spatarel1@yahoo.com
@ 2012-07-19 14:33 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2012-07-19 14:33 UTC (permalink / raw)
  To: spatarel1@yahoo.com; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2012-07-19 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18 12:39 BUG #6743: BETWEEN operator does not work for char(1) spatarel1@yahoo.com
2012-07-19 14:33 ` Tom Lane <tgl@sss.pgh.pa.us>

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