Re: FK violation in partitioned table after truncating a referencedpartition

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: FK violation in partitioned table after truncating a referencedpartition
Дата
Msg-id 20200207172751.GA26691@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: FK violation in partitioned table after truncating a referencedpartition  (Jehan-Guillaume de Rorthais <jgdr@dalibo.com>)
Ответы Re: FK violation in partitioned table after truncating a referencedpartition  (Jehan-Guillaume de Rorthais <jgdr@dalibo.com>)
Список pgsql-bugs
On 2020-Feb-07, Jehan-Guillaume de Rorthais wrote:

> Maybe I would just add:
> 
>  /*
>   * If this constraint has a parent constraint which we have not seen
>   * yet, keep track of it for the second loop, below.
> + * Tracking parent constraint allows to climb up to the top-level
> + * level constraint and look for all possible relation referencing 
> + * the partioned table.
>   */

LGTM.

BTW I was thinking that perhaps it would make sense to go up all levels
at once when we see a "parented" constraint; this would avoid having to
restart several times when there's N-levels partitioning.  It might be
an issue if pg_constraint is large, because, you see, there's a seqscan
there!  (Maybe now's the time to add an index to confrelid, but of
course only in master).  This probably doesn't matter much normally
because nobody uses that many partition levels ...

> This is out of the scope of this bug fix in my humble opinion. This would be a
> whole new feature, even if it could be done without a new syntax.

Sure.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Jehan-Guillaume de Rorthais
Дата:
Сообщение: Re: FK violation in partitioned table after truncating a referencedpartition
Следующее
От: "Adam Middleton"
Дата:
Сообщение: Southern California 2020 Linux Expo Emails