[POC]Enable tuple change partition caused by BEFORE TRIGGER
От | movead.li@highgo.ca |
---|---|
Тема | [POC]Enable tuple change partition caused by BEFORE TRIGGER |
Дата | |
Msg-id | 20200821155540390217109@highgo.ca обсуждение исходный текст |
Ответы |
Re: [POC]Enable tuple change partition caused by BEFORE TRIGGER
|
Список | pgsql-hackers |
The implemented approach is similar to when a change partition caused by an UPDATE
statement. If it's a BEFORE INSERT TRIGGER then we just need to insert the row produced
by a trigger to the new partition, and if it's a BEFORE UPDATE TRIGGER we need to delete
the old tuple and insert the row produced by the trigger to the new partition.
In current BEFORE TRIGGER implementation, it reports an error once a trigger result out
of current partition, but I think it should check it after finish all triggers call, and you can
see the discussion in [1][2]. In the attached patch I have changed this rule, I check the
partition constraint only once after all BEFORE TRIGGERS have been called. If you do not
agree with this way, I can change the implementation.
And another point is that when inserting to new partition caused by BEFORE TRIGGER,
then it will not trigger the BEFORE TRIGGER on a new partition. I think it's the right way,
what's more, I think the UPDATE approach cause partition change should not trigger the
BEFORE TRIGGERS too, you can see discussed on [1].
URL : www.highgo.ca
EMAIL: mailto:movead(dot)li(at)highgo(dot)ca
Вложения
В списке pgsql-hackers по дате отправления: