• Tom Lane's avatar
    Fix bogus tree-flattening logic in QTNTernary(). · 24ebc444
    Tom Lane authored
    QTNTernary() contains logic to flatten, eg, '(a & b) & c' into 'a & b & c',
    which is all well and good, but it tries to do that to NOT nodes as well,
    so that '!!a' gets changed to '!a'.  Explicitly restrict the conversion to
    be done only on AND and OR nodes, and add a test case illustrating the bug.
    
    In passing, provide some comments for the sadly naked functions in
    tsquery_util.c, and simplify some baroque logic in QTNFree(), which
    I think may have been leaking some items it intended to free.
    
    Noted while investigating a complaint from Andreas Seltenreich.
    Back-patch to all supported versions.
    24ebc444
tsearch.out 43.3 KB