Re: Tables cannot have INSTEAD OF triggers

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Tables cannot have INSTEAD OF triggers
Дата
Msg-id CA+TgmobcWE8X8qHjbgHRt4jAp2Ysz2pD169SrtdmDRCubzcDDw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Tables cannot have INSTEAD OF triggers  (Andres Freund <andres@anarazel.de>)
Ответы Re: Tables cannot have INSTEAD OF triggers  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
On Thu, Apr 2, 2015 at 5:02 PM, Andres Freund <andres@anarazel.de> wrote:
>> I think the upshot is that INSTEAD OF triggers work in a particular way
>> because that's what is needed to support updatable views.  If triggers
>> on tables should behave differently, maybe it should be a separate
>> trigger type.  Maybe it would be feasible to extend BEFORE triggers to
>> support RETURNING, for example?
>
> What in the above prohibits extending the behaviour to tables? I have
> yet to see what compatibility or similarity problem that'd pose. It
> seems all mightily handwavy to me.

Yeah.  It's possible there's a better interface here than INSTEAD OF,
and one of the things I didn't like about the OP was that it started
by stating the syntax that would be used rather than by describing the
problem that needed to be solved.  It's generally better to start with
the latter, and then work out the syntax from there.  But having
gotten that gripe out of my system, and especially in view of Dean's
comments, it's not very clear to me what's wrong with using INSTEAD OF
for this purpose.  If you make BEFORE triggers do this via RETURNING,
then you might have a trigger that returns multiple rows, which seems
like it would introduce a bunch of new complexity for no obvious
benefit.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Tables cannot have INSTEAD OF triggers
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: What exactly is our CRC algorithm?