Commit 456b16d8 authored by msvensson@pilot.mysql.com's avatar msvensson@pilot.mysql.com

Merge pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr-warnings2

into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl
parents 15d2940f 433c1c3d
#
# This test is executed once after each test to check the servers
# for unexpected warnings found in the servers error log
#
--disable_query_log
call mtr.check_warnings();
--enable_query_log
...@@ -17,5 +17,5 @@ loose-innodb_data_file_path= ibdata1:10M:autoextend ...@@ -17,5 +17,5 @@ loose-innodb_data_file_path= ibdata1:10M:autoextend
slave-net-timeout=120 slave-net-timeout=120
log-bin log-bin=mysqld-bin
delimiter ||;
use mtr||
--
-- Load table with the patterns that are considered
-- as suspicious and should be examined further
--
CREATE TABLE suspicious_patterns (
pattern VARCHAR(255)
)||
--
-- Declare a trigger that makes sure
-- no invalid patterns can be inserted
-- into suspicious_patterns
--
/*!50002
CREATE DEFINER=root@localhost TRIGGER sp_insert
BEFORE INSERT ON suspicious_patterns
FOR EACH ROW BEGIN
DECLARE dummy INT;
SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
--
-- Insert patterns for the lines we should check
--
INSERT INTO suspicious_patterns VALUES
("^Warning:|mysqld: Warning|\\[Warning\\]"),
("^Error:|\\[ERROR\\]"),
("^==.* at 0x"),
("InnoDB: Warning"),
("^safe_mutex:|allocated at line"),
("missing DBUG_RETURN"),
("Attempting backtrace"),
("Assertion .* failed")||
--
-- Create table where testcases can insert patterns to
-- be supressed
--
CREATE TABLE test_supressions (
pattern VARCHAR(255)
)||
--
-- Declare a trigger that makes sure
-- no invalid patterns can be inserted
-- into test_supressions
--
/*!50002
CREATE DEFINER=root@localhost TRIGGER ts_insert
BEFORE INSERT ON test_supressions
FOR EACH ROW BEGIN
DECLARE dummy INT;
SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
--
-- Load table with patterns that will be supressed globally(always)
--
CREATE TABLE global_supressions (
pattern VARCHAR(255)
)||
-- Declare a trigger that makes sure
-- no invalid patterns can be inserted
-- into global_supressions
--
/*!50002
CREATE DEFINER=root@localhost TRIGGER gs_insert
BEFORE INSERT ON global_supressions
FOR EACH ROW BEGIN
DECLARE dummy INT;
SELECT "" REGEXP NEW.pattern INTO dummy;
END
*/||
--
-- Insert patterns that should always be supressed
--
INSERT INTO global_supressions VALUES
("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"),
("Aborted connection"),
("Client requested master to start replication from impossible position"),
("Could not find first log file name in binary log"),
("Enabling keys got errno"),
("Error reading master configuration"),
("Error reading packet"),
("Event Scheduler"),
("Failed to open log"),
("Failed to open the existing master info file"),
("Forcing shutdown of [0-9]* plugins"),
/*
Due to timing issues, it might be that this warning
is printed when the server shuts down and the
computer is loaded.
*/
("Got error [0-9]* when reading table"),
("Incorrect definition of table"),
("Incorrect information in file"),
("InnoDB: Warning: we did not need to do crash recovery"),
("Invalid \\(old\\?\\) table or database name"),
("Lock wait timeout exceeded"),
("Log entry on master is longer than max_allowed_packet"),
("unknown option '--loose-"),
("unknown variable 'loose-"),
("You have forced lower_case_table_names to 0 through a command-line option"),
("Setting lower_case_table_names=2"),
("NDB Binlog:"),
("NDB: failed to setup table"),
("NDB: only row based binary logging"),
("Neither --relay-log nor --relay-log-index were used"),
("Query partially completed"),
("Slave I.O thread aborted while waiting for relay log"),
("Slave SQL thread is stopped because UNTIL condition"),
("Slave SQL thread retried transaction"),
("Slave \\(additional info\\)"),
("Slave: .*Duplicate column name"),
("Slave: .*master may suffer from"),
("Slave: According to the master's version"),
("Slave: Column [0-9]* type mismatch"),
("Slave: Error .* doesn't exist"),
("Slave: Error .*Deadlock found"),
("Slave: Error .*Unknown table"),
("Slave: Error in Write_rows event: "),
("Slave: Field .* of table .* has no default value"),
("Slave: Field .* doesn't have a default value"),
("Slave: Query caused different errors on master and slave"),
("Slave: Table .* doesn't exist"),
("Slave: Table width mismatch"),
("Slave: The incident LOST_EVENTS occured on the master"),
("Slave: Unknown error.* 1105"),
("Slave: Can't drop database.* database doesn't exist"),
("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"),
("Sort aborted"),
("Time-out in NDB"),
("Warning:\s+One can only use the --user.*root"),
("Warning:\s+Setting lower_case_table_names=2"),
("Warning:\s+Table:.* on (delete|rename)"),
("You have an error in your SQL syntax"),
("deprecated"),
("description of time zone"),
("equal MySQL server ids"),
("error .*connecting to master"),
("error reading log entry"),
("lower_case_table_names is set"),
("skip-name-resolve mode"),
("slave SQL thread aborted"),
("Slave: .*Duplicate entry"),
/*
Special case, made as specific as possible, for:
Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
server coredump
*/
("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
("Statement is not safe to log in statement format"),
/* test case for Bug#bug29807 copies a stray frm into database */
("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
("Cannot find or open table test\/bug29807 from"),
/* innodb foreign key tests that fail in ALTER or RENAME produce this */
("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"),
("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"),
/* Test case for Bug#14233 produces the following warnings: */
("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"),
("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"),
("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"),
/*
BUG#32080 - Excessive warnings on Solaris: setrlimit could not
change the size of core files
*/
("setrlimit could not change the size of core files to 'infinity'"),
/*
rpl_extrColmaster_*.test, the slave thread produces warnings
when it get updates to a table that has more columns on the
master
*/
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
("Slave: Can't DROP 'c7'.* 1091"),
("Slave: Key column 'c6'.* 1072"),
("THE_LAST_SUPPRESSION")||
--
-- Procedure that uses the above created tables to check
-- the servers error log for warnings
--
CREATE DEFINER=root@localhost PROCEDURE check_warnings()
BEGIN
--
-- Load the server .err file into "error_log" table
--
CREATE TEMPORARY TABLE error_log (
row INT AUTO_INCREMENT PRIMARY KEY,
line mediumtext NULL
);
SELECT variable_value INTO @log_error
FROM information_schema.global_variables
WHERE variable_name='LOG_ERROR';
SET @text= load_file(@log_error);
-- select @text;
WHILE LOCATE('\n', @text) DO
INSERT error_log (line)
VALUES (
SUBSTR(@text, 1, LOCATE('\n', @text)-1)
);
SET @text= SUBSTR(@text FROM LOCATE('\n', @text)+1);
END WHILE;
-- select * from error_log;
--
-- Remove all lines belonging to previous tests
--
SELECT COALESCE(MAX(row),0) INTO @max_row
FROM error_log
WHERE line REGEXP "^CURRENT_TEST:";
DELETE FROM error_log WHERE row < @max_row;
CREATE TEMPORARY TABLE suspect_lines AS
SELECT DISTINCT el.line, 0 as "supressed"
FROM error_log el, suspicious_patterns ep
WHERE el.line REGEXP ep.pattern;
-- Mark lines that are supressed by global supressions
UPDATE suspect_lines sl, global_supressions gs
SET supressed=1
WHERE sl.line REGEXP gs.pattern;
-- Mark lines that are supressed by test specific supressions
UPDATE suspect_lines sl, test_supressions ts
SET supressed=2
WHERE sl.line REGEXP ts.pattern;
SELECT COUNT(*) INTO @num_warnings FROM suspect_lines
WHERE supressed=0;
IF @num_warnings > 0 THEN
SELECT @log_error;
SELECT line as log_error
FROM suspect_lines WHERE supressed=0;
SELECT * FROM test_supressions;
ELSE
SELECT "OK";
END IF;
-- Cleanup for next test
TRUNCATE test_supressions;
END||
--
-- Declare a procedure testcases can use to insert test
-- specific supressions
--
/*!50001
CREATE DEFINER=root@localhost
PROCEDURE add_supression(pattern VARCHAR(255))
BEGIN
INSERT INTO test_supressions (pattern) VALUES (pattern);
END
*/||
...@@ -25,6 +25,7 @@ use base qw(Exporter); ...@@ -25,6 +25,7 @@ use base qw(Exporter);
our @EXPORT= qw(collect_option collect_test_cases); our @EXPORT= qw(collect_option collect_test_cases);
use mtr_report; use mtr_report;
use mtr_match;
# Options used for the collect phase # Options used for the collect phase
our $start_from; our $start_from;
...@@ -55,7 +56,6 @@ use IO::File(); ...@@ -55,7 +56,6 @@ use IO::File();
use My::Config; use My::Config;
use My::Platform; use My::Platform;
require "mtr_match.pl";
require "mtr_misc.pl"; require "mtr_misc.pl";
# Precompiled regex's for tests to do or skip # Precompiled regex's for tests to do or skip
...@@ -425,7 +425,7 @@ sub collect_one_suite($) ...@@ -425,7 +425,7 @@ sub collect_one_suite($)
if (@combinations) if (@combinations)
{ {
print " - adding combinations\n"; print " - adding combinations for $suite\n";
#print_testcases(@cases); #print_testcases(@cases);
my @new_cases; my @new_cases;
......
...@@ -18,20 +18,17 @@ ...@@ -18,20 +18,17 @@
# and is part of the translation of the Bourne shell script with the # and is part of the translation of the Bourne shell script with the
# same name. # same name.
package mtr_match;
use strict; use strict;
sub mtr_match_prefix ($$); use base qw(Exporter);
sub mtr_match_extension ($$); our @EXPORT= qw(mtr_match_prefix
sub mtr_match_any_exact ($$); mtr_match_extension
mtr_match_substring);
##############################################################################
# #
#
#
##############################################################################
# Match a prefix and return what is after the prefix # Match a prefix and return what is after the prefix
#
sub mtr_match_prefix ($$) { sub mtr_match_prefix ($$) {
my $string= shift; my $string= shift;
my $prefix= shift; my $prefix= shift;
...@@ -47,8 +44,9 @@ sub mtr_match_prefix ($$) { ...@@ -47,8 +44,9 @@ sub mtr_match_prefix ($$) {
} }
#
# Match extension and return the name without extension # Match extension and return the name without extension
#
sub mtr_match_extension ($$) { sub mtr_match_extension ($$) {
my $file= shift; my $file= shift;
my $ext= shift; my $ext= shift;
...@@ -64,8 +62,9 @@ sub mtr_match_extension ($$) { ...@@ -64,8 +62,9 @@ sub mtr_match_extension ($$) {
} }
#
# Match a substring anywere in a string # Match a substring anywere in a string
#
sub mtr_match_substring ($$) { sub mtr_match_substring ($$) {
my $string= shift; my $string= shift;
my $substring= shift; my $substring= shift;
......
This diff is collapsed.
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
# See the "MySQL Test framework manual" for more information # See the "MySQL Test framework manual" for more information
# http://dev.mysql.com/doc/mysqltest/en/index.html # http://dev.mysql.com/doc/mysqltest/en/index.html
# #
# Please keep the test framework tools identical in all versions!
# #
############################################################################## ##############################################################################
...@@ -51,11 +50,11 @@ use My::Options; ...@@ -51,11 +50,11 @@ use My::Options;
use My::Find; use My::Find;
use mtr_cases; use mtr_cases;
use mtr_report; use mtr_report;
use mtr_match;
require "lib/mtr_process.pl"; require "lib/mtr_process.pl";
require "lib/mtr_io.pl"; require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl"; require "lib/mtr_gcov.pl";
require "lib/mtr_match.pl";
require "lib/mtr_misc.pl"; require "lib/mtr_misc.pl";
require "lib/mtr_unique.pl"; require "lib/mtr_unique.pl";
...@@ -330,7 +329,7 @@ sub command_line_setup { ...@@ -330,7 +329,7 @@ sub command_line_setup {
# Test case authoring # Test case authoring
'record' => \$opt_record, 'record' => \$opt_record,
'check-testcases' => \$opt_check_testcases, 'check-testcases!' => \$opt_check_testcases,
'mark-progress' => \$opt_mark_progress, 'mark-progress' => \$opt_mark_progress,
# Extra options used when starting mysqld # Extra options used when starting mysqld
...@@ -1984,17 +1983,48 @@ sub initialize_servers { ...@@ -1984,17 +1983,48 @@ sub initialize_servers {
# #
# Copy the reference database into selected datadir # Remove all newline characters expect after semicolon
# #
sub copy_install_db ($) { sub sql_to_bootstrap {
my $path_data_dir= shift; my ($sql) = @_;
my @lines= split(/\n/, $sql);
my $result= "\n";
my $delimiter= ';';
foreach my $line (@lines) {
# Change current delimiter if line starts with "delimiter"
if ( $line =~ /^delimiter (.*)/ ) {
my $new= $1;
# Remove old delimiter from end of new
$new=~ s/\Q$delimiter\E$//;
$delimiter = $new;
mtr_debug("changed delimiter to $delimiter");
# No need to add the delimiter to result
next;
}
# Don't install over another db # Add newline if line ends with $delimiter
mtr_error("There is already an installed db in '$path_data_dir'") # and convert the current delimiter to semicolon
if -d $path_data_dir; if ( $line =~ /\Q$delimiter\E$/ ){
$line =~ s/\Q$delimiter\E$/;/;
$result.= "$line\n";
mtr_debug("Added default delimiter");
next;
}
# copy the installed db into place # Remove comments starting with --
copytree("$opt_vardir/install.db", $path_data_dir); if ( $line =~ /^\s*--/ ) {
mtr_debug("Discarded $line");
next;
}
# Default, just add the line without newline
# but with a space as separator
$result.= "$line ";
}
return $result;
} }
...@@ -2073,6 +2103,10 @@ sub mysql_install_db { ...@@ -2073,6 +2103,10 @@ sub mysql_install_db {
mtr_tofile($bootstrap_sql_file, mtr_tofile($bootstrap_sql_file,
"CREATE DATABASE mtr;\n"); "CREATE DATABASE mtr;\n");
# Add help tables and data for warning detection and supression
mtr_tofile($bootstrap_sql_file,
sql_to_bootstrap(mtr_grab_file("include/mtr_warnings.sql")));
# Log bootstrap command # Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log"; my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log, mtr_tofile($path_bootstrap_log,
...@@ -2169,11 +2203,12 @@ sub do_before_run_mysqltest($) ...@@ -2169,11 +2203,12 @@ sub do_before_run_mysqltest($)
} }
sub run_check_testcase_all($$) sub check_testcase($$)
{ {
my ($tinfo, $mode)= @_; my ($tinfo, $mode)= @_;
my $result; my $result;
# Parallell( mysqlds(), run_check_testcase, check_testcase_failed );
foreach my $mysqld ( mysqlds() ) foreach my $mysqld ( mysqlds() )
{ {
if ( defined $mysqld->{'proc'} ) if ( defined $mysqld->{'proc'} )
...@@ -2352,7 +2387,7 @@ sub run_testcase ($) { ...@@ -2352,7 +2387,7 @@ sub run_testcase ($) {
if ( $opt_check_testcases ) if ( $opt_check_testcases )
{ {
run_check_testcase_all($tinfo, "before") check_testcase($tinfo, "before")
} }
my $test= start_mysqltest($tinfo); my $test= start_mysqltest($tinfo);
...@@ -2380,11 +2415,20 @@ sub run_testcase ($) { ...@@ -2380,11 +2415,20 @@ sub run_testcase ($) {
if ( $res == 0 ) if ( $res == 0 )
{ {
mtr_report_test_passed($tinfo, $opt_timer); if ( $opt_warnings and check_warnings($tinfo) )
{
# Found unexpected warnings
report_failure_and_restart($tinfo);
$res= 1;
}
else
{
mtr_report_test_passed($tinfo, $opt_timer);
}
if ( $opt_check_testcases ) if ( $opt_check_testcases )
{ {
if (run_check_testcase_all($tinfo, "after")) if (check_testcase($tinfo, "after"))
{ {
# Stop all servers that are known to be running # Stop all servers that are known to be running
stop_all_servers(); stop_all_servers();
...@@ -2484,6 +2528,93 @@ sub run_testcase ($) { ...@@ -2484,6 +2528,93 @@ sub run_testcase ($) {
} }
# Run include/check-warnings.test
#
# RETURN VALUE
# 0 OK
# 1 Check failed
#
sub run_check_warnings ($$) {
my $tinfo= shift;
my $mysqld= shift;
my $name= "warnings-".$mysqld->name();
my $tname= $tinfo->{name};
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
my $errfile= "$opt_vardir/tmp/$name.err";
my $res= My::SafeProcess->run
(
name => $name,
path => $exe_mysqltest,
error => $errfile,
output => $errfile,
args => \$args,
);
if ( $res == 0 )
{
my $report= mtr_grab_file($errfile);
if ($report ne "OK\nOK\n")
{
# Log to var/log/warnings file
mtr_tofile("$opt_vardir/log/warnings",
$tname."\n",
$report);
$res= 1;
$tinfo->{'warnings'}.= $report;
}
}
elsif ( $res == 62 )
{
# One of the features needed to run check_warnings.test was not
# available, check skipped
$res= 0;
}
elsif ( $res )
{
mtr_report("\nCould not execute 'check-warnings' for testcase '$tname':");
mtr_printfile($errfile);
$res= 0; # Ignore error
}
return $res;
}
#
# Loop through our list of processes and check the error log
# for unexepcted errors and warnings
#
sub check_warnings ($) {
my ($tinfo)= @_;
my $res= 0;
# Clear previous warnings
$tinfo->{warnings}= undef;
# Parallell( mysqlds(), run_check_warning, check_warning_failed);
foreach my $mysqld ( mysqlds() )
{
if (run_check_warnings($tinfo, $mysqld)){
$res= 1;
mtr_report();
}
}
return $res;
}
# #
# Loop through our list of processes and look for and entry # Loop through our list of processes and look for and entry
# with the provided pid, if found check for the file indicating # with the provided pid, if found check for the file indicating
...@@ -2568,6 +2699,11 @@ sub after_test_failure ($) { ...@@ -2568,6 +2699,11 @@ sub after_test_failure ($) {
mtr_debug("Removing '$backup_dir'"); mtr_debug("Removing '$backup_dir'");
} }
} }
# Remove all files in var/tmp
rmtree($opt_tmpdir);
mkpath($opt_tmpdir);
} }
...@@ -3064,7 +3200,8 @@ sub start_servers($) { ...@@ -3064,7 +3200,8 @@ sub start_servers($) {
} }
# Copy datadir from installed system db # Copy datadir from installed system db
copy_install_db($datadir) unless -d $datadir; copytree("$opt_vardir/install.db", $datadir)
unless -d $datadir;
# Write start of testcase to log file # Write start of testcase to log file
mark_log($mysqld->value('log-error'), $tinfo); mark_log($mysqld->value('log-error'), $tinfo);
...@@ -3144,17 +3281,11 @@ sub run_check_testcase ($$$) { ...@@ -3144,17 +3281,11 @@ sub run_check_testcase ($$$) {
my $args; my $args;
mtr_init_args(\$args); mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
mtr_add_arg($args, "--silent"); mtr_add_arg($args, "--silent");
mtr_add_arg($args, "--skip-safemalloc"); mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
mtr_add_arg($args, "--socket=%s", $mysqld->value('socket'));
mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
mtr_add_arg($args, "--database=test");
mtr_add_arg($args, "--user=%s", $opt_user);
mtr_add_arg($args, "--password=");
mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result"); mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result");
mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test"); mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test");
...@@ -3177,12 +3308,12 @@ sub run_check_testcase ($$$) { ...@@ -3177,12 +3308,12 @@ sub run_check_testcase ($$$) {
mtr_report("\nThe check of testcase '$tname' failed, this is the\n", mtr_report("\nThe check of testcase '$tname' failed, this is the\n",
"diff between before and after:\n"); "diff between before and after:\n");
# Test failed, display the report mysqltest has created # Test failed, display the report mysqltest has created
mtr_printfile("$opt_vardir/tmp/$name.err"); mtr_printfile($errfile);
} }
elsif ( $res ) elsif ( $res )
{ {
mtr_report("\nCould not execute 'check-testcase' $mode testcase '$tname':"); mtr_report("\nCould not execute 'check-testcase' $mode testcase '$tname':");
mtr_printfile("$opt_vardir/tmp/$name.err"); mtr_printfile($errfile);
mtr_report(); mtr_report();
} }
return $res; return $res;
......
...@@ -36,7 +36,11 @@ create table t3(a int, KEY a_data (a)); ...@@ -36,7 +36,11 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int); create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key); create table t5 (id int auto_increment primary key);
insert into t5 values (10); insert into t5 values (10);
create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; create view v1 (c) as
SELECT table_name FROM information_schema.TABLES
WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND
table_name<>'ndb_binlog_index' AND
table_name<>'ndb_apply_status';
select * from v1; select * from v1;
c c
CHARACTER_SETS CHARACTER_SETS
...@@ -272,19 +276,19 @@ select * from t1; ...@@ -272,19 +276,19 @@ select * from t1;
select * from t2; select * from t2;
end| end|
select parameter_style, sql_data_access, dtd_identifier select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines; from information_schema.routines where routine_schema='test';
parameter_style sql_data_access dtd_identifier parameter_style sql_data_access dtd_identifier
SQL CONTAINS SQL NULL SQL CONTAINS SQL NULL
SQL CONTAINS SQL int(11) SQL CONTAINS SQL int(11)
show procedure status; show procedure status where db='test';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test sel2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test sel2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
show function status; show function status where db='test';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test sub1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test sub1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
select a.ROUTINE_NAME from information_schema.ROUTINES a, select a.ROUTINE_NAME from information_schema.ROUTINES a,
information_schema.SCHEMATA b where information_schema.SCHEMATA b where
a.ROUTINE_SCHEMA = b.SCHEMA_NAME; a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test';
ROUTINE_NAME ROUTINE_NAME
sel2 sel2
sub1 sub1
...@@ -295,14 +299,14 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -295,14 +299,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE # ALL NULL NULL NULL NULL NULL 1 SIMPLE # ALL NULL NULL NULL NULL NULL
1 SIMPLE # ALL NULL NULL NULL NULL NULL Using where; Using join buffer 1 SIMPLE # ALL NULL NULL NULL NULL NULL Using where; Using join buffer
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1; mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1;
ROUTINE_NAME name ROUTINE_NAME name
sel2 sel2 sel2 sel2
sub1 sub1 sub1 sub1
select count(*) from information_schema.ROUTINES; select count(*) from information_schema.ROUTINES where routine_schema='test';
count(*) count(*)
2 2
create view v1 as select routine_schema, routine_name from information_schema.routines create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test'
order by routine_schema, routine_name; order by routine_schema, routine_name;
select * from v1; select * from v1;
routine_schema routine_name routine_schema routine_name
...@@ -850,7 +854,7 @@ VIEWS TABLE_NAME select ...@@ -850,7 +854,7 @@ VIEWS TABLE_NAME select
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4';
flush privileges; flush privileges;
SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*) table_schema count(*)
information_schema 28 information_schema 28
mysql 22 mysql 22
...@@ -890,7 +894,7 @@ if new.j = -1 then ...@@ -890,7 +894,7 @@ if new.j = -1 then
set @fired:= "Yes"; set @fired:= "Yes";
end if; end if;
end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
select * from information_schema.triggers; select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest');
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
NULL test trg1 INSERT NULL test t1 0 NULL begin NULL test trg1 INSERT NULL test t1 0 NULL begin
if new.j > 10 then if new.j > 10 then
...@@ -1079,7 +1083,7 @@ BEGIN ...@@ -1079,7 +1083,7 @@ BEGIN
SELECT 'foo' FROM DUAL; SELECT 'foo' FROM DUAL;
END | END |
ERROR 42000: Unknown database 'information_schema' ERROR 42000: Unknown database 'information_schema'
select ROUTINE_NAME from routines; select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema';
ROUTINE_NAME ROUTINE_NAME
grant all on information_schema.* to 'user1'@'localhost'; grant all on information_schema.* to 'user1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
...@@ -1161,7 +1165,7 @@ use mysql; ...@@ -1161,7 +1165,7 @@ use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); '2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
select routine_name from information_schema.routines; select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
routine_name routine_name
delete from proc where name=''; delete from proc where name='';
...@@ -1195,7 +1199,7 @@ CREATE FUNCTION f1() RETURNS INT RETURN @a + 1; ...@@ -1195,7 +1199,7 @@ CREATE FUNCTION f1() RETURNS INT RETURN @a + 1;
CREATE USER mysql_bug20230@localhost; CREATE USER mysql_bug20230@localhost;
GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost; GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost;
GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost; GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost;
SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
ROUTINE_NAME ROUTINE_DEFINITION ROUTINE_NAME ROUTINE_DEFINITION
f1 RETURN @a + 1 f1 RETURN @a + 1
p1 SET @a= 1 p1 SET @a= 1
...@@ -1207,7 +1211,7 @@ SHOW CREATE FUNCTION f1; ...@@ -1207,7 +1211,7 @@ SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci
SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
ROUTINE_NAME ROUTINE_DEFINITION ROUTINE_NAME ROUTINE_DEFINITION
f1 NULL f1 NULL
p1 NULL p1 NULL
...@@ -1310,12 +1314,12 @@ TABLE_PRIVILEGES TABLE_SCHEMA ...@@ -1310,12 +1314,12 @@ TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA VIEWS TABLE_SCHEMA
SELECT MAX(table_name) FROM information_schema.tables; SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
MAX(table_name) MAX(table_name)
VIEWS VIEWS
SELECT table_name from information_schema.tables SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name) WHERE table_name=(SELECT MAX(table_name)
FROM information_schema.tables); FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
table_name table_name
VIEWS VIEWS
DROP TABLE IF EXISTS bug23037; DROP TABLE IF EXISTS bug23037;
......
Run mysql_upgrade once Run mysql_upgrade once
mtr.global_supressions OK
mtr.suspicious_patterns OK
mtr.test_supressions OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
...@@ -29,6 +32,9 @@ mysql.user OK ...@@ -29,6 +32,9 @@ mysql.user OK
Run it again - should say already completed Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before Force should run it regardless of wether it's been run before
mtr.global_supressions OK
mtr.suspicious_patterns OK
mtr.test_supressions OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
...@@ -59,6 +65,9 @@ mysql.user OK ...@@ -59,6 +65,9 @@ mysql.user OK
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila'; CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%'; GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account Run mysql_upgrade with password protected account
mtr.global_supressions OK
mtr.suspicious_patterns OK
mtr.test_supressions OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
...@@ -91,6 +100,9 @@ Run mysql_upgrade with a non existing server socket ...@@ -91,6 +100,9 @@ Run mysql_upgrade with a non existing server socket
mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
mtr.global_supressions OK
mtr.suspicious_patterns OK
mtr.test_supressions OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
......
DROP TABLE IF EXISTS t1, `t``1`, `t 1`; DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1; drop view if exists v1;
drop database if exists client_test_db; drop database if exists client_test_db;
mtr.global_supressions OK
mtr.suspicious_patterns OK
mtr.test_supressions OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event OK mysql.event OK
......
...@@ -84,7 +84,7 @@ drop table t1; ...@@ -84,7 +84,7 @@ drop table t1;
drop function bug14233_1; drop function bug14233_1;
drop function bug14233_2; drop function bug14233_2;
drop procedure bug14233_3; drop procedure bug14233_3;
show procedure status; show procedure status where db=DATABASE();
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
show function status; show function status where db=DATABASE();
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
drop table if exists t1, t2; drop table if exists t1, t2;
SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt';
delete from mysql.proc; delete from mysql.proc;
create procedure syntaxerror(t int)| create procedure syntaxerror(t int)|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
...@@ -1650,3 +1651,4 @@ begin ...@@ -1650,3 +1651,4 @@ begin
declare continue handler for sqlstate '00000' set @x=0; declare continue handler for sqlstate '00000' set @x=0;
end$$ end$$
ERROR 42000: Bad SQLSTATE: '00000' ERROR 42000: Bad SQLSTATE: '00000'
LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc;
...@@ -142,13 +142,13 @@ use db2; ...@@ -142,13 +142,13 @@ use db2;
alter procedure q modifies sql data; alter procedure q modifies sql data;
drop procedure q; drop procedure q;
use test; use test;
select type,db,name from mysql.proc; select type,db,name from mysql.proc where db like 'db%';
type db name type db name
FUNCTION db1_secret db FUNCTION db1_secret db
PROCEDURE db1_secret stamp PROCEDURE db1_secret stamp
drop database db1_secret; drop database db1_secret;
drop database db2; drop database db2;
select type,db,name from mysql.proc; select type,db,name from mysql.proc where db like 'db%';
type db name type db name
delete from mysql.user where user='user1' or user='user2'; delete from mysql.user where user='user1' or user='user2';
delete from mysql.user where user='' and host='%'; delete from mysql.user where user='' and host='%';
......
...@@ -1322,7 +1322,7 @@ end; ...@@ -1322,7 +1322,7 @@ end;
end if; end if;
end loop; end loop;
end latin1 latin1_swedish_ci latin1_swedish_ci end latin1 latin1_swedish_ci latin1_swedish_ci
show procedure status like '%p%'| show procedure status where name like '%p%' and db='test'|
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
...@@ -1335,7 +1335,7 @@ i p ...@@ -1335,7 +1335,7 @@ i p
drop table t3| drop table t3|
drop procedure opp| drop procedure opp|
drop procedure ip| drop procedure ip|
show procedure status like '%p%'| show procedure status where name like '%p%' and db='test'|
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
drop table if exists t3| drop table if exists t3|
create table t3 ( f bigint unsigned not null )| create table t3 ( f bigint unsigned not null )|
...@@ -1945,12 +1945,12 @@ drop procedure bug2260| ...@@ -1945,12 +1945,12 @@ drop procedure bug2260|
drop procedure if exists bug2267_1| drop procedure if exists bug2267_1|
create procedure bug2267_1() create procedure bug2267_1()
begin begin
show procedure status; show procedure status where db='test';
end| end|
drop procedure if exists bug2267_2| drop procedure if exists bug2267_2|
create procedure bug2267_2() create procedure bug2267_2()
begin begin
show function status; show function status where db='test';
end| end|
drop procedure if exists bug2267_3| drop procedure if exists bug2267_3|
create procedure bug2267_3() create procedure bug2267_3()
...@@ -1977,7 +1977,7 @@ call bug2267_3()| ...@@ -1977,7 +1977,7 @@ call bug2267_3()|
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
bug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`() bug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`()
begin begin
show procedure status; show procedure status where db='test';
end latin1 latin1_swedish_ci latin1_swedish_ci end latin1 latin1_swedish_ci latin1_swedish_ci
call bug2267_4()| call bug2267_4()|
Function sql_mode Create Function character_set_client collation_connection Database Collation Function sql_mode Create Function character_set_client collation_connection Database Collation
......
reset master; reset master;
call mtr.add_supression("Failed during slave.*thread initialization");
stop slave; stop slave;
reset slave; reset slave;
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave; start slave;
show slave status; show slave status;
Slave_IO_State # Slave_IO_State #
......
...@@ -4,6 +4,8 @@ reset master; ...@@ -4,6 +4,8 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
call mtr.add_supression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
call mtr.add_supression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT); CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (-1),(-2),(-3); INSERT INTO t1 VALUES (-1),(-2),(-3);
......
--loose-debug=d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init
...@@ -13,10 +13,18 @@ connection master; ...@@ -13,10 +13,18 @@ connection master;
reset master; reset master;
connection slave; connection slave;
# Add supression for expected warnings in slaves error log
call mtr.add_supression("Failed during slave.*thread initialization");
--disable_warnings --disable_warnings
stop slave; stop slave;
--enable_warnings --enable_warnings
reset slave; reset slave;
# Set debug flags on slave to force errors to occur
SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave; start slave;
connection master; connection master;
......
...@@ -7,6 +7,10 @@ source include/have_innodb.inc; ...@@ -7,6 +7,10 @@ source include/have_innodb.inc;
connection slave; connection slave;
source include/have_innodb.inc; source include/have_innodb.inc;
# Add supression for expected warning(s) in slaves error log
call mtr.add_supression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
call mtr.add_supression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
connection master; connection master;
CREATE TABLE t1 (a INT PRIMARY KEY); CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT); CREATE TABLE t2 (a INT);
...@@ -393,15 +397,13 @@ sync_slave_with_master; ...@@ -393,15 +397,13 @@ sync_slave_with_master;
#connection slave; #connection slave;
set global slave_exec_mode='STRICT'; set global slave_exec_mode='STRICT';
# cleanup for bug#31609 tests # cleanup for bug#31609 tests
connection master; connection master;
set @@session.binlog_format= @save_binlog_format; set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1; drop table t1,t2,ti2,ti1;
sync_slave_with_master; --source include/master-slave-end.inc
--echo *** end of tests --echo *** end of tests
......
...@@ -37,7 +37,11 @@ create table t3(a int, KEY a_data (a)); ...@@ -37,7 +37,11 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int); create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key); create table t5 (id int auto_increment primary key);
insert into t5 values (10); insert into t5 values (10);
create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status'; create view v1 (c) as
SELECT table_name FROM information_schema.TABLES
WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND
table_name<>'ndb_binlog_index' AND
table_name<>'ndb_apply_status';
select * from v1; select * from v1;
select c,table_name from v1 select c,table_name from v1
...@@ -133,25 +137,25 @@ delimiter ;| ...@@ -133,25 +137,25 @@ delimiter ;|
# Bug#7222 information_schema: errors in "routines" # Bug#7222 information_schema: errors in "routines"
# #
select parameter_style, sql_data_access, dtd_identifier select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines; from information_schema.routines where routine_schema='test';
--replace_column 5 # 6 # --replace_column 5 # 6 #
show procedure status; show procedure status where db='test';
--replace_column 5 # 6 # --replace_column 5 # 6 #
show function status; show function status where db='test';
select a.ROUTINE_NAME from information_schema.ROUTINES a, select a.ROUTINE_NAME from information_schema.ROUTINES a,
information_schema.SCHEMATA b where information_schema.SCHEMATA b where
a.ROUTINE_SCHEMA = b.SCHEMA_NAME; a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test';
--replace_column 3 # --replace_column 3 #
explain select a.ROUTINE_NAME from information_schema.ROUTINES a, explain select a.ROUTINE_NAME from information_schema.ROUTINES a,
information_schema.SCHEMATA b where information_schema.SCHEMATA b where
a.ROUTINE_SCHEMA = b.SCHEMA_NAME; a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a, select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1; mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1;
select count(*) from information_schema.ROUTINES; select count(*) from information_schema.ROUTINES where routine_schema='test';
create view v1 as select routine_schema, routine_name from information_schema.routines create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test'
order by routine_schema, routine_name; order by routine_schema, routine_name;
select * from v1; select * from v1;
drop view v1; drop view v1;
...@@ -528,7 +532,7 @@ flush privileges; ...@@ -528,7 +532,7 @@ flush privileges;
# Bug #9404 information_schema: Weird error messages # Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries # with SELECT SUM() ... GROUP BY queries
# #
SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
# #
...@@ -557,7 +561,7 @@ begin ...@@ -557,7 +561,7 @@ begin
end| end|
delimiter ;| delimiter ;|
show triggers; show triggers;
select * from information_schema.triggers; select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest');
drop trigger trg1; drop trigger trg1;
drop trigger trg2; drop trigger trg2;
...@@ -727,7 +731,7 @@ BEGIN ...@@ -727,7 +731,7 @@ BEGIN
SELECT 'foo' FROM DUAL; SELECT 'foo' FROM DUAL;
END | END |
delimiter ;| delimiter ;|
select ROUTINE_NAME from routines; select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema';
# #
# Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema
# #
...@@ -827,7 +831,7 @@ use mysql; ...@@ -827,7 +831,7 @@ use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); '2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
select routine_name from information_schema.routines; select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
delete from proc where name=''; delete from proc where name='';
use test; use test;
...@@ -874,13 +878,13 @@ CREATE USER mysql_bug20230@localhost; ...@@ -874,13 +878,13 @@ CREATE USER mysql_bug20230@localhost;
GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost; GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost;
GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost; GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost;
SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
SHOW CREATE PROCEDURE p1; SHOW CREATE PROCEDURE p1;
SHOW CREATE FUNCTION f1; SHOW CREATE FUNCTION f1;
connect (conn1, localhost, mysql_bug20230,,); connect (conn1, localhost, mysql_bug20230,,);
SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
SHOW CREATE PROCEDURE p1; SHOW CREATE PROCEDURE p1;
SHOW CREATE FUNCTION f1; SHOW CREATE FUNCTION f1;
CALL p1(); CALL p1();
...@@ -931,10 +935,10 @@ SELECT t.table_name, c1.column_name ...@@ -931,10 +935,10 @@ SELECT t.table_name, c1.column_name
# INFORMARTION_SCHEMA.TABLES # INFORMARTION_SCHEMA.TABLES
# #
SELECT MAX(table_name) FROM information_schema.tables; SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
SELECT table_name from information_schema.tables SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name) WHERE table_name=(SELECT MAX(table_name)
FROM information_schema.tables); FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
# #
# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table" # Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table"
# #
......
...@@ -153,5 +153,5 @@ drop function bug14233_1; ...@@ -153,5 +153,5 @@ drop function bug14233_1;
drop function bug14233_2; drop function bug14233_2;
drop procedure bug14233_3; drop procedure bug14233_3;
# Assert: These should show nothing. # Assert: These should show nothing.
show procedure status; show procedure status where db=DATABASE();
show function status; show function status where db=DATABASE();
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
# Backup the mysql.proc table
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt';
# Make sure we don't have any procedures left. # Make sure we don't have any procedures left.
delete from mysql.proc; delete from mysql.proc;
...@@ -2421,3 +2425,9 @@ delimiter ;$$ ...@@ -2421,3 +2425,9 @@ delimiter ;$$
#--enable_warnings #--enable_warnings
#create procedure bugNNNN... #create procedure bugNNNN...
#create function bugNNNN... #create function bugNNNN...
#
# CLEANUP and RESTORE
#
LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc;
remove_file $MYSQLTEST_VARDIR/tmp/proc.txt;
...@@ -243,11 +243,11 @@ disconnect con2user1; ...@@ -243,11 +243,11 @@ disconnect con2user1;
disconnect con3anon; disconnect con3anon;
disconnect con4user2; disconnect con4user2;
use test; use test;
select type,db,name from mysql.proc; select type,db,name from mysql.proc where db like 'db%';
drop database db1_secret; drop database db1_secret;
drop database db2; drop database db2;
# Make sure the routines are gone # Make sure the routines are gone
select type,db,name from mysql.proc; select type,db,name from mysql.proc where db like 'db%';
# Get rid of the users # Get rid of the users
delete from mysql.user where user='user1' or user='user2'; delete from mysql.user where user='user1' or user='user2';
delete from mysql.user where user='' and host='%'; delete from mysql.user where user='' and host='%';
......
...@@ -1540,7 +1540,7 @@ begin ...@@ -1540,7 +1540,7 @@ begin
end| end|
show create procedure opp| show create procedure opp|
--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' --replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like '%p%'| show procedure status where name like '%p%' and db='test'|
# This isn't the fastest way in the world to compute prime numbers, so # This isn't the fastest way in the world to compute prime numbers, so
# don't be too ambitious. ;-) # don't be too ambitious. ;-)
...@@ -1558,7 +1558,7 @@ drop table t3| ...@@ -1558,7 +1558,7 @@ drop table t3|
drop procedure opp| drop procedure opp|
drop procedure ip| drop procedure ip|
--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' --replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like '%p%'| show procedure status where name like '%p%' and db='test'|
# Fibonacci, for recursion test. (Yet Another Numerical series :) # Fibonacci, for recursion test. (Yet Another Numerical series :)
...@@ -2280,7 +2280,7 @@ drop procedure if exists bug2267_1| ...@@ -2280,7 +2280,7 @@ drop procedure if exists bug2267_1|
--enable_warnings --enable_warnings
create procedure bug2267_1() create procedure bug2267_1()
begin begin
show procedure status; show procedure status where db='test';
end| end|
--disable_warnings --disable_warnings
...@@ -2288,7 +2288,7 @@ drop procedure if exists bug2267_2| ...@@ -2288,7 +2288,7 @@ drop procedure if exists bug2267_2|
--enable_warnings --enable_warnings
create procedure bug2267_2() create procedure bug2267_2()
begin begin
show function status; show function status where db='test';
end| end|
--disable_warnings --disable_warnings
......
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