| От | Tom Lane |
|---|---|
| Тема | Re: Error size varchar |
| Дата | |
| Msg-id | 5244.1067444903@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Error size varchar ("Edwin Quijada" <listas_quijada@hotmail.com>) |
| Список | pgsql-general |
"Edwin Quijada" <listas_quijada@hotmail.com> writes:
> I got error about a length field varchar. I have a table with a field type
> varchar(20) but if I try to set to this field more than 20 characters I got
> error.
> I did a function to control the length of data and put it on trigger but
> when it ocurrs I got the error anyway and the trigger not works.
The length constraint is checked before triggers are fired, I believe.
If you want silent truncation rather than an error, use a text column
(or unconstrained varchar) and put the truncation behavior into your
trigger.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера