Re: Partition Check not updated when insert into a partition

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Partition Check not updated when insert into a partition
Date: 2021-08-27 09:20:11
Message-ID: CA+HiwqEkFDaCHs+8ra5c97Ok8fFVjHxkuGRbZXjUwwcQJ3w5qA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 5, 2021 at 11:32 AM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Wed, Jul 14, 2021 at 11:16 AM houzj(dot)fnst(at)fujitsu(dot)com
> > On Tuesday, July 13, 2021 2:52 AM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> > > Did you have a misbehaving test for the ATTACH case?
> >
> > Thanks for the response.
>
> Thank you both.
>
> > Yes, I think the following example of ATTACH doesn't work as expected.
>
> Yeah, need the fix for the ATTACH case too.
>
> Couple more things:
>
> * We must invalidate not just the "direct" partitions of the table
> being attached/detached, but also any indirect ones, because all of
> their partition constraints would need to contain (or no longer
> contain) the root parent's partition constraint.
>
> * I think we should lock the partitions before sending the
> invalidation. The ATTACH code already locks the descendents for a
> different purpose, but DETACH doesn't, so the latter needs to be fixed
> to match.
>
> I've updated Alvaro's patch to address these points. Maybe, we should
> also add these cases to the regression and isolation suites?

Apparently, I had posted a version of the patch that didn't even compile.

I have fixed that in the attached and also added regression tests.

Adding this to the next CF.

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

Attachment Content-Type Size
v3-0001-Invalidate-partitions-of-table-being-attached-det.patch application/octet-stream 5.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2021-08-27 09:32:21 Re: Mark all GUC variable as PGDLLIMPORT
Previous Message Laurenz Albe 2021-08-27 07:33:51 Re: Can we get rid of repeated queries from pg_dump?