diff --git a/sql/sql_show.cc b/sql/sql_show.cc
|
index 11d1a739eb2..561aaa3d46a 100644
|
--- a/sql/sql_show.cc
|
+++ b/sql/sql_show.cc
|
@@ -5803,9 +5803,9 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
|
/**
|
@brief Fill IS.table with temporary tables
|
+ @param[in] thd thread handle
|
@param[in] table I_S table (TABLE)
|
- @param[in] db_name db name of temporary table
|
- @param[in] table_name table name of temporary table
|
+ @param[in] table_name temporary table
|
@return Operation status
|
@retval 0 - success
|
@retval 1 - failure
|
|
The above doesn't match the function parameters:
|
|
void process_i_s_table_temporary_tables(THD *thd, TABLE * table, TABLE *tmp_tbl)
|
|
Please update.
|
|
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
|
index f52733c2640..9315ef06e90 100644
|
--- a/sql/sql_table.cc
|
+++ b/sql/sql_table.cc
|
@@ -4369,6 +4369,9 @@ int create_table_impl(THD *thd,
|
#else
|
warning_given=1;
|
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
|
+ if (create_table_mode == C_ALTER_TABLE_FRM_ONLY || create_table_mode == C_ALTER_TABLE)
|
+ warning_given= 0;
|
+
|
if (warning_given)
|
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
ER_TABLE_EXISTS_ERROR,
|
|
In the code you are first setting warning_given and then reseting it.
|
Better to not set warning_given at all.
|
|
An alternative patch is:
|
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
|
index 9315ef06e90..79c8a946487 100644
|
--- a/sql/sql_table.cc
|
+++ b/sql/sql_table.cc
|
@@ -4357,26 +4357,28 @@ int create_table_impl(THD *thd,
|
ddl_log_state_create= 0;
|
ddl_log_state_rm= 0;
|
|
- if (ha_table_exists(thd, &orig_db, &orig_table_name, NULL, NULL, NULL))
|
+ if (create_table_mode != C_ALTER_TABLE_FRM_ONLY &&
|
+ create_table_mode != C_ALTER_TABLE)
|
{
|
+ if (ha_table_exists(thd, &orig_db, &orig_table_name, NULL, NULL, NULL))
|
+ {
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
- TABLE_LIST table_acl_check;
|
- bzero((char*) &table_acl_check, sizeof(table_acl_check));
|
- table_acl_check.db= orig_db;
|
- table_acl_check.table_name= orig_table_name;
|
- if (!check_table_access(thd, TABLE_ACLS, &table_acl_check, true, 1, true))
|
- warning_given= 1;
|
+ TABLE_LIST table_acl_check;
|
+ bzero((char*) &table_acl_check, sizeof(table_acl_check));
|
+ table_acl_check.db= orig_db;
|
+ table_acl_check.table_name= orig_table_name;
|
+ if (!check_table_access(thd, TABLE_ACLS, &table_acl_check, true, 1, true))
|
+ warning_given= 1;
|
#else
|
- warning_given=1;
|
+ warning_given=1;
|
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
|
- if (create_table_mode == C_ALTER_TABLE_FRM_ONLY || create_table_mode == C_ALTER_TABLE)
|
- warning_given= 0;
|
|
- if (warning_given)
|
+ if (warning_given)
|
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
ER_TABLE_EXISTS_ERROR,
|
ER_THD(thd, ER_TABLE_EXISTS_ERROR),
|
orig_table_name.str);
|
+ }
|
}
|
}
|
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 11d1a739eb2..561aaa3d46a 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -5803,9 +5803,9 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
/**
@brief Fill IS.table with temporary tables
+ @param[in] thd thread handle
@param[in] table I_S table (TABLE)
- @param[in] db_name db name of temporary table
- @param[in] table_name table name of temporary table
+ @param[in] table_name temporary table
@return Operation status
@retval 0 - success
@retval 1 - failure
The above doesn't match the function parameters:
void process_i_s_table_temporary_tables(THD *thd, TABLE * table, TABLE *tmp_tbl)
Please update.
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f52733c2640..9315ef06e90 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4369,6 +4369,9 @@ int create_table_impl(THD *thd,
#else
warning_given=1;
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
+ if (create_table_mode == C_ALTER_TABLE_FRM_ONLY || create_table_mode == C_ALTER_TABLE)
+ warning_given= 0;
+
if (warning_given)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR,
In the code you are first setting warning_given and then reseting it.
Better to not set warning_given at all.
An alternative patch is:
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9315ef06e90..79c8a946487 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4357,26 +4357,28 @@ int create_table_impl(THD *thd,
ddl_log_state_create= 0;
ddl_log_state_rm= 0;
- if (ha_table_exists(thd, &orig_db, &orig_table_name, NULL, NULL, NULL))
+ if (create_table_mode != C_ALTER_TABLE_FRM_ONLY &&
+ create_table_mode != C_ALTER_TABLE)
{
+ if (ha_table_exists(thd, &orig_db, &orig_table_name, NULL, NULL, NULL))
+ {
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- TABLE_LIST table_acl_check;
- bzero((char*) &table_acl_check, sizeof(table_acl_check));
- table_acl_check.db= orig_db;
- table_acl_check.table_name= orig_table_name;
- if (!check_table_access(thd, TABLE_ACLS, &table_acl_check, true, 1, true))
- warning_given= 1;
+ TABLE_LIST table_acl_check;
+ bzero((char*) &table_acl_check, sizeof(table_acl_check));
+ table_acl_check.db= orig_db;
+ table_acl_check.table_name= orig_table_name;
+ if (!check_table_access(thd, TABLE_ACLS, &table_acl_check, true, 1, true))
+ warning_given= 1;
#else
- warning_given=1;
+ warning_given=1;
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
- if (create_table_mode == C_ALTER_TABLE_FRM_ONLY || create_table_mode == C_ALTER_TABLE)
- warning_given= 0;
- if (warning_given)
+ if (warning_given)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR,
ER_THD(thd, ER_TABLE_EXISTS_ERROR),
orig_table_name.str);
+ }
}