| От | Tom Lane |
|---|---|
| Тема | Re: Combining insert rules on views with functions |
| Дата | |
| Msg-id | 23135.1442461606@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Combining insert rules on views with functions (Bastiaan Olij <bastiaan@basenlily.me>) |
| Список | pgsql-novice |
Bastiaan Olij <bastiaan@basenlily.me> writes:
> I've got a situation where I'm adding an insert rule to a view but the
> work I need to do in order to insert the required data doesn't fit well
> in a simple query rewrite (I need to calculate a few things before I'm
> ready to do my insert).
> Because of this I've moved the actual insert code into a function which
> in looks sort of like this:
... umm, have you considered using a BEFORE INSERT trigger instead?
AFAICT, what you really want here is to compute some derived column
values before the row gets stored, and a trigger would handle that
nicely without any need to abuse semantics.
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера