The lookupCanonicalizeRanges()
function returns the canonical
version(s) of its ranges argument, which is zero or more ranges
of the syntaxes acceptable to lookup()
(here):
lookupCanonicalizeRanges(ranges, keyType)
The canonical version always includes both a lower and upper inclusive/exclusive bracket/brace, both lower and upper bounds (unless unlimited), the ".." range operator, and is independent of other ranges that may be in the sequence.
The keyType parameter is a varchar
string denoting the
SQL type of the key field that would be looked up in the given
range(s). This ensures that comparisons are done correctly. E.g. for
a strlst
range list of "0,500,1000", keyType
should be "integer", so that "500" is not compared
alphabetically with "1000" and considered invalid (greater than).
This function can be used to verify the syntax of a range, or to
transform it into a standard form for lookupParseRange()
(here).
CAVEATS
For an implicit-upper-bound range, the upper bound is determined by
the next range's lower bound. Thus the full list of ranges (if
multiple) should be given to lookupCanonicalizeRanges()
- even
if only one range needs to be canonicalized - so that each range gets
its proper bounds.
The lookupCanonicalizeRanges()
function was added in version
7.06.1528837000 20180612. The keyType parameter was added
in version 7.06.1535500000 20180828.
SEE ALSOlookup
, lookupParseRange