mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug #16249: different results for a range with an without index
when a range condition use an invalid DATETIME constant. Now we do not use invalid DATETIME constants to form end keys for range intervals: range analysis just ignores predicates with such constants.
This commit is contained in:
@ -4129,6 +4129,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
||||
MEM_ROOT *alloc= param->mem_root;
|
||||
char *str;
|
||||
ulong orig_sql_mode;
|
||||
int err;
|
||||
DBUG_ENTER("get_mm_leaf");
|
||||
|
||||
/*
|
||||
@ -4280,7 +4281,13 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
||||
(field->type() == FIELD_TYPE_DATE ||
|
||||
field->type() == FIELD_TYPE_DATETIME))
|
||||
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
|
||||
if (value->save_in_field_no_warnings(field, 1) < 0)
|
||||
err= value->save_in_field_no_warnings(field, 1);
|
||||
if (err > 0 && field->cmp_type() != value->result_type())
|
||||
{
|
||||
tree= 0;
|
||||
goto end;
|
||||
}
|
||||
if (err < 0)
|
||||
{
|
||||
field->table->in_use->variables.sql_mode= orig_sql_mode;
|
||||
/* This happens when we try to insert a NULL field in a not null column */
|
||||
|
Reference in New Issue
Block a user