Re: deferrable FK constraints on partitioned rels

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: deferrable FK constraints on partitioned rels
Date: 2019-11-05 21:29:16
Message-ID: 20191105212915.GA11324@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Nov-05, Alvaro Herrera wrote:

> While messing around, I noticed that SET CONSTRAINTS ... DEFERRED
> does not work with partitioned tables. I had some code to cover this
> case, but it has a bug that prevents it from working at all: the sanity
> check that verifies whether triggers exist fails.
>
> The attached patch fixes this problem: it merely removes the sanity
> check. With that, everything works.
>
> (Another approach I tried was to split out constraints in partitioned
> tables vs. constraints in regular ones. That's indeed workable, but it
> requires us to do two additional syscache access per partition for
> get_rel_relkind, which seems excessive.)

Uh, somehow I posted a previous version of the patch that implements my
rejected approach, instead of the final version I described. Here's the
real patch (which also includes tests).

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

Attachment Content-Type Size
0001-Fix-deferred-constraints-on-partitioned-rels.patch text/x-diff 4.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-11-05 22:47:55 Re: RFC: split OBJS lines to one object per line
Previous Message Fabien COELHO 2019-11-05 21:22:51 Re: pgbench - extend initialization phase control