• Tom Lane's avatar
    Fix management of fn_extra caching during repeated GiST index scans. · 91715e82
    Tom Lane authored
    Commit d22a09dc introduced official support
    for GiST consistentFns that want to cache data using the FmgrInfo fn_extra
    pointer: the idea was to preserve the cached values across gistrescan(),
    whereas formerly they'd been leaked.  However, there was an oversight in
    that, namely that multiple scan keys might reference the same column's
    consistentFn; the code would result in propagating the same cache value
    into multiple scan keys, resulting in crashes or wrong answers.  Use a
    separate array instead to ensure that each scan key keeps its own state.
    
    Per bug #8143 from Joel Roller.  Back-patch to 9.2 where the bug was
    introduced.
    91715e82
gistscan.c 9.07 KB