MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:November 20 2006 2:35pm
Subject:bk commit into 5.0 tree (kaa:1.2334) BUG#22077
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kaa. When kaa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-11-20 17:35:23+03:00, kaa@stripped +3 -0
  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@stripped, 2006-11-20 17:35:19+03:00, kaa@stripped +5 -0
    Added testcases for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"

  mysql-test/t/read_only.test@stripped, 2006-11-20 17:35:19+03:00, kaa@stripped +12 -0
    Added testcases for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"

  sql/sql_parse.cc@stripped, 2006-11-20 17:35:19+03:00, kaa@stripped +7 -6
    Before issuing the 'read-only' error also check if the operation is not a DROP TEMPORARY TABLE statement

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	kaa
# Host:	polly.local
# Root:	/tmp/maint/bug22077/my50-bug22077

--- 1.587/sql/sql_parse.cc	2006-11-20 17:35:30 +03:00
+++ 1.588/sql/sql_parse.cc	2006-11-20 17:35:30 +03:00
@@ -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);

--- 1.3/mysql-test/r/read_only.result	2006-11-20 17:35:30 +03:00
+++ 1.4/mysql-test/r/read_only.result	2006-11-20 17:35:30 +03:00
@@ -39,6 +39,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
 drop table t1;
 insert into t1 values(1);
 ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
+drop temporary table ttt;
+ERROR 42S02: Unknown table 'ttt'
+drop temporary table if exists ttt;
+Warnings:
+Note	1051	Unknown table 'ttt'
 drop table t1,t2;
 drop user test@localhost;
 set global read_only=0;

--- 1.3/mysql-test/t/read_only.test	2006-11-20 17:35:30 +03:00
+++ 1.4/mysql-test/t/read_only.test	2006-11-20 17:35:30 +03:00
@@ -101,6 +101,18 @@ drop table t1;
 --error 1290
 insert into t1 values(1);
 
+#
+# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
+#
+# check if DROP TEMPORARY on a non-existing temporary table returns the right
+# error
+
+--error ER_BAD_TABLE_ERROR
+drop temporary table ttt;
+
+# check if DROP TEMPORARY TABLE IF EXISTS produces a warning with read_only set
+drop temporary table if exists ttt;
+
 connection default;
 drop table t1,t2;
 drop user test@localhost;
Thread
bk commit into 5.0 tree (kaa:1.2334) BUG#22077Alexey Kopytov20 Nov