Re: inserting to a multi-table view

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: inserting to a multi-table view
Дата
Msg-id 19394.1213900126@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: inserting to a multi-table view  ("Michael Shulman" <shulman@mathcamp.org>)
Список pgsql-general
"Michael Shulman" <shulman@mathcamp.org> writes:
>> http://www.postgresql.org/docs/8.3/static/rules-triggers.html
>> says "a trigger that is fired on INSERT on a view can do the same as
>> a rule: put the data somewhere else and suppress the insert in the
>> view."  So what do I need to do to make an INSERT trigger on a view?

> This quote from the manual implies to me that it is possible to make a
> trigger fire on INSERT on a view.  But postgres won't let me do this,
> and some things I've read elsewhere on the Internet imply that it is
> impossible.  Is the manual wrong?

The manual is wrong.  Although this text is so ancient that it probably
was true when written.  I don't offhand know when the check against
installing triggers on views was put in, but this section of the manual
predates the time when we started to draw a hard distinction between
views and tables.

There's been some recent talk about allowing ON INSERT triggers on
views, which would make this statement correct again, but nothing's
been done about it yet.  It's not entirely clear how useful such a
thing would be if we couldn't support UPDATE/DELETE too, and as stated
here those cases are a lot harder.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Shane Ambler
Дата:
Сообщение: Re: Losing data
Следующее
От: "Michael Shulman"
Дата:
Сообщение: Re: inserting to a multi-table view