Re: abnormal behaviour of a CHECK CONSTRAINT with a regular
| От | Daniel Struck |
|---|---|
| Тема | Re: abnormal behaviour of a CHECK CONSTRAINT with a regular |
| Дата | |
| Msg-id | 20040211114005.78fe1a06.struck.d@retrovirology.lu обсуждение исходный текст |
| Ответ на | Re: abnormal behaviour of a CHECK CONSTRAINT with a regular expression when a trigger is added (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-bugs |
> Correct. It is annoying in some cases, but if the input to the trigger > isn't of the column datatype, then what type is it? It's hard to see > how that could work in general. >=20 > If you want, say, a varchar length constraint to be checked only after > the trigger runs, I'd counsel declaring the column as plain text and > writing the length test as a CHECK constraint. I had just an example, where it would have been convenient, if one could ch= ange the type. Let's say you want to give the users the possibility to enter incomplete da= tes (year, year&month or the complete date). Indeed you could not insert th= is information as it is. But later on for stats you would like to be able t= o treat the column as a date. I have implemented it by storing the user information in a varchar column a= nd inserting the whole date in another column. (if the user only provides the year, the date is inserted as 16.05.year,...= ). Kind regards, Daniel Struck --=20 Retrovirology Laboratory Luxembourg Centre Hospitalier de Luxembourg 4, rue E. Barbl=E9 L-1210 Luxembourg phone: +352-44116105 fax: +352-44116113 web: http://www.retrovirology.lu e-mail: struck.d@retrovirology.lu
В списке pgsql-bugs по дате отправления: