From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | amul sul <sulamul(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Cannot dump foreign key constraints on partitioned table |
Date: | 2018-07-12 03:48:14 |
Message-ID: | 20180712034814.GB7352@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 11, 2018 at 03:49:59PM +0530, amul sul wrote:
> On the master head, getConstraints() function skips FK constraints for
> a partitioned table because of tbinfo->hastriggers is false.
>
> While creating FK constraints on the partitioned table, the FK triggers are only
> created on leaf partitions and skipped for the partitioned tables.
Oops. Good catch.
> To fix this, either bypass the aforementioned condition of getConstraints() or
> set pg_class.relhastriggers to true for the partitioned table which doesn't seem
> to be the right solution, IMO. Thoughts?
Changing pg_class.relhastriggers is out of scope because as far as I
know partitioned tables have no triggers, so the current value is
correct, and that would be a catalog change at this stage which would
cause any existing deployments of v11 to complain about the
inconsistency. I think that this should be fixed client-side as the
attached does.
I have just stolen this SQL set from Alvaro to check the consistency of
the dumps created:
create table prim (a int primary key);
create table partfk (a int references prim) partition by range (a);
create table partfk1 partition of partfk for values from (0) to (100);
create table partfk2 partition of partfk for values from (100) to (200);
Thoughts?
--
Michael
Attachment | Content-Type | Size |
---|---|---|
dump-partition-fk.patch | text/x-diff | 636 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Nico Williams | 2018-07-12 04:07:14 | Re: How can we submit code patches that implement our (pending) patents? |
Previous Message | Etsuro Fujita | 2018-07-12 03:32:03 | Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. |