Thread

Commits

  1. Fix handling of container types in find_composite_type_dependencies.

  1. More fun with container types

    Tom Lane <tgl@sss.pgh.pa.us> — 2017-08-09T20:03:44Z

    While poking at the arrays-of-domains TODO item, I found yet another area
    in which the existing code fails to handle existing supported cases.
    Specifically, although DefineRange will happily take domains or composites
    as a range subtype, and we already noticed that domains-over-array-of-
    composite are supported, find_composite_type_dependencies is innocent of
    the idea that the target type might be embedded in anything but an array
    or composite type.  The test cases in the attached patch show cases where
    HEAD either fails to notice stored data violating a proposed new domain
    constraint, or hits assertion failures or core dumps.
    
    The patch addresses this by generalizing the existing special case for
    array-over-composite so that any type that's directly dependent on the
    target type (which could be its array type, or a domain or range over
    it) is treated as a container type and recursively scanned for.
    
    I believe this coding will work without any further changes for the
    case of arrays over domains, but I've not fully tested that yet.
    
    I intend to apply and back-patch this shortly, unless anyone has a
    better idea about how to handle such cases.
    
    			regards, tom lane