The previous heuristics were naively enabling the BETWEEN optimization on successful cast of the first rhs SQL params to an integer while it was not appropriate for a lot of database resolved expressions. Thanks Alexey Chernov for the report.
Co-authored-by: Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com> Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>