Re: ALTER CONSTRAINT on a partitioned FK isn't working

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: ALTER CONSTRAINT on a partitioned FK isn't working
Дата
Msg-id 20210429230228.GA25949@alvherre.pgsql
обсуждение исходный текст
Ответ на ALTER CONSTRAINT on a partitioned FK isn't working  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ALTER CONSTRAINT on a partitioned FK isn't working  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-bugs
On 2020-Dec-07, Tom Lane wrote:

> then everything behaves as expected.  So something is broken
> about propagating deferred-ness to partition triggers in an
> ALTER CONSTRAINT.  Oddly, it *looks* like it worked if you
> examine the child tables with "\d+".  I surmise that ALTER CONSTRAINT
> fixes whatever catalog fields psql looks at, but there's some other
> fields that also need to be updated and aren't being.

I came up with this.  As I mentioned in my earlier reply, handling
recursion in the usual way doesn't fix the whole problem, because we
need to recurse on possibly both sides of the constraint.  So I made it
recurse using pg_constraint.conparentid, which seems easier and cover
both ends.  This is pretty crude so far but it handles the trivial
cases.  What I did is split the existing routine in two, and the "inner"
part now recurses on itself if it sees that either table is partitioned.

I'll polish it tomorrow -- intend to get this pushed to branches back to
11, depending on what's needed.

-- 
Álvaro Herrera       Valdivia, Chile

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #16976: server crash when deleting via a trigger on a foreign table
Следующее
От: chenyanfei
Дата:
Сообщение: syslogger file descriptor question