diff options
author | unknown <igor@rurik.mysql.com> | 2006-08-31 07:27:34 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-08-31 07:27:34 -0700 |
commit | c4c36e17ac4b4dc7c80de3b6afe9aa92951bf7b5 (patch) | |
tree | 57d06c34afcf4e450d638e81495fde5baa834996 /sql/opt_range.cc | |
parent | 75865af64bdabcf0ade933de1e482a5bea0fb6e9 (diff) | |
download | mariadb-git-c4c36e17ac4b4dc7c80de3b6afe9aa92951bf7b5.tar.gz |
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.
mysql-test/r/query_cache.result:
Adjusted result warnings when adding a fix for bug #16249.
mysql-test/r/range.result:
Added a test case for bug #16249.
mysql-test/t/range.test:
Added a test case for bug #16249.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 71ba63dcf98..6189d0412b3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -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 */ |