Re: Foreign keys and partitioned tables - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Foreign keys and partitioned tables
Date
Msg-id 20180330031953.5j4sspyl6s4rdb62@alvherre.pgsql
Whole thread Raw
In response to Re: Foreign keys and partitioned tables  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Foreign keys and partitioned tables
Re: Foreign keys and partitioned tables
Re: Foreign keys and partitioned tables
List pgsql-hackers
Here's an updated version.  After wasting some time trying to resolve
"minor last minute issues", I decided to reduce the scope for now: in
the current patch, it's allowed to have foreign keys in partitioned
tables, but it is not possible to have foreign keys that point to
partitioned tables.  I have split out some preliminary changes that
intended to support FKs referencing partitioned tables; I intend to
propose that for early v12, to avoid spending any more time this
commitfest on that.  Yes, I'm pretty disappointed about that.

0001 prohibits having foreign keys pointing to partitioned tables, as
discussed above.

0002 is a fixup for a bug in the row triggers patch: I had a restriction
earlier that triggers declared internal were not cloned, and I seem to
have lost it in rebase.  Reinstate it.

0003 is the matter of interest.  This is essentially the same code I
posted earlier, rebased to the committed row triggers patch, with a few
minor bug fixes and some changes in the regression tests to try and make
them more comprehensive, including leaving a partitioned table with an
FK to test that the whole pg_dump thing works via the pg_upgrade test.
An important change is that when a table containing data is attached as
a partition, the data is verified to satisfy the constraint via the
regular alter table phase 3 code.

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

Attachment

pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: RE: Speedup of relation deletes during recovery
Next
From: David Steele
Date:
Subject: Re: [PATCH] Verify Checksums during Basebackups