Re: partitioned tables referenced by FKs

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: partitioned tables referenced by FKs
Date: 2019-02-22 15:39:44
Message-ID: 20190222153944.GA7947@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here's another rebase. The code is structured somewhat differently from
the previous one, mostly because of the backpatched bugfixes, but also
because of the changes in dependency handling.

I think there's also at least one more bugfix to backpatch (included in
0003 here), related to whether foreign tables are allowed as having FKs,
but AFAICS it just cosmetic: you get an error if you have a foreign
partition and add a FK, but it says "you cannot have constraint
triggers" rather than "FKs are not supported", so it's a bit odd.
0003 also includes Amit L's patch to remove the parentConstraint
argument from ATExecAddForeignKey, which I suppose I should commit
separately.

Odd bugs fixed: a) handle the case where the default partition is the
only one and it's being detached or dropped. b) when a partition was
dropped/detached from the referenced side, the child constraint was left
in place.

I have not yet fixed the "#if 0" section.

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

Attachment Content-Type Size
v4-0001-Rework-deleteObjectsInList-to-allow-objtype-speci.patch text/x-diff 2.2 KB
v4-0002-index_get_partition.patch text/x-diff 4.2 KB
v4-0003-support-FKs-referencing-partitioned-tables.patch text/x-diff 78.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-02-22 15:41:02 Re: libpq debug log
Previous Message Robert Haas 2019-02-22 15:26:44 Re: boolean and bool in documentation