Re: problems with foreign keys on partitioned tables

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: problems with foreign keys on partitioned tables
Date: 2019-01-18 22:16:33
Message-ID: 201901182216.nr5clsxrn624@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Jan-18, Amit Langote wrote:

> OK, I agree. I have updated the patch to make things work that way.

Thanks, this is better. There were a few other things I didn't like, so
I updated it. Mostly, two things:

1. I didn't like a seqscan on pg_trigger, so I turned that into an
indexed scan on the constraint OID, and then the other two conditions
are checked in the returned tuples. Also, what's the point on
duplicating code and checking how many you deleted? Just delete them
all.

2. I didn't like the ABI break, and it wasn't necessary: you can just
call createForeignKeyActionTriggers directly. That's much simpler.

I also added tests. While running them, I noticed that my previous
commit was broken in terms of relcache invalidation. I don't really
know if this is a new problem with that commit, or an existing one. The
fix is 0001.

Haven't got around to your 0002 yet.

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

Attachment Content-Type Size
0001-Add-missing-relcache-reset.patch text/x-diff 1.2 KB
0002-Fix-action-triggers-for-FK-constraints-on-detached-p.patch text/x-diff 5.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-01-18 22:19:41 Re: What to name the current heap after pluggable storage / what to rename?
Previous Message Fabien COELHO 2019-01-18 22:01:07 Re: PSA: we lack TAP test coverage on NetBSD and OpenBSD