summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-07-18 14:47:40 +0200
committerSergei Golubchik <serg@mariadb.org>2017-07-18 14:59:33 +0200
commit9b3360ea4417ed653d5c7eed29f4ef7e80618e43 (patch)
treeecd7b7db6547f5ad1e80dda928f79ee176f5efcf /sql
parentf6bcdb9e3c955f0a998a996edd93362deca31edf (diff)
downloadmariadb-git-9b3360ea4417ed653d5c7eed29f4ef7e80618e43.tar.gz
BUG#25250768: WRITING ON A READ_ONLY=ON SERVER WITHOUT SUPER PRIVILEGE
simplify. add a test case.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc26
1 files changed, 9 insertions, 17 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 83cd6cccba5..1d596ed9df7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -835,24 +835,16 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
if (lex->sql_command == SQLCOM_UPDATE_MULTI)
DBUG_RETURN(FALSE);
- const my_bool create_temp_tables=
- (lex->sql_command == SQLCOM_CREATE_TABLE) &&
- (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
-
- const my_bool create_real_tables=
- (lex->sql_command == SQLCOM_CREATE_TABLE) &&
- !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
-
- const my_bool drop_temp_tables=
- (lex->sql_command == SQLCOM_DROP_TABLE) &&
- lex->drop_temporary;
-
- const my_bool update_real_tables=
- ((create_real_tables ||
- some_non_temp_table_to_be_updated(thd, all_tables)) &&
- !(create_temp_tables || drop_temp_tables));
+ /*
+ a table-to-be-created is not in the temp table list yet,
+ so CREATE TABLE needs a special treatment
+ */
+ const bool update_real_tables=
+ lex->sql_command == SQLCOM_CREATE_TABLE
+ ? !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
+ : some_non_temp_table_to_be_updated(thd, all_tables);
- const my_bool create_or_drop_databases=
+ const bool create_or_drop_databases=
(lex->sql_command == SQLCOM_CREATE_DB) ||
(lex->sql_command == SQLCOM_DROP_DB);