Commit 1bd6e4f6 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge bk-internal:/home/bk/mysql-5.1-new-maint

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
parents 0e4d97ed 332afaa7
...@@ -13,6 +13,8 @@ sub mtr_tofile ($@); ...@@ -13,6 +13,8 @@ sub mtr_tofile ($@);
sub mtr_tonewfile($@); sub mtr_tonewfile($@);
sub mtr_lastlinefromfile($); sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$); sub mtr_appendfile_to_file ($$);
sub mtr_grab_file($);
############################################################################## ##############################################################################
# #
...@@ -128,6 +130,7 @@ sub unspace { ...@@ -128,6 +130,7 @@ sub unspace {
return "$quote$string$quote"; return "$quote$string$quote";
} }
# Read a whole file, stripping leading and trailing whitespace.
sub mtr_fromfile ($) { sub mtr_fromfile ($) {
my $file= shift; my $file= shift;
...@@ -181,5 +184,16 @@ sub mtr_appendfile_to_file ($$) { ...@@ -181,5 +184,16 @@ sub mtr_appendfile_to_file ($$) {
close TOFILE; close TOFILE;
} }
# Read a whole file verbatim.
sub mtr_grab_file($) {
my $file= shift;
open(FILE, '<', $file)
or return undef;
local $/= undef;
my $data= scalar(<FILE>);
close FILE;
return $data;
}
1; 1;
...@@ -1630,9 +1630,17 @@ sub environment_setup () { ...@@ -1630,9 +1630,17 @@ sub environment_setup () {
# impossible to add correct supressions, that means if "/usr/lib/debug" # impossible to add correct supressions, that means if "/usr/lib/debug"
# is available, it should be added to # is available, it should be added to
# LD_LIBRARY_PATH # LD_LIBRARY_PATH
#
# But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian
# bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035),
# so don't change LD_LIBRARY_PATH on that platform.
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
my $debug_libraries_path= "/usr/lib/debug"; my $debug_libraries_path= "/usr/lib/debug";
if ( $opt_valgrind and -d $debug_libraries_path ) my $deb_version;
if ( $opt_valgrind and -d $debug_libraries_path and
(! -e '/etc/debian_version' or
($deb_version= mtr_grab_file('/etc/debian_version')) == 0 or
$deb_version > 3.1 ) )
{ {
push(@ld_library_paths, $debug_libraries_path); push(@ld_library_paths, $debug_libraries_path);
} }
......
...@@ -39,6 +39,11 @@ delete t1 from t1,t3 where t1.a=t3.a; ...@@ -39,6 +39,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1; drop table t1;
insert into t1 values(1); insert into t1 values(1);
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement 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 table t1,t2;
drop user test@localhost; drop user test@localhost;
set global read_only=0; set global read_only=0;
...@@ -101,6 +101,18 @@ drop table t1; ...@@ -101,6 +101,18 @@ drop table t1;
--error 1290 --error 1290
insert into t1 values(1); 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; connection default;
drop table t1,t2; drop table t1,t2;
drop user test@localhost; drop user test@localhost;
......
...@@ -2580,10 +2580,11 @@ mysql_execute_command(THD *thd) ...@@ -2580,10 +2580,11 @@ mysql_execute_command(THD *thd)
if (opt_readonly && if (opt_readonly &&
!(thd->security_ctx->master_access & SUPER_ACL) && !(thd->security_ctx->master_access & SUPER_ACL) &&
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) && (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) &&
!((lex->sql_command == SQLCOM_CREATE_TABLE) && !((lex->sql_command == SQLCOM_CREATE_TABLE) &&
(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) && (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)) &&
((lex->sql_command != SQLCOM_UPDATE_MULTI) && !((lex->sql_command == SQLCOM_DROP_TABLE) && lex->drop_temporary) &&
some_non_temp_table_to_be_updated(thd, all_tables))) ((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"); my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--read-only");
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment