diff options
author | Martin Hansson <martin.hansson@oracle.com> | 2011-01-19 15:09:32 +0100 |
---|---|---|
committer | Martin Hansson <martin.hansson@oracle.com> | 2011-01-19 15:09:32 +0100 |
commit | 03db0de64f7faca1ff731b81c18595bd25c57d00 (patch) | |
tree | feae43ad85767b6832ddf9e45f72a8bc880e92d1 /sql | |
parent | 1614c92709aead35edbcfbfb859444df7c003991 (diff) | |
download | mariadb-git-03db0de64f7faca1ff731b81c18595bd25c57d00.tar.gz |
Bug#59173: Failure to handle DATE(TIME) values where Year, Month or Day is
ZERO
When dates are represented internally as strings, i.e. when a string constant
is compared to a date value, both values are converted to long integers,
ostensibly for fast comparisons. DATE typed integer values are converted to
DATETIME by multiplying by 1,000,000 (each digit pair representing hour,
minute and second, respectively). But the mechanism did not distuinguish
cached INTEGER values, already in correct format, from newly converted
strings.
Fixed by marking the INTEGER cache as being of DATETIME format.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index d2e1ebbb3a1..40056cfd1ef 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -913,7 +913,7 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg, cache_converted_constant can't be used here because it can't correctly convert a DATETIME value from string to int representation. */ - Item_cache_int *cache= new Item_cache_int(); + Item_cache_int *cache= new Item_cache_int(MYSQL_TYPE_DATETIME); /* Mark the cache as non-const to prevent re-caching. */ cache->set_used_tables(1); if (!(*a)->is_datetime()) |