diff options
author | unknown <gkodinov/kgeorge@magare.gmz> | 2007-10-22 19:32:18 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@magare.gmz> | 2007-10-22 19:32:18 +0300 |
commit | 849bcf941fca633c66597ee9c9efac3f443b63b9 (patch) | |
tree | ce0c8994df3f74e763a75f23117a711956dac0c6 /sql/item.cc | |
parent | 578c23860021d7eda334e42b17c90e039474587f (diff) | |
download | mariadb-git-849bcf941fca633c66597ee9c9efac3f443b63b9.tar.gz |
Bug #28687: Search fails on '0000-00-00' date after sql_mode change
When doing indexed search the server constructs a key image for
faster comparison to the stored keys. While doing that it must not
perform (and stop if they fail) the additional date checks that can
be turned on by the SQL mode because there already may be values in
the table that don't comply with the error checks.
Fixed by ignoring these SQL mode bits while making the key image.
mysql-test/r/type_date.result:
Bug #28687: test case
mysql-test/t/type_date.test:
Bug #28687: test case
sql/item.cc:
Bug #28687: no invalid date warnings
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 918e6371a2d..83cbf261b8a 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -938,9 +938,12 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions) int res; THD *thd= field->table->in_use; enum_check_fields tmp= thd->count_cuted_fields; + ulong sql_mode= thd->variables.sql_mode; + thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE); thd->count_cuted_fields= CHECK_FIELD_IGNORE; res= save_in_field(field, no_conversions); thd->count_cuted_fields= tmp; + thd->variables.sql_mode= sql_mode; return res; } |