Thread: Char(100) fields

Char(100) fields

From
"Waldomiro"
Date:
Hi,
 
I have some char(100) fields.
 
I was using postgre 7.2 and now I'm using 7.4.
 
before 7.2 I never had an error inserting some data in a char(100) field.
 
now I have an error "value too long for type character(100)"
 
this error ocurrs when I insert some string which has size 100, if I insert some string which has size 99, the error doesn't came.
 
Is it a bug?
 
there is a detail, when I do that insert inside a psql program, the error doesn't came, it came only when I do the insert inside a java program.
 
I think it is a driver problem.
 
There is someone who have already this kind of problem?
 
SHX INFORMÁTICA LTDA.
Waldomiro Caraiani
Desenvolvimento de Produto
+ 55 11 5581 1551
wmiro@shx.com.br
www.shx.com.br

Re: Char(100) fields

From
Tom Lane
Date:
"Waldomiro" <wmiro@ig.com.br> writes:
> now I have an error "value too long for type character(100)"

Perhaps you are using unicode but forgot to set up the database with the
proper encoding?  The DB is going to count bytes not characters if it's
in SQL_ASCII encoding, for example.

            regards, tom lane