Re: Combining insert rules on views with functions

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: Bastiaan Olij
Дата:
Сообщение: Combining insert rules on views with functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Combining insert rules on views with functions