• Michael Paquier's avatar
    Ignore inherited temp relations from other sessions when truncating · 1e504f01
    Michael Paquier authored
    Inheritance trees can include temporary tables if the parent is
    permanent, which makes possible the presence of multiple temporary
    children from different sessions.  Trying to issue a TRUNCATE on the
    parent in this scenario causes a failure, so similarly to any other
    queries just ignore such cases, which makes TRUNCATE work
    transparently.
    
    This makes truncation behave similarly to any other DML query working on
    the parent table with queries which need to be work on the children.  A
    set of isolation tests is added to cover basic cases.
    
    Reported-by: Zhou Digoal
    Author: Amit Langote, Michael Paquier
    Discussion: https://postgr.es/m/15565-ce67a48d0244436a@postgresql.org
    Backpatch-through: 9.4
    1e504f01
inherit-temp.out 6.29 KB