Re: Trigger to force fields to lowercase at insert/update
В списке pgsql-novice по дате отправления:
| От | Bruno Wolff III |
|---|---|
| Тема | Re: Trigger to force fields to lowercase at insert/update |
| Дата | |
| Msg-id | 20060429201924.GA14915@wolff.to обсуждение исходный текст |
| Ответ на | Trigger to force fields to lowercase at insert/update (Leonardo Boiko <leoboiko@gmail.com>) |
| Список | pgsql-novice |
On Wed, Apr 26, 2006 at 12:52:55 -0700,
Leonardo Boiko <leoboiko@gmail.com> wrote:
> Suppose I have a bunch of fields in different tables which I'd like to
> always force to lowercase (since they represent case-insensitive data).
> Suppose I want to do it at SQL level, not application level. If the
> user say "INSERT INTO foo VALUES ('Abc')", I want to really insert
> 'abc'. Is there an elegant way of doing this? Some kind of trigger,
> maybe? I have no experience with triggers or pl/sql, but I couldn't
> come up with a solution general enough to be reused in multiple places.
> Or is the premise a bad idea?
You can use a before trigger to change the value of the column when it
is inserted or updated.
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера