Re: Why can't I put a BEFORE EACH ROW trigger on a view?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Дата
Msg-id 1566.1172372140@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why can't I put a BEFORE EACH ROW trigger on a view?  ("Karl O. Pinc" <kop@meme.com>)
Ответы Re: Why can't I put a BEFORE EACH ROW trigger on a view?  ("Karl O. Pinc" <kop@meme.com>)
Список pgsql-general
"Karl O. Pinc" <kop@meme.com> writes:
> On 02/24/2007 07:48:58 PM, Tom Lane wrote:
>> However, I'm not sure that the idea scales to cover updates and
>> deletes; with no concept of physical tuple identity (ctid) for the
>> view rows, it's not clear that you can write triggers that will
>> reliably do the right things

> How is it that the rules can come up with NEW and OLD for a view and
> why wouldn't something be able to give triggers the same data.

NEW and OLD only include the user-visible columns.  I'm not sure that
that's sufficient.  If you assume that the view exposes a primary key
for each of its underlying tables, then you could use the pkey values
to find and update a row in the underlying table(s), but this is not
exactly guaranteeing that you're updating the same row that the view
query saw initially.  And what if you don't want the view to expose
the pkey?

            regards, tom lane

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

Предыдущее
От: "Karl O. Pinc"
Дата:
Сообщение: Re: Why can't I put a BEFORE EACH ROW trigger on a view?
Следующее
От: "Karl O. Pinc"
Дата:
Сообщение: Re: Why can't I put a BEFORE EACH ROW trigger on a view?