Re: Why no INSTEAD OF triggers on tables?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Why no INSTEAD OF triggers on tables?
Дата
Msg-id 52B08D14.8080100@agliodbs.com
обсуждение исходный текст
Ответ на Why no INSTEAD OF triggers on tables?  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
On 12/16/2013 07:53 PM, Robert Haas wrote:
> So, put a BEFORE trigger, and make it return NULL.  Same effect,
> different notation.

NOT the same:

Master partition table with BEFORE trigger:

josh=# insert into a ( id, val ) values ( 23, 'test' ), ( 24, 'test'),
(25,'test');

INSERT 0 0       ^^^

View with INSTEAD OF trigger:

josh=# insert into a_v ( id, val ) values ( 23, 'test' ), ( 24, 'test'),
(25,'test');

INSERT 0 3       ^^^

The difference here is that the INSTEAD OF trigger returns a
rows-affected count, and the BEFORE trigger does not (it returns 0).
Some drivers and ORMs, most notably Hibernate, check this rows-returned
count, and error if they don't match the rows sent.

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Extension Templates S03E11
Следующее
От: Michael Weber
Дата:
Сообщение: Re: patch: make_timestamp function