On 2018/06/13 21:06, David Rowley wrote: > There's also something pretty weird around the removal of the temp > relation from the partition bound. I've had cases where the session > that attached the temp table is long gone, but \d+ shows the table is > still there and I can't attach another partition due to an overlap, > and can't drop the temp table due to the session not existing anymore. > I've not got a test case for that one yet, but the test case for the > crash is: > > -- Session 1: > create table listp (a int) partition by list(a); > create table listp1 partition of listp for values in(1); > create temp table listp2 partition of listp for values in (2); > > -- Session 2: > select * from listp;
When Session 2 crashes (kill -9'ing it would also suffice), for some reason, Session 1 doesn't get an opportunity to perform RemoveTempRelationsCallback(). So, both the listp2's entry pg_class and any references to it (such as its pg_inherits entry as partition of listp) persist. listp2 won't be removed from the partition bound until all of those catalog entries get removed. Thanks, Amit