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 1lS9n6-0003mC-9M for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Apr 2021 02:44:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lS9n5-0003QD-7a for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Apr 2021 02:44:07 +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 1lS9n5-0003Q5-0f for pgsql-hackers@lists.postgresql.org; Fri, 02 Apr 2021 02:44:07 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lS9n1-0008G1-6x for pgsql-hackers@lists.postgresql.org; Fri, 02 Apr 2021 02:44:06 +0000 Received: from hnk.local (p2350207-ipbf2126funabasi.chiba.ocn.ne.jp [114.167.184.207]) by oss.nttdata.com (Postfix) with ESMTPSA id C6C7362739; Fri, 2 Apr 2021 11:43:58 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: TRUNCATE on foreign table To: Kohei KaiGai Cc: Kazutaka Onishi , Amit Langote , Ibrar Ahmed , Bharath Rupireddy , Zhihong Yu , PostgreSQL Developers , Ashutosh Bapat References: <66da56a4-ed5a-a18f-0f5e-b4d21cda71af@oss.nttdata.com> <420c3d7d-1961-4cf0-01f9-6c693a3189a8@oss.nttdata.com> From: Fujii Masao Message-ID: <1ded9ac5-c5a0-15ed-71da-ba3e0c21dacf@oss.nttdata.com> Date: Fri, 2 Apr 2021 11:43:58 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021/04/02 9:37, Kohei KaiGai wrote: > It is fair enough for me to reverse the order of actual truncation. > > How about the updated comments below? > > This is a multi-relation truncate. We first open and grab exclusive > lock on all relations involved, checking permissions (local database > ACLs even if relations are foreign-tables) and otherwise verifying > that the relation is OK for truncation. In CASCADE mode, ...(snip)... > Finally all the relations are truncated and reindexed. If any foreign- > tables are involved, its callback shall be invoked prior to the truncation > of regular tables. LGTM. >> BTW, the latest patch doesn't seem to be applied cleanly to the master >> because of commit 27e1f14563. Could you rebase it? >> > Onishi-san, go ahead. :-) +1 Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION