Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lec61-0001cy-5i for pgsql-hackers@arkaria.postgresql.org; Thu, 06 May 2021 11:23:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lec5y-0002Y5-GK for pgsql-hackers@arkaria.postgresql.org; Thu, 06 May 2021 11:23:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lec5y-0002Xx-2F for pgsql-hackers@lists.postgresql.org; Thu, 06 May 2021 11:23:06 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lec5s-0002lv-HR for pgsql-hackers@lists.postgresql.org; Thu, 06 May 2021 11:23:04 +0000 Received: from [10.0.1.15] (unknown [188.123.231.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id C7A7C21C817B; Thu, 6 May 2021 14:22:57 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1620300177; bh=52Jr7Qrx60Nks/ExnLYERqFNEQ7JtSUW1CFzUkXzf9g=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=UslpAPBYyJBHeC/V+SBKgBZmkXkMK/W64cJf8PIpMCWQvpf282E7xtF6hUl5DxYEX 2kLzY0sF6QgCCkmvBS59868lgf3rz8LjabKCNBmmBCtTNrw0PuFsN1Kl0zE8RHXUTD yhlu1Tjp9vAV1coRf3BXvBr+UinQ1PzlnUTTPjx0= Subject: Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY To: Amit Langote Cc: =?UTF-8?Q?=c3=81lvaro_Herrera?= , Justin Pryzby , Tom Lane , "pgsql-hackers@lists.postgresql.org" References: <20210427163226.GA30032@alvherre.pgsql> <20210427233211.GA21358@alvherre.pgsql> <0688e7c3-8bc8-a3e4-9d8e-3bcbbf3e1f4d@postgrespro.ru> From: Pavel Luzanov Message-ID: <7b1ff3fb-2002-a09e-8e60-1b79086ac294@postgrespro.ru> Date: Thu, 6 May 2021 14:22:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 06.05.2021 08:35, Amit Langote wrote: > On Wed, May 5, 2021 at 7:59 PM Pavel Luzanov > wrote: >> I found this in the documentation, section '5.11.3. Partitioning >> Using Inheritance'[1]: "Some operations require a stronger lock when >> using declarative partitioning than when using table inheritance. For >> example, removing a partition from a partitioned table requires >> taking an ACCESS EXCLUSIVE lock on the parent table, whereas a SHARE >> UPDATE EXCLUSIVE lock is enough in the case of regular inheritance." >> This point is no longer valid with some restrictions. If the table >> has a default partition, then removing a partition still requires >> taking an ACCESS EXCLUSIVE lock. May be make sense to add some >> details about DETACH CONCURRENTLY to the section '5.11.2.2. Partition >> Maintenance' and completely remove this point? 1. >> https://www.postgresql.org/docs/devel/ddl-partitioning.html#DDL-PARTITIONING-USING-INHERITANCE > That makes sense, thanks for noticing. How about the attached? I like it. Especially the link to the ALTER TABLE, this avoids duplication of all the nuances of the the DETACH .. CONCURRENTLY. -- Pavel Luzanov Postgres Professional: https://postgrespro.com The Russian Postgres Company