Re: PostgreSQL v11.3 - Records are deleted from child table ifpartition key of parent table is changed

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: PostgreSQL v11.3 - Records are deleted from child table ifpartition key of parent table is changed
Дата
Msg-id 20190620180056.GA25386@alvherre.pgsql
обсуждение исходный текст
Ответ на PostgreSQL v11.3 - Records are deleted from child table if partitionkey of parent table is changed  ("Rozboril, Robert" <robert.rozboril@dxc.com>)
Ответы RE: PostgreSQL v11.3 - Records are deleted from child table ifpartition key of parent table is changed  ("Rozboril, Robert" <robert.rozboril@dxc.com>)
Список pgsql-bugs
On 2019-Jun-20, Rozboril, Robert wrote:

> ALTER TABLE polf ADD CONSTRAINT polf_po_id_fk FOREIGN KEY (po_id) REFERENCES pof(po_id) ON DELETE CASCADE;
> ALTER TABLE polt ADD CONSTRAINT polt_po_id_fk FOREIGN KEY (po_id) REFERENCES pot(po_id) ON DELETE CASCADE;

Hmm, yeah, I wouldn't expect this to work well -- the UPDATEs done by
the cascade action would not see that there is another partition.  If
you were declaring the PK and FK constraints on the parent tablej, it
should work correctly:

ALTER TABLE pol ADD CONSTRAINT pol_pkey PRIMARY KEY (pol_id);
ALTER TABLE pol ADD CONSTRAINT pol_po_id_fk FOREIGN KEY (po_id) REFERENCES po(po_id) ON DELETE CASCADE;
(similarly for the "po" table).

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



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Logging corruption error codes
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15864: problems with the instalation of PostgreSQL 9.4