summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2010-09-13 11:18:35 +0400
committerGleb Shchepa <gshchepa@mysql.com>2010-09-13 11:18:35 +0400
commitdaa6d1f4f322b1ceaa2fbbdeef76bbbd0b30dab1 (patch)
treef0249a1480e70dcc1389e53c93317003ea167b7d /sql/item.cc
parent223112ad427bb7a0af1f8b19bf32f409b792ed13 (diff)
downloadmariadb-git-daa6d1f4f322b1ceaa2fbbdeef76bbbd0b30dab1.tar.gz
Bug #55779: select does not work properly in mysql server
Version "5.1.42 SUSE MySQL RPM" When a query was using a DATE or DATETIME value formatted using different formatting than "yyyy-mm-dd HH:MM:SS", a query with a greater-or-equal '>=' condition matched only greater values in an indexed TIMESTAMP column. The problem was introduced by the fix for the bug 46362 and partially solved (for DATE and DATETIME columns only) by the fix for the bug 47925. The stored_field_cmp_to_item function has been modified to take into account TIMESTAMP columns like we do for DATE and DATETIME columns. mysql-test/r/type_timestamp.result: Test case for bug #55779. mysql-test/t/type_timestamp.test: Test case for bug #55779. sql/item.cc: Bug #55779: select does not work properly in mysql server Version "5.1.42 SUSE MySQL RPM" The stored_field_cmp_to_item function has been modified to take into account TIMESTAMP columns like we do for DATE and DATETIME.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 29529abe7b9..61dd8a97dcb 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6970,14 +6970,16 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
enum_field_types field_type= field->type();
- if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME)
+ if (field_type == MYSQL_TYPE_DATE || field_type == MYSQL_TYPE_DATETIME ||
+ field_type == MYSQL_TYPE_TIMESTAMP)
{
enum_mysql_timestamp_type type= MYSQL_TIMESTAMP_ERROR;
if (field_type == MYSQL_TYPE_DATE)
type= MYSQL_TIMESTAMP_DATE;
- if (field_type == MYSQL_TYPE_DATETIME)
+ if (field_type == MYSQL_TYPE_DATETIME ||
+ field_type == MYSQL_TYPE_TIMESTAMP)
type= MYSQL_TIMESTAMP_DATETIME;
const char *field_name= field->field_name;