Re: value too long error
От | Tom Lane |
---|---|
Тема | Re: value too long error |
Дата | |
Msg-id | 28033.1077983528@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | value too long error ("Rajat Katyal" <rajatk@intelesoftech.com>) |
Список | pgsql-general |
"Rajat Katyal" <rajatk@intelesoftech.com> writes: > Whenever i try to insert the data, size of which is greater than that of co= > lumn datatype size, I got the exception value too long for.....=20 > However this was not in postgresql7.2. IIRC, older versions would just silently truncate the data to the specified column width. We concluded that that was not per spec. 7.3 and later make you do it the SQL-spec way, which is to explicitly truncate the data. You can do that with a substring operation or by casting, for instance INSERT INTO foo VALUES('an overly long string'::varchar(10)); It's a tad inconsistent that explicit and implicit casts to varchar(N) act differently, but that's what the SQL spec says to do, AFAICS. I guess it's reasonable --- the old behavior could result in unintended data loss. regards, tom lane
В списке pgsql-general по дате отправления: