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 1gbav5-0003Ab-K7 for pgsql-bugs@arkaria.postgresql.org; Tue, 25 Dec 2018 00:50:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gbav4-0003kO-6r for pgsql-bugs@arkaria.postgresql.org; Tue, 25 Dec 2018 00:50:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gbav3-0003k5-TX for pgsql-bugs@lists.postgresql.org; Tue, 25 Dec 2018 00:50:02 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gbauz-0004Yr-KY; Tue, 25 Dec 2018 00:50:00 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id wBP0nr7C020481; Tue, 25 Dec 2018 09:49:53 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id E9959637B3D; Tue, 25 Dec 2018 09:49:52 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id DDF1A638584; Tue, 25 Dec 2018 09:49:52 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id C58FA400CBC; Tue, 25 Dec 2018 09:49:52 +0900 (JST) Subject: Re: BUG #15565: truncate bug with tables which have temp table inherited References: <15565-ce67a48d0244436a@postgresql.org> From: Amit Langote Message-ID: <0285c6d1-2d11-2f2c-6fae-d4575cdc3c7b@lab.ntt.co.jp> Date: Tue, 25 Dec 2018 09:49:43 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <15565-ce67a48d0244436a@postgresql.org> Content-Type: multipart/mixed; boundary="------------F01D26B13FE5F3B7A0D8BA87" Content-Language: en-US X-CC-Mail-RelayStamp: 1 To: digoal@126.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------F01D26B13FE5F3B7A0D8BA87 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hi, On 2018/12/24 18:17, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 15565 > Logged by: Zhou Digoal > Email address: digoal@126.com > PostgreSQL version: 11.1 > Operating system: CentOS 7.x x64 > Description: > > ``` > create table public.a (id int); > ``` > > sesssion a: > > ``` > create temp table a (like public.a) inherits(public.a); > ``` > > session b: > ``` > create temp table a (like public.a) inherits(public.a); > ``` > > any session: > > ``` > postgres=# truncate public.a; > ERROR: cannot truncate temporary tables of other sessions > ``` > > but delete,select,update is ok; I'm not sure if the error being shown is a bug, but maybe we could remove the error by making truncate do the same thing as select/update/delete, that is, ignore child tables that are temporary of tables of other sessions. Attached patch to do that. Thanks, Amit --------------F01D26B13FE5F3B7A0D8BA87 Content-Type: text/plain; charset=UTF-8; name="truncate-ignore-other-session-temp-children.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="truncate-ignore-other-session-temp-children.patch" ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL2NvbW1hbmRzL3RhYmxlY21kcy5jIGIvc3JjL2Jh Y2tlbmQvY29tbWFuZHMvdGFibGVjbWRzLmMKaW5kZXggYWQ4Yz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