• Tom Lane's avatar
    Fix select_common_type() so that it can select a domain type, if all inputs · 07daff63
    Tom Lane authored
    to a UNION, CASE, or related construct are of the same domain type.  The
    main part of this routine smashes domains to their base types, which seems
    necessary because the logic involves TypeCategory() and IsPreferredType(),
    neither of which work usefully on domains.  However, we can add a first
    pass that just detects whether all the inputs are exactly the same type,
    and if so accept that without question (so long as it's not UNKNOWN).
    Per recent gripe from Dean Rasheed.
    
    In passing, remove some tests for InvalidOid, which have clearly been dead
    code for quite some time now, because getBaseType() would fail on that input.
    
    Also, clarify the manual's not-very-precise description of the existing
    algorithm's behavior.
    07daff63
domain.out 17.4 KB