Re: Tables cannot have INSTEAD OF triggers

Поиск
Список
Период
Сортировка
Искать
От
Andres Freund
Тема
Re: Tables cannot have INSTEAD OF triggers
Дата
Msg-id
20150401160440.GD583@awork2.anarazel.de
Ответ на
Список
Дерево обсуждения
Tables cannot have INSTEAD OF triggers Aliouii Ali <aliouii.ali@aol.fr>
Re: Tables cannot have INSTEAD OF triggers Robert Haas <robertmhaas@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Andres Freund <andres@2ndquadrant.com>
Re: Tables cannot have INSTEAD OF triggers Robert Haas <robertmhaas@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Andres Freund <andres@anarazel.de>
Re: Tables cannot have INSTEAD OF triggers Tom Lane <tgl@sss.pgh.pa.us>
Re: Tables cannot have INSTEAD OF triggers Andres Freund <andres@anarazel.de>
Re: Tables cannot have INSTEAD OF triggers Tom Lane <tgl@sss.pgh.pa.us>
Re: Tables cannot have INSTEAD OF triggers Andres Freund <andres@anarazel.de>
Re: Tables cannot have INSTEAD OF triggers Tom Lane <tgl@sss.pgh.pa.us>
Re: Tables cannot have INSTEAD OF triggers Robert Haas <robertmhaas@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Tom Lane <tgl@sss.pgh.pa.us>
Re: Tables cannot have INSTEAD OF triggers Dean Rasheed <dean.a.rasheed@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Peter Eisentraut <peter_e@gmx.net>
Re: Tables cannot have INSTEAD OF triggers Andres Freund <andres@anarazel.de>
Re: Tables cannot have INSTEAD OF triggers Robert Haas <robertmhaas@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Dean Rasheed <dean.a.rasheed@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Dean Rasheed <dean.a.rasheed@gmail.com>
Re: Tables cannot have INSTEAD OF triggers Aliouii Ali <aliouii.ali@aol.fr>
Re: Tables cannot have INSTEAD OF triggers Alvaro Herrera <alvherre@2ndquadrant.com>
On 2015-04-01 11:40:13 -0400, Robert Haas wrote:
> On Tue, Mar 31, 2015 at 8:49 AM, Aliouii Ali  wrote:
> I don't see how this helps.  The problem with partitioning is that you
> need a way to redirect the INSERT to another table, and there's no
> built-in way to do that, so you have to simulate it somehow.  That
> issue seems largely separate from how the CREATE TRIGGER command is
> spelled.  Maybe I'm missing something.

Without INSTEAD OF you can't, to my knowledge, return a valid tuple from
the top level table without also inserting into it. Returning NULL after
redirecting the tuple into a child table will break RETURNING; not
returning NULL will insert the tuple in the top level table.

So the only way to do redirection that doesn't break RETURNING without
rules is to insert the tuple in the child in the BEFORE trigger return
NEW and delete the top level table row in an AFTER trigger. That sucks.

Greetings,

Andres Freund

-- Andres Freund	                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
Сообщение: Re: TABLESAMPLE patch
От: Bruce Momjian
Дата:
FAQ