• Alvaro Herrera's avatar
    Fix SET CONSTRAINTS .. DEFERRED on partitioned tables · b4bcc6bf
    Alvaro Herrera authored
    SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a
    sanity check that ensures that the affected constraints have triggers.
    On partitioned tables, the triggers are in the leaf partitions, not in
    the partitioned relations themselves, so the sanity check fails.
    Removing the sanity check solves the problem, because the code needed to
    support the case is already there.
    
    Backpatch to 11.
    
    Note: deferred unique constraints are not affected by this bug, because
    they do have triggers in the parent partitioned table.  I did not add a
    test for this scenario.
    
    Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql
    b4bcc6bf
foreign_key.out 106 KB