summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <kaa@polly.local>2006-11-20 17:35:23 +0300
committerunknown <kaa@polly.local>2006-11-20 17:35:23 +0300
commit2b720487f0cda632d1a0b590744c7b38b8ac4434 (patch)
treec0d411207a9f398911d37b202d2c4fcd26ecf631 /sql
parent154c6e06775d6e644fd4e5f863104ab566fc4a68 (diff)
downloadmariadb-git-2b720487f0cda632d1a0b590744c7b38b8ac4434.tar.gz
Fix for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
Do not issue a 'read-only' error in case of DROP TEMPORARY TABLE on a non-existing temporary table. Instead produce the correct "Unknown table" error or warning (in cases when the IF EXISTS clause was specified). To a documentor: the part of the manual describing the 'read_only' system variable should be clarified to state the following: "When the read_only variable is set to ON, all operations which create/update/drop tables are rejected with the exceptions for: 1. Any operation performed by the replication thread on a slave server 2. Any operation performed by a user that have the SUPER privilege 3. Any operation that creates/updates/drops only temporary tables" mysql-test/r/read_only.result: Added testcases for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set" mysql-test/t/read_only.test: Added testcases for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set" sql/sql_parse.cc: Before issuing the 'read-only' error also check if the operation is not a DROP TEMPORARY TABLE statement
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 4992d2514c9..eda58f6d798 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2515,12 +2515,13 @@ mysql_execute_command(THD *thd)
tables. Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
- !(thd->security_ctx->master_access & SUPER_ACL) &&
- uc_update_queries[lex->sql_command] &&
- !((lex->sql_command == SQLCOM_CREATE_TABLE) &&
- (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
- ((lex->sql_command != SQLCOM_UPDATE_MULTI) &&
- some_non_temp_table_to_be_updated(thd, all_tables)))
+ !(thd->security_ctx->master_access & SUPER_ACL) &&
+ uc_update_queries[lex->sql_command] &&
+ !((lex->sql_command == SQLCOM_CREATE_TABLE) &&
+ (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
+ !((lex->sql_command == SQLCOM_DROP_TABLE) && lex->drop_temporary) &&
+ ((lex->sql_command != SQLCOM_UPDATE_MULTI) &&
+ some_non_temp_table_to_be_updated(thd, all_tables)))
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
DBUG_RETURN(-1);