unicode and varchar
| От | Michael Wimmer |
|---|---|
| Тема | unicode and varchar |
| Дата | |
| Msg-id | 4141a4f7$0$13272$91cee783@newsreader02.highway.telekom.at обсуждение исходный текст |
| Ответы |
Re: unicode and varchar
|
| Список | pgsql-general |
Hi all,
I have a problem when inserting into a varchar field via jdbc.
Using to bytes makes the varchar fields shorten.
Example: with 7.4.5. on Linux
create table test(charfield varchar(5));
insert into test(charfield) values('abcde');
insert into test(charfield) values('üö');
select bit_length(charfield), length(charfield), charfield from test
bit_length length charfield
------------- --------- ------------
40 5 abcde
32 4 üö
insert into test(charfield) values('üäö');
Error: ERROR: value too long for type character varying(5)
Doing the same on Windows with the fresh 8.0 beta 2 shows a different
behaviour.
create table test(charfield varchar(5));
insert into test(charfield) values('abcde');
insert into test(charfield) values('üöüöä');
select bit_length(charfield), length(charfield), charfield from test
bit_length length charfield
------------- --------- ------------
40 5 abcde
80 5 üöüöä
'length' seems to account the 16 bit character length.
Is there a way to make this work in 7.4.x too?
May problem is that we are in a rush to do a port of our application
from informix and I will not be able to wait until 8.0 will be released.
BTW, both database servers where queried with the same JDBC driver
(version).
Best regards,
Michael
В списке pgsql-general по дате отправления: