summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-11-07 18:02:12 +0200
committerunknown <gkodinov/kgeorge@magare.gmz>2007-11-07 18:02:12 +0200
commit36d1659a80ce09f480e2af9efa9c6eb32157ec02 (patch)
tree140d8f5bb77d6dc0a38d61239755b4fa963e6108 /sql/sql_select.h
parent2a0f4e4faf8e0f48f25a39775aa4d34b13f43310 (diff)
downloadmariadb-git-36d1659a80ce09f480e2af9efa9c6eb32157ec02.tar.gz
Bug #31928: Search fails on '1000-00-00' date after sql_mode change
When constructing a key image stricter date checking (from sql_mode) should not be enabled, because it will reject invalid dates that the server would otherwise accept for searching when there's no index. Fixed by disabling strict date checking when constructing a key image. mysql-test/r/type_date.result: Bug #31928: test case mysql-test/t/type_date.test: Bug #31928: test case sql/sql_select.h: Bug #31928: Disable strict date checking when consructing a key image
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4fc32e7fdb3..42be8d3ec68 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -548,14 +548,17 @@ public:
enum store_key_result copy()
{
enum store_key_result result;
- enum_check_fields saved_count_cuted_fields=
- to_field->table->in_use->count_cuted_fields;
+ THD *thd= to_field->table->in_use;
+ enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
+ ulong sql_mode= thd->variables.sql_mode;
+ thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
- to_field->table->in_use->count_cuted_fields= CHECK_FIELD_IGNORE;
+ thd->count_cuted_fields= CHECK_FIELD_IGNORE;
result= copy_inner();
- to_field->table->in_use->count_cuted_fields= saved_count_cuted_fields;
+ thd->count_cuted_fields= saved_count_cuted_fields;
+ thd->variables.sql_mode= sql_mode;
return result;
}