Re: a misbehavior of partition row movement (?)

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Arne Roland <A(dot)Roland(at)index(dot)de>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: a misbehavior of partition row movement (?)
Date: 2022-01-17 11:40:54
Message-ID: CA+HiwqH2gWBDUotwtnY7qnp+K5j0J4tzUDycqcePA7Yy1s4MbQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 11, 2022 at 8:23 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> On 2022-Jan-11, Amit Langote wrote:
> > As for the fix to make cross-partition updates work correctly with
> > foreign keys, I just realized it won't work for the users' existing
> > foreign keys, because the parent table's triggers that are needed for
> > the fix to work would not be present. Were you thinking that we'd ask
> > users of v13 and v14 to drop and recreate those constraints?
>
> Yeah, more or less. Also, any tables created from 13.6 onwards.
>
> I was mainly thinking that we'll still have people creating new clusters
> using pg13 for half a decade.

Okay, I created versions of the patch series for branches 13 and 14
(.txt files). The one for HEAD is also re-attached.

Note that the fix involves adding fields to ResultRelInfo -- v13 needs
2 additional, while v14 and HEAD need 1. That combined with needing
new catalog entries for parent FK triggers, back-patching this does
make me a bit uncomfortable. Another thing to consider is that we
haven't seen many reports of the problem (UPDATEs of partitioned PK
tables causing DELETEs in referencing tables), even though it can be
possibly very surprising to those who do run into it.

--
Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
14_v12-0002-Enforce-foreign-key-correctly-during-cross-partition.patch.txt text/plain 58.0 KB
14_v12-0001-Create-foreign-key-triggers-in-partitioned-tables-to.patch.txt text/plain 41.7 KB
v12-0001-Enforce-foreign-key-correctly-during-cross-parti.patch application/octet-stream 58.0 KB
13_v12-0001-Create-foreign-key-triggers-in-partitioned-tables-to.patch.txt text/plain 39.3 KB
13_v12-0002-Enforce-foreign-key-correctly-during-cross-partition.patch.txt text/plain 59.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2022-01-17 11:50:42 Re: ExecRTCheckPerms() and many prunable partitions
Previous Message Amul Sul 2022-01-17 11:37:48 Re: TAP test to cover "EndOfLogTLI != replayTLI" case