mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
Disallow range optimization for BETWEEN when casting one of the arguments from STRING to a numeric type would be required to construct a range for the query. Adds a new method on Item_func_between called can_optimize_range_const which allows range optimization when the types of the arguments to BETWEEN would permit it.
This commit is contained in:
committed by
Dave Gosselin
parent
07b442aa68
commit
15fd232da4
@@ -1003,6 +1003,23 @@ public:
|
||||
|
||||
class Item_func_between :public Item_func_opt_neg
|
||||
{
|
||||
/*
|
||||
If the types of the arguments to BETWEEN permit, then:
|
||||
|
||||
WHERE const1 BETWEEN expr2 AND field1
|
||||
can be optimized as if it was just:
|
||||
WHERE const1 <= field1
|
||||
|
||||
as expr2 could be an arbitrary expression. More generally,
|
||||
this optimization is permitted if aggregation for comparison
|
||||
for three expressions (const1,const2,field1) and for two
|
||||
expressions (const1,field1) return the same type handler.
|
||||
|
||||
@param [IN] field_item - This is a field from the right side
|
||||
of the BETWEEN operator.
|
||||
*/
|
||||
bool can_optimize_range_const(Item_field *field_item) const;
|
||||
|
||||
protected:
|
||||
SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param,
|
||||
Field *field, Item *value) override;
|
||||
|
Reference in New Issue
Block a user