From: | Michael Wimmer <newsgroup1(at)ecom(dot)at> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | unicode and varchar |
Date: | 2004-09-10 12:57:18 |
Message-ID: | 4141a4f7$0$13272$91cee783@newsreader02.highway.telekom.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Mitch Pirtle | 2004-09-10 13:50:21 | Re: Opinions Requested - PG API or Abstraction Layer |
Previous Message | Ennio-Sr | 2004-09-10 12:20:11 | Re: Display of text fields |