diff options
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 93ec11ca063..dcf61e9b085 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -464,6 +464,12 @@ bool Sql_cmd_delete::delete_from_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); + } #ifdef WITH_PARTITION_STORAGE_ENGINE if (prune_partitions(thd, table, conds)) |