• Tom Lane's avatar
    Restructure function-internal caching in the range type code. · 37ee4b75
    Tom Lane authored
    Move the responsibility for caching specialized information about range
    types into the type cache, so that the catalog lookups only have to occur
    once per session.  Rearrange APIs a bit so that fn_extra caching is
    actually effective in the GiST support code.  (Use of OidFunctionCallN is
    bad enough for performance in itself, but it also prevents the function
    from exploiting fn_extra caching.)
    
    The range I/O functions are still not very bright about caching repeated
    lookups, but that seems like material for a separate patch.
    
    Also, avoid unnecessary use of memcpy to fetch/store the range type OID and
    flags, and don't use the full range_deserialize machinery when all we need
    to see is the flags value.
    
    Also fix API error in range_gist_penalty --- it was failing to set *penalty
    for any case involving an empty range.
    37ee4b75
typcache.h 4.26 KB