diff options
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index ff1d70e7f8e..2be2a85b889 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -433,6 +433,12 @@ bool Sql_cmd_update::update_single_table(THD *thd) goto produce_explain_and_leave; } } + if (conds && thd->lex->are_date_funcs_used()) + { + /* Rewrite datetime comparison conditions into sargable */ + conds= conds->top_level_transform(thd, &Item::date_conds_transformer, + (uchar *) 0); + } // Don't count on usage of 'only index' when calculating which key to use table->covering_keys.clear_all(); |