pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7783: lower & upper function incorrect work
4+ messages / 4 participants
[nested] [flat]

* BUG #7783: lower & upper function incorrect work
@ 2013-01-03 09:07  alex.shniperson@gmail.com
  0 siblings, 2 replies; 4+ messages in thread

From: alex.shniperson@gmail.com @ 2013-01-03 09:07 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7783
Logged by:          Alexander Shniperson
Email address:      alex.shniperson@gmail.com
PostgreSQL version: 9.1.7
Operating system:   osx lion 10.7.5
Description:        

Hi.

I have problem at my project, try to do simple steps:
1) create DataBase with
ENCODING = 'UTF8'
LC_COLLATE = 'C'
LC_CTYPE = 'C'

2) create new table at just created database

CREATE TABLE testtable
(
  id serial NOT NULL,
  name character varying(50) NOT NULL,
  CONSTRAINT testtable_pkey PRIMARY KEY (id )
)

3) insert one simple record with Russian word

INSERT INTO testtable (id, name) VALUES (1, 'Залог');

4) try to select data with upper & lower functions with 'like' operator 

select *, lower(name), upper(name) from testtable where lower(name) like
'%залог%'

5) as result you must see nothing, just fields without data

fix it please, thanks.



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



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

* Re: BUG #7783: lower & upper function incorrect work
@ 2013-01-03 18:27  Pavel Stehule <pavel.stehule@gmail.com>
  parent: alex.shniperson@gmail.com
  1 sibling, 1 reply; 4+ messages in thread

From: Pavel Stehule @ 2013-01-03 18:27 UTC (permalink / raw)
  To: alex.shniperson@gmail.com; +Cc: pgsql-bugs

Hello

maybe this is same problem

http://postgresql.1045698.n5.nabble.com/PostgreSQL-UTF-8-and-Mac-OS-X-td1852185.html

please, try to use different collate - maybe this advice should to help to you

http://yzisin.wordpress.com/2012/01/09/how-to-fix-locale-issues-in-mac-os-x-lion-terminal/

regards

Pavel Stehule

2013/1/3  <alex.shniperson@gmail.com>:
> The following bug has been logged on the website:
>
> Bug reference:      7783
> Logged by:          Alexander Shniperson
> Email address:      alex.shniperson@gmail.com
> PostgreSQL version: 9.1.7
> Operating system:   osx lion 10.7.5
> Description:
>
> Hi.
>
> I have problem at my project, try to do simple steps:
> 1) create DataBase with
> ENCODING = 'UTF8'
> LC_COLLATE = 'C'
> LC_CTYPE = 'C'
>
> 2) create new table at just created database
>
> CREATE TABLE testtable
> (
>   id serial NOT NULL,
>   name character varying(50) NOT NULL,
>   CONSTRAINT testtable_pkey PRIMARY KEY (id )
> )
>
> 3) insert one simple record with Russian word
>
> INSERT INTO testtable (id, name) VALUES (1, 'Залог');
>
> 4) try to select data with upper & lower functions with 'like' operator
>
> select *, lower(name), upper(name) from testtable where lower(name) like
> '%залог%'
>
> 5) as result you must see nothing, just fields without data
>
> fix it please, thanks.
>
>
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs


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



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

* Re: BUG #7783: lower & upper function incorrect work
@ 2013-01-03 19:52  Aleksander Shniperson <alex.shniperson@gmail.com>
  parent: Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Aleksander Shniperson @ 2013-01-03 19:52 UTC (permalink / raw)
  To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-bugs

Hi, thanks for answer.

Yes this may help, but Postgres must convert it automatically.

03.01.2013, в 22:27, Pavel Stehule написал(а):

> Hello
> 
> maybe this is same problem
> 
> http://postgresql.1045698.n5.nabble.com/PostgreSQL-UTF-8-and-Mac-OS-X-td1852185.html
> 
> please, try to use different collate - maybe this advice should to help to you
> 
> http://yzisin.wordpress.com/2012/01/09/how-to-fix-locale-issues-in-mac-os-x-lion-terminal/
> 
> regards
> 
> Pavel Stehule
> 
> 2013/1/3  <alex.shniperson@gmail.com>:
>> The following bug has been logged on the website:
>> 
>> Bug reference:      7783
>> Logged by:          Alexander Shniperson
>> Email address:      alex.shniperson@gmail.com
>> PostgreSQL version: 9.1.7
>> Operating system:   osx lion 10.7.5
>> Description:
>> 
>> Hi.
>> 
>> I have problem at my project, try to do simple steps:
>> 1) create DataBase with
>> ENCODING = 'UTF8'
>> LC_COLLATE = 'C'
>> LC_CTYPE = 'C'
>> 
>> 2) create new table at just created database
>> 
>> CREATE TABLE testtable
>> (
>>  id serial NOT NULL,
>>  name character varying(50) NOT NULL,
>>  CONSTRAINT testtable_pkey PRIMARY KEY (id )
>> )
>> 
>> 3) insert one simple record with Russian word
>> 
>> INSERT INTO testtable (id, name) VALUES (1, 'Залог');
>> 
>> 4) try to select data with upper & lower functions with 'like' operator
>> 
>> select *, lower(name), upper(name) from testtable where lower(name) like
>> '%залог%'
>> 
>> 5) as result you must see nothing, just fields without data
>> 
>> fix it please, thanks.
>> 
>> 
>> 
>> --
>> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-bugs



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



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

* Re: BUG #7783: lower & upper function incorrect work
@ 2013-01-03 22:29  Tom Lane <tgl@sss.pgh.pa.us>
  parent: alex.shniperson@gmail.com
  1 sibling, 0 replies; 4+ messages in thread

From: Tom Lane @ 2013-01-03 22:29 UTC (permalink / raw)
  To: alex.shniperson@gmail.com; +Cc: pgsql-bugs

alex.shniperson@gmail.com writes:
> PostgreSQL version: 9.1.7
> Operating system:   osx lion 10.7.5

> 1) create DataBase with
> ENCODING = 'UTF8'
> LC_COLLATE = 'C'
> LC_CTYPE = 'C'

> 3) insert one simple record with Russian word

> INSERT INTO testtable (id, name) VALUES (1, 'Залог');

> 4) try to select data with upper & lower functions with 'like' operator 

> select *, lower(name), upper(name) from testtable where lower(name) like
> '%залог%'

This is not a bug.  You specified LC_CTYPE = "C", so upper/lower case
conversion converts only ASCII letters.  You need to specify a Russian
locale if you want case conversion to work on Russian letters.

Now having said that, I'm pretty sure that UTF8 locales are completely
broken on OS X, so that this wouldn't work even if you had specified
the right locale.  But that's Apple's fault; there's little we can do
about it.  I believe locale ru_RU.ISO8859-5 (with the matching encoding)
would behave sanely on OS X, if that's an acceptable fix for you.

			regards, tom lane


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



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


end of thread, other threads:[~2013-01-03 22:29 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-03 09:07 BUG #7783: lower & upper function incorrect work alex.shniperson@gmail.com
2013-01-03 18:27 ` Pavel Stehule <pavel.stehule@gmail.com>
2013-01-03 19:52   ` Aleksander Shniperson <alex.shniperson@gmail.com>
2013-01-03 22:29 ` 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