summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-12-17 22:34:56 +0200
committerMichael Widenius <monty@askmonty.org>2012-12-17 22:34:56 +0200
commit2dbce3d0896d571c7ffd631beeac4a6a902bea17 (patch)
treee54fe9f0f9abbe276ceeb9def752eec2eaaf2064 /sql/sql_parse.cc
parentd7a0148758335f3237f0b78a074be4a0a06944dc (diff)
downloadmariadb-git-2dbce3d0896d571c7ffd631beeac4a6a902bea17.tar.gz
Fixed the CREATE TABLE IF EXIST generates warnings instead of errors
mysql-test/r/create.result: Updated test results mysql-test/t/create.test: Updated test sql/sql_base.cc: Use push_internal_handler/pop_internal_handler to avoid errors & warnings instead of clear_error Give a warnings instead of an error for CREATE TABLE IF EXISTS sql/sql_parse.cc: Check if we failed because of table exists (can only happen from create) sql/sql_table.cc: Check if we failed because of table exists (can only happen from create)
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc9
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)