Re: Partition Check not updated when insert into a partition

From: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, 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-10-15 08:01:52
Message-ID: CALT9ZEEpn0aigwfZfUyu=TuDnGfw_ypT836L4zhjJNcqE3jSRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> The lock taken on the parent is either ShareUpdateExclusiveLock or
> AccessExclusiveLock depending on whether CONCURRENTLY is specified or
> not. Maybe that should be considered also when locking the children.
>
> I've updated the patch that way. (Also, reintroduced the slightly
> longer commit message that I had added in v3. :))
>

Thanks Amit, for your work!

I am little bit reluctant to the change you made in v5. As per
https://www.postgresql.org/docs/14/sql-altertable.html:

> If CONCURRENTLY is specified, ... the second transaction acquires SHARE
UPDATE EXCLUSIVE on the partitioned table and ACCESS EXCLUSIVE on the
partition, and the detach process completes.

In comment to find_all_inheritors():

> The specified lock type is acquired on all child relations (but not on
the given rel; caller should already have locked it)

So I conclude that it is done in a right way in v3 with ACCESS_EXCLUSIVE
lock.

Also I'd recommend removing the link to a discussion from the test. Anyway
we have link in a commit message.
-- Report:
https://postgr.es/m/OS3PR01MB5718DA1C4609A25186D1FBF194089%40OS3PR01MB5718.jpnprd01.prod.outlook.com

--
Best regards,
Pavel Borisov

Postgres Professional: http://postgrespro.com <http://www.postgrespro.com>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gilles Darold 2021-10-15 08:19:01 Re: [PATCH] Proposal for HIDDEN/INVISIBLE column
Previous Message Aleksander Alekseev 2021-10-15 07:47:39 Re: [PATCH] Proposal for HIDDEN/INVISIBLE column