• Tom Lane's avatar
    Fix assorted inconsistencies in GiST opclass support function declarations. · 9ff60273
    Tom Lane authored
    The conventions specified by the GiST SGML documentation were widely
    ignored.  For example, the strategy-number argument for "consistent" and
    "distance" functions is specified to be a smallint, but most of the
    built-in support functions declared it as an integer, and for that matter
    the core code passed it using Int32GetDatum not Int16GetDatum.  None of
    that makes any real difference at runtime, but it's quite confusing for
    newcomers to the code, and it makes it very hard to write an amvalidate()
    function that checks support function signatures.  So let's try to instill
    some consistency here.
    
    Another similar issue is that the "query" argument is not of a single
    well-defined type, but could have different types depending on the strategy
    (corresponding to search operators with different righthand-side argument
    types).  Some of the functions threw up their hands and declared the query
    argument as being of "internal" type, which surely isn't right ("any" would
    have been more appropriate); but the majority position seemed to be to
    declare it as being of the indexed data type, corresponding to a search
    operator with both input types the same.  So I've specified a convention
    that that's what to do always.
    
    Also, the result of the "union" support function actually must be of the
    index's storage type, but the documentation suggested declaring it to
    return "internal", and some of the functions followed that.  Standardize
    on telling the truth, instead.
    
    Similarly, standardize on declaring the "same" function's inputs as
    being of the storage type, not "internal".
    
    Also, somebody had forgotten to add the "recheck" argument to both
    the documentation of the "distance" support function and all of their
    SQL declarations, even though the C code was happily using that argument.
    Clean that up too.
    
    Fix up some other omissions in the docs too, such as documenting that
    union's second input argument is vestigial.
    
    So far as the errors in core function declarations go, we can just fix
    pg_proc.h and bump catversion.  Adjusting the erroneous declarations in
    contrib modules is more debatable: in principle any change in those
    scripts should involve an extension version bump, which is a pain.
    However, since these changes are purely cosmetic and make no functional
    difference, I think we can get away without doing that.
    9ff60273
pg_amproc.h 24.9 KB