Re: BUG #15565: truncate bug with tables which have temp tableinherited - Mailing list pgsql-bugs

From Amit Langote
Subject Re: BUG #15565: truncate bug with tables which have temp tableinherited
Date
Msg-id 0285c6d1-2d11-2f2c-6fae-d4575cdc3c7b@lab.ntt.co.jp
Whole thread Raw
In response to BUG #15565: truncate bug with tables which have temp table inherited  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #15565: truncate bug with tables which have temp table inherited
List pgsql-bugs
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

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #15565: truncate bug with tables which have temp tableinherited
Next
From: Amit Langote
Date:
Subject: Re: BUG #15552: Unexpected error in COPY to a foreign table in atransaction