Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hbkUF-0006Aw-DF for pgsql-docs@arkaria.postgresql.org; Fri, 14 Jun 2019 11:35:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hbkUB-0004Op-Sa for pgsql-docs@arkaria.postgresql.org; Fri, 14 Jun 2019 11:35:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hbkUB-0004Jb-Ga for pgsql-docs@lists.postgresql.org; Fri, 14 Jun 2019 11:35:11 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hbkU3-0005Od-Ny for pgsql-docs@lists.postgresql.org; Fri, 14 Jun 2019 11:35:10 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 438B021C27B4; Fri, 14 Jun 2019 14:35:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.175] (gw.postgrespro.ru [93.174.131.141]) (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 13D5E21C27AC; Fri, 14 Jun 2019 14:35:02 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1560512102; bh=Obn73ztTWu48Lw25CRwgT+TmYQBDemfBbmZMvQo1vHU=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Ou/mGJkFpGtE1WH8FEa42+WPEJNgNhupHsgdj4NP6O3fdTk8+1BpBBSy758aVzf+2 qzc3QZ0Td5e0r464MIwqCUgvDCr9+4I2ghy9p1cVg+6AgMOEia6bqspzgob7swpv93 9AYl7siJtnyH0jjOaApYd5ST1y32s3tKXOaCYWOw= Subject: Re: ATTACH/DETACH partitions and locking To: Alvaro Herrera Cc: pgsql-docs@lists.postgresql.org References: <20190613200720.GA18557@alvherre.pgsql> From: Pavel Luzanov Message-ID: <53fb248b-94c6-1822-c5d7-8563fc9a2710@postgrespro.ru> Date: Fri, 14 Jun 2019 14:35:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190613200720.GA18557@alvherre.pgsql> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: ru-RU List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 13.06.2019 23:07, Alvaro Herrera wrote: > On 2019-Jun-13, Pavel Luzanov wrote: > >> Hello, >> >> According to patch[1] and after playing with v12 beta1 I think that this >> item can be dropped from "5.11.3. Implementation Using Inheritance" section >> of v12 docs: >> >> "Some operations require a stronger lock when using declarative partitioning >> than when using table inheritance. For example, adding or removing a >> partition to or 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." > Hmm ... while you're correct that ALTER TABLE ATTACH PARTITION no longer > uses AccessExclusive lock, ALTER TABLE DETACH PARTITION continues to. > So we could remove the "adding to" bit of the paragraph, but not remove > it completely. > > https://www.postgresql.org/message-id/CA%2BTgmoY13KQZF-%3DHNTrt9UYWYx3_oYOQpu9ioNT49jGgiDpUEA%40mail.gmail.com You are right, I missed the point with DETACH. Does it make sense to change this way? "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." ----- Pavel Luzanov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company