Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers
Дата
Msg-id 20201027174318.GM9241@telsasoft.com
обсуждение исходный текст
Ответ на Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
On Wed, Oct 21, 2020 at 02:02:37PM -0300, Alvaro Herrera wrote:
> On 2020-Oct-21, Justin Pryzby wrote:
> 
> > I came up with this, which probably needs more than a little finesse.
> 
> Hmm, there are two important changes needed on this: 1) it must not emit
> CREATE lines for the child triggers; only the ALTER TABLE ONLY
> <partition> lines to set disable state on the partition are needed.  2)
> tgparentid does not exist prior to pg13, so you need some additional
> trick to cover that case.

Thanks for looking.

> Also, I think the multipartition case is broken: if grandparent has
> trigger enabled, parent has trigger disabled and child trigger set to
> always, is that dumped correctly?  I think the right way to do this is
> change only the partitions that differ from the topmost partitioned
> table -- not their immediate parents; and use ONLY to ensure they don't
> affect downstream children.

I think either way could be ok - if you assume that the trigger was disabled
with ONLY, then it'd make sense to restore it with ONLY, but I think it's at
least as common to ALTER TABLE [*].  It might look weird to the user if they
used ALTER TABLE ONLY and the pg_dump output uses ALTER TABLE for that table,
and then again for all its children (or vice versa).  But it's fine as long as
the state is correctly restored.

There are serveral issues:
 - fail to preserve childs' tgenabled in CREATE TABLE PARTITION OF;
 - fail to preserve childs' tgenabled in pg_dump;
 - fail to preserve childs' comments in pg_dump;

I'm going step away from this patch at least for awhile, so I'm attaching my
latest in case it's useful.

-- 
Justin

Вложения

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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: MultiXact\SLRU buffers configuration
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch to fix FK-related selectivity estimates with constants