Re: varchar or text
От | Pascal Cohen |
---|---|
Тема | Re: varchar or text |
Дата | |
Msg-id | 4816CFFF.3020908@wimba.com обсуждение исходный текст |
Ответ на | Re: varchar or text (Guillaume Lelarge <guillaume@lelarge.info>) |
Ответы |
Re: varchar or text
|
Список | pgsql-general |
Guillaume Lelarge wrote: > Pascal Cohen a écrit : >> I had a look in previous posts in the forum but could not find the >> answer I was looking for. >> My question is should I switch from varchar to text. >> We have "discovered" although it seems to be SQL that adding >> something like 'text ' to a varchar(50) just silently >> cut the text while a text with check(length) - or also a varchar with >> a check raised an error. > > Nope. If you try to add some text with more than 50 characters on a > varchar(50) column, you will get an error. For example : > > test=# create table t (c varchar(5)); > CREATE TABLE > test=# insert into t (c) values ('12345'); > INSERT 0 1 > test=# insert into t (c) values ('123456'); > ERREUR: valeur trop longue pour le type character varying(5) > > (the english error message is: > ERROR: value too long for type character varying(5) > ). > > Which release do you use ? I am with 8.3.1 release but I mentioned that this appears with spaces at then end not with standard chars. Of course your examples are working fine but insert something like 'abc ' (with several spaces and it will work but just ignore the spaces above the 5th char.
В списке pgsql-general по дате отправления: