summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorgkodinov/kgeorge@magare.gmz <>2007-11-07 18:02:12 +0200
committergkodinov/kgeorge@magare.gmz <>2007-11-07 18:02:12 +0200
commit767dca62513b519151335a0b838c9533517402d7 (patch)
tree140d8f5bb77d6dc0a38d61239755b4fa963e6108 /sql/sql_select.h
parent9e2a6528564a33b8de931f5ba0df6ccf9c3e33cb (diff)
downloadmariadb-git-767dca62513b519151335a0b838c9533517402d7.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.
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;
}