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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to