diff options
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5dac052b749..de35d2f3d27 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2512,7 +2512,14 @@ case SQLCOM_PREPARE: goto end_with_restore_list; } - if (!(res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0))) + res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0); + if (res) + { + /* Got error or warning. Set res to 1 if error */ + if (!(res= thd->is_error())) + my_ok(thd); // CREATE ... IF NOT EXISTS + } + else { /* The table already exists */ if (create_table->table) |