diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 9421e80de2d..a94dba90979 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7255,8 +7255,12 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command, mysql_free_result(res); /* Free normal result set with meta data */ - /* Clear prepare warnings */ - dynstr_set(&ds_prepare_warnings, NULL); + /* + Clear prepare warnings if there are execute warnings, + since they are probably duplicated. + */ + if (ds_execute_warnings.length || mysql->warning_count) + dynstr_set(&ds_prepare_warnings, NULL); } else { diff --git a/mysql-test/include/have_dbi_dbd-mysql.inc b/mysql-test/include/have_dbi_dbd-mysql.inc new file mode 100644 index 00000000000..212e36ac353 --- /dev/null +++ b/mysql-test/include/have_dbi_dbd-mysql.inc @@ -0,0 +1,78 @@ +# +# Originally created by John Embretsen, 2011-01-26. +# +# Checks for the existence of Perl modules DBI and DBD::mysql as seen from the +# perl installation used by "external" executable perl scripts, i.e. scripts +# that are executed as standalone scripts interpreted by the perl installation +# specified by the "shebang" line in the top of these scripts. +# +# If either module is not found, the test will be skipped. +# +# For use in tests that call perl scripts that require these modules. +# +# This file is intended to work on Unix. Windows may need different treatment. +# Reasoning: +# - "shebangs" are not relevant on Windows, but need to be handled here. +# - Perl scripts cannot be made executable on Windows, interpreter must be +# specified. +# +# Note that if there are multiple perl installations and not all have the +# required modules, this check may fail even if the perl in path does have +# the modules available. This may happen if the perl specified by the script's +# shebang (e.g. #!/usr/bin/perl) does not have these modules, and script is +# called without specifying the perl interpreter. However, this will be +# a correct result in cases where a test calls a script with a similar shebang. +# +################################################################################ + +--source include/not_windows.inc + +# We jump through some hoops since there is no direct way to check if an +# external command went OK or not from a mysql-test file: +# +# - In theory, we could do as simple as "exec perl -MDBI -MDBD::mysql -e 1", +# however we cannot check the result (exit code) from within a test script. +# Also, this may not yield the same result as other uses of perl due to the +# shebang issue mentioned above. +# - Instead we use a separate helper perl script that checks for the modules. +# - If the modules are found, the perl script leaves a file which sets a +# variable that can be read by this file. +# If the modules are not found, the perl script does not set this variable, +# but leaves an empty file instead. +# +# This is done because there is apparently no direct way to transfer +# information from perl to the test script itself. + +--disable_query_log +--disable_result_log +--disable_warnings + +# We do not use embedded perl in this script because that would not have yielded +# correct results for a situation where an external Perl script is called like +# "scriptname" instead of "perl scriptname" and the shebang in the script points +# to a specific perl that may be different than the perl in PATH. +# +# Instead, we call a separate helper script which checks for the modules in its +# own environment. We call it without "perl" in front. + +--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl +--let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt + +# Make the script executable and execute it. +--chmod 0755 $perlChecker +--exec $perlChecker + +# Source the resulting temporary file and look for a variable being set. +--source $resultFile + +if (!$dbidbd) { + --skip Test needs Perl modules DBI and DBD::mysql +} + +# Clean up +--remove_file $resultFile + +--enable_query_log +--enable_result_log +--enable_warnings + diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc index b3fd5e47179..110b0769ae1 100644 --- a/mysql-test/include/mysqlhotcopy.inc +++ b/mysql-test/include/mysqlhotcopy.inc @@ -4,12 +4,26 @@ --source include/not_windows.inc --source include/not_embedded.inc +--source include/have_dbi_dbd-mysql.inc -if ($MYSQLHOTCOPY) +if (!$MYSQLHOTCOPY) { + # Fail the test if the mysqlhotcopy script is missing. + # If the tool's location changes, mysql-test-run.pl must be updated to + # reflect this (look for "MYSQLHOTCOPY"). die due to missing mysqlhotcopy tool; } +# NOTE (johnemb, 2011-01-26): +# In this test mysqlhotcopy (a perl script) is executed as a standalone +# executable, i.e. not necessarily using the perl interpreter in PATH, +# because that is how the documentation demonstrates it. +# +# We include have_dbi_dbd-mysql.inc above so that the test will +# be skipped if Perl modules required by the mysqlhotcopy tool are not +# found when the script is run this way. + + let $MYSQLD_DATADIR= `SELECT @@datadir`; --disable_warnings DROP DATABASE IF EXISTS hotcopy_test; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 388d2cd2672..03dd3e5bd3f 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2141,10 +2141,12 @@ sub environment_setup { # mysqlhotcopy # ---------------------------------------------------- my $mysqlhotcopy= - mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy"); - # Since mysqltest interprets the real path as "false" in an if, - # use 1 ("true") to indicate "not exists" so it can be tested for - $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy || 1; + mtr_pl_maybe_exists("$basedir/scripts/mysqlhotcopy") || + mtr_pl_maybe_exists("$path_client_bindir/mysqlhotcopy"); + if ($mysqlhotcopy) + { + $ENV{'MYSQLHOTCOPY'}= $mysqlhotcopy; + } # ---------------------------------------------------- # perror diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 0426ce42071..269b6875430 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -1,5 +1,18 @@ drop table if exists t1; # +# Bug#57924: crash when creating partitioned table with +# multiple columns in the partition key +# +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)) +PARTITION BY KEY(a, b, a); +ERROR HY000: Field in list of fields for partition function not found in table +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)) +PARTITION BY KEY(A, b); +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)) +PARTITION BY KEY(a, b, A); +ERROR HY000: Field in list of fields for partition function not found in table +# # Bug#54483: valgrind errors when making warnings for multiline inserts # into partition # diff --git a/mysql-test/std_data/checkDBI_DBD-mysql.pl b/mysql-test/std_data/checkDBI_DBD-mysql.pl new file mode 100644 index 00000000000..f001e471081 --- /dev/null +++ b/mysql-test/std_data/checkDBI_DBD-mysql.pl @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; version 2 +# of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +################################################################################ +# +# This perl script checks for availability of the Perl modules DBI and +# DBD::mysql using the "current" perl interpreter. +# +# Useful for test environment checking before testing executable perl scripts +# in the MySQL Server distribution. +# +# NOTE: The "shebang" on the first line of this script should always point to +# /usr/bin/perl, so that we can use this script to check whether or not we +# support running perl scripts with such a shebang without specifying the +# perl interpreter on the command line. Such a script is mysqlhotcopy. +# +# When run as "checkDBI_DBD-mysql.pl" the shebang line will be evaluated +# and used. When run as "perl checkDBI_DBD-mysql.pl" the shebang line is +# not used. +# +# NOTE: This script will create a temporary file in MTR's tmp dir. +# If modules are found, a mysql-test statement which sets a special +# variable is written to this file. If one of the modules is not found +# (or cannot be loaded), the file will remain empty. +# A test (or include file) which sources that file can then easily do +# an if-check on the special variable to determine success or failure. +# +# Example: +# +# --let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl +# --let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt +# --chmod 0755 $perlChecker +# --exec $perlChecker +# --source $resultFile +# if (!$dbidbd) { +# --skip Test needs Perl modules DBI and DBD::mysql +# } +# +# The calling script is also responsible for cleaning up after use: +# +# --remove_file $resultFile +# +# Windows notes: +# - shebangs may work differently - call this script with "perl " in front. +# +# See mysql-test/include/have_dbi_dbd-mysql.inc for example use of this script. +# This script should be executable for the user running MTR. +# +################################################################################ + +BEGIN { + # By using eval inside BEGIN we can suppress warnings and continue after. + # We need to catch "Can't locate" as well as "Can't load" errors. + eval{ + $FOUND_DBI=0; + $FOUND_DBD_MYSQL=0; + + # Check for DBI module: + $FOUND_DBI=1 if require DBI; + + # Check for DBD::mysql module + $FOUND_DBD_MYSQL=1 if require DBD::mysql; + }; +}; + +# Open a file to be used for transfer of result back to mysql-test. +# The file must be created whether we write to it or not, otherwise mysql-test +# will complain if trying to source it. +# An empty file indicates failure to load modules. +open(FILE, ">", $ENV{'MYSQL_TMP_DIR'}.'/dbidbd-mysql.txt'); + +if ($FOUND_DBI && $FOUND_DBD_MYSQL) { + # write a mysql-test command setting a variable to indicate success + print(FILE 'let $dbidbd= FOUND_DBI_DBD-MYSQL;'."\n"); +} + +# close the file. +close(FILE); + +1; + diff --git a/mysql-test/suite/ndb/r/ndb_basic.result b/mysql-test/suite/ndb/r/ndb_basic.result index 9f4f8c0755c..ee50352220e 100644 --- a/mysql-test/suite/ndb/r/ndb_basic.result +++ b/mysql-test/suite/ndb/r/ndb_basic.result @@ -585,6 +585,8 @@ c127 int, c128 int, primary key using hash(c1)) engine=ndb partition by key(c1); drop table t1; +create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`); +ERROR HY000: Field in list of fields for partition function not found in table create table t1 ( a1234567890123456789012345678901234567890 int primary key, a12345678901234567890123456789a1234567890 int, diff --git a/mysql-test/suite/ndb/t/ndb_basic.test b/mysql-test/suite/ndb/t/ndb_basic.test index 2fc140288ca..5d6221d1784 100644 --- a/mysql-test/suite/ndb/t/ndb_basic.test +++ b/mysql-test/suite/ndb/t/ndb_basic.test @@ -547,6 +547,13 @@ c128 int, primary key using hash(c1)) engine=ndb partition by key(c1); drop table t1; +# +# test bug#53354 - crash when creating partitioned table with multiple columns in the partition key +# + +--error ER_FIELD_NOT_FOUND_PART_ERROR +create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`); + # # test max size of attribute name and truncation # diff --git a/mysql-test/suite/parts/inc/partition_check_drop.inc b/mysql-test/suite/parts/inc/partition_check_drop.inc index daaa5e541c7..137de4165a0 100644 --- a/mysql-test/suite/parts/inc/partition_check_drop.inc +++ b/mysql-test/suite/parts/inc/partition_check_drop.inc @@ -66,10 +66,10 @@ if ($found_garbage) } # Do a manual cleanup, because the following tests should not suffer from # remaining files - --exec rm -f $MYSQLD_DATADIR/test/t1* || true + --remove_files_wildcard $MYSQLD_DATADIR/test t1* if ($with_directories) { - --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true + --remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1* } } --enable_query_log diff --git a/mysql-test/suite/parts/inc/partition_layout_check1.inc b/mysql-test/suite/parts/inc/partition_layout_check1.inc index bca41b6f9c7..66a93d5d8d7 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check1.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check1.inc @@ -29,14 +29,10 @@ DELETE FROM t0_definition; let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`; #echo MYSQLD_DATADIR: $MYSQLD_DATADIR; -# Dump the current definition of the table t1 to tmp1 -# This complicated method - let another mysqltest collect the output - is used -# because of two reasons +# Save the current definition of the table t1 # - SHOW CREATE TABLE t1 is at least currently most probably more reliable than # the corresponding SELECT on the INFORMATION_SCHEMA -# - SHOW CREATE TABLE .. cannot write its out put into a file like SELECT -let $show_file= $MYSQLD_DATADIR/test/tmp1; ---exec echo "SHOW CREATE TABLE t1; exit; " | $MYSQL_TEST > $show_file 2>&1 +let $show_create= `SHOW CREATE TABLE t1`; if ($do_file_tests) { # List the files belonging to the table t1 @@ -57,12 +53,13 @@ if (!$do_file_tests) # Insert the current definition of the table t1 into t0_definition eval INSERT INTO t0_definition SET state = 'old', - create_command = load_file('$show_file'), + create_command = "$show_create", file_list = @aux; # Print the create table statement into the protocol +# Added the concat to avoid changing the result files --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR '\r' '' -SELECT create_command FROM t0_definition WHERE state = 'old'; +SELECT concat('SHOW CREATE TABLE t1;\nTable\tCreate Table\n',create_command,'\n') as `create_command` FROM t0_definition WHERE state = 'old'; if ($do_file_tests) { # We stored the list of files, therefore printing the content makes sense diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc index 7ff871a4c45..2f74455a811 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check2.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc @@ -28,9 +28,8 @@ DELETE FROM t0_definition WHERE state = 'new'; let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`; #echo MYSQLD_DATADIR: $MYSQLD_DATADIR; -# Dump the current definition of the table t1 to tmp1 -let $show_file= $MYSQLD_DATADIR/test/tmp1; ---exec echo "SHOW CREATE TABLE t1; exit; " | $MYSQL_TEST > $show_file 2>&1 +# Save the current definition of the table t1 +let $show_create= `SHOW CREATE TABLE t1`; if ($do_file_tests) { @@ -52,7 +51,7 @@ if (!$do_file_tests) # Insert the current definition of the table t1 into t0_definition eval INSERT INTO t0_definition SET state = 'new', - create_command = load_file('$show_file'), + create_command = "$show_create", file_list = @aux; # Print the old and new table layout, if they differ diff --git a/mysql-test/suite/parts/r/partition_recover_myisam.result b/mysql-test/suite/parts/r/partition_recover_myisam.result index 49775ee498e..cf3ccaa73b3 100644 --- a/mysql-test/suite/parts/r/partition_recover_myisam.result +++ b/mysql-test/suite/parts/r/partition_recover_myisam.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("t1_will_crash"); call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); diff --git a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test index 79ef3d537bf..e9abe134d84 100644 --- a/mysql-test/suite/parts/t/partition_debug_sync_innodb.test +++ b/mysql-test/suite/parts/t/partition_debug_sync_innodb.test @@ -14,6 +14,7 @@ partition by range (a) insert into t1 values (1), (11), (21), (33); SELECT * FROM t1; SHOW CREATE TABLE t1; +--replace_result #p# #P# --list_files $MYSQLD_DATADIR/test SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open'; @@ -36,6 +37,7 @@ ALTER TABLE t1 REORGANIZE PARTITION p0 INTO disconnect con1; connection default; --reap +--replace_result #p# #P# --list_files $MYSQLD_DATADIR/test SHOW CREATE TABLE t1; SELECT * FROM t1; diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.test b/mysql-test/suite/parts/t/partition_recover_myisam.test index 64bc821ac37..043ec16a9f4 100644 --- a/mysql-test/suite/parts/t/partition_recover_myisam.test +++ b/mysql-test/suite/parts/t/partition_recover_myisam.test @@ -1,6 +1,6 @@ # test the auto-recover (--myisam-recover) of partitioned myisam tables -call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("t1_will_crash"); call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); --source include/have_partition.inc @@ -20,6 +20,8 @@ FLUSH TABLES; let $MYSQLD_DATADIR= `select @@datadir`; --remove_file $MYSQLD_DATADIR/test/t1_will_crash.MYI --copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1_will_crash.MYI +--replace_result \\ / +--replace_regex /Table '.*data/Table './ SELECT * FROM t1_will_crash; DROP TABLE t1_will_crash; CREATE TABLE t1_will_crash (a INT, KEY (a)) @@ -33,5 +35,7 @@ FLUSH TABLES; --echo # head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI --remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI --copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI +--replace_result \\ / +--replace_regex /Table '.*data/Table './ SELECT * FROM t1_will_crash; DROP TABLE t1_will_crash; diff --git a/mysql-test/suite/parts/t/partition_special_innodb.test b/mysql-test/suite/parts/t/partition_special_innodb.test index eac19f6d588..f237b02f331 100644 --- a/mysql-test/suite/parts/t/partition_special_innodb.test +++ b/mysql-test/suite/parts/t/partition_special_innodb.test @@ -58,8 +58,8 @@ ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 2; -connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (con1, localhost, root,,); +connect (con2, localhost, root,,); --connection con1 SET autocommit=OFF; diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index b5956a78371..3b3a55fe4cd 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -13,3 +13,5 @@ rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576 rpl_log_pos : BUG#55675 Sep 10 2010 27 2010 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock +rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out +rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out diff --git a/mysql-test/suite/sys_vars/r/general_log_file_basic.result b/mysql-test/suite/sys_vars/r/general_log_file_basic.result index 5c0b93cf4ab..31fdd07d06e 100644 --- a/mysql-test/suite/sys_vars/r/general_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_file_basic.result @@ -16,4 +16,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log_file'; @@global.general_log_file = VARIABLE_VALUE 1 -SET @@global.general_log_file= 'test.log'; +SET @@global.general_log_file= 'start_value'; diff --git a/mysql-test/suite/sys_vars/r/log_output_func.result b/mysql-test/suite/sys_vars/r/log_output_func.result index 00a8e824f78..24703f4317b 100644 --- a/mysql-test/suite/sys_vars/r/log_output_func.result +++ b/mysql-test/suite/sys_vars/r/log_output_func.result @@ -52,7 +52,7 @@ count(*) DROP TABLE t1; connection default; SET @@global.general_log= 'OFF'; -SET @@global.general_log_file= '/home/horst/bzr/5.1-52501/mysql-test/var/mysqld.1/mysqld.log'; +SET @@global.general_log_file= 'start_general_log_file'; SET @@global.log_output= @start_value; SET @@global.general_log= @start_general_log; SET @@global.general_log= 'ON'; diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result index 3cd62187d0b..ce4fd8094bf 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result @@ -14,4 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log_file'; @@global.slow_query_log_file = VARIABLE_VALUE 1 -SET @@global.slow_query_log_file= 'slowtest.log'; +SET @@global.slow_query_log_file= 'start_value'; diff --git a/mysql-test/suite/sys_vars/t/div_precision_increment_func.test b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test index aebca88abf9..ba7bc65eb48 100644 --- a/mysql-test/suite/sys_vars/t/div_precision_increment_func.test +++ b/mysql-test/suite/sys_vars/t/div_precision_increment_func.test @@ -19,7 +19,7 @@ # # ################################################################################ -let $save_div_precision_increment = `SELECT @@global.div_precision_increment` +let $save_div_precision_increment = `SELECT @@global.div_precision_increment`; #SET @save_div_precision_increment = @@global.div_precision_increment; diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test index 35905bad987..f02c59736e3 100644 --- a/mysql-test/suite/sys_vars/t/general_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test @@ -70,6 +70,7 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log_file'; #SET @@global.general_log_file= @start_value; +--replace_result $start_value start_value eval SET @@global.general_log_file= '$start_value'; ##################################################### diff --git a/mysql-test/suite/sys_vars/t/log_output_func.test b/mysql-test/suite/sys_vars/t/log_output_func.test index 8a2fbe0728b..6b7c01a7dab 100644 --- a/mysql-test/suite/sys_vars/t/log_output_func.test +++ b/mysql-test/suite/sys_vars/t/log_output_func.test @@ -115,6 +115,7 @@ file_exists $MYSQLTEST_VARDIR/run/mytest.log ; connection default; SET @@global.general_log= 'OFF'; #SET @@global.general_log_file= @start_general_log_file; +--replace_result $start_general_log_file start_general_log_file eval SET @@global.general_log_file= '$start_general_log_file'; SET @@global.log_output= @start_value; SET @@global.general_log= @start_general_log; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test index 810588b8f4e..4eb747d888b 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test @@ -68,6 +68,7 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log_file'; #SET @@global.slow_query_log_file= @start_value; +--replace_result $start_value start_value eval SET @@global.slow_query_log_file= '$start_value'; #SELECT @start_value; ##################################################### diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 4510652b03f..c244d08e308 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,7 +11,5 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails -main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index b222b02252b..7e574fd6a42 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -10,6 +10,21 @@ drop table if exists t1; let $MYSQLD_DATADIR= `SELECT @@datadir`; +--echo # +--echo # Bug#57924: crash when creating partitioned table with +--echo # multiple columns in the partition key +--echo # +--error ER_FIELD_NOT_FOUND_PART_ERROR +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)) +PARTITION BY KEY(a, b, a); +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)) +PARTITION BY KEY(A, b); +DROP TABLE t1; +--error ER_FIELD_NOT_FOUND_PART_ERROR +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b)) +PARTITION BY KEY(a, b, A); + + --echo # --echo # Bug#54483: valgrind errors when making warnings for multiline inserts --echo # into partition @@ -673,7 +688,6 @@ PARTITION BY HASH (TIME_TO_SEC(a)); CREATE TABLE t1 (a INT) PARTITION BY HASH (TIME_TO_SEC(a)); - --echo # --echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) --echo # diff --git a/sql/item.h b/sql/item.h index 38b33bdf2fe..b187c1b6717 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_func.h b/sql/item_func.h index e9d91b56318..5dd68157e0b 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index f4299460abf..9c1ac512bcb 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f8e5130880b..d10f695f535 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,4 +1,4 @@ -/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. +/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -761,6 +761,9 @@ static bool handle_list_of_fields(List_iterator it, bool result; char *field_name; bool is_list_empty= TRUE; + int fields_handled = 0; + char* field_name_array[MAX_KEY]; + DBUG_ENTER("handle_list_of_fields"); while ((field_name= it++)) @@ -776,6 +779,25 @@ static bool handle_list_of_fields(List_iterator it, result= TRUE; goto end; } + + /* + Check for duplicate fields in the list. + Assuming that there are not many fields in the partition key list. + If there were, it would be better to replace the for-loop + with a more efficient algorithm. + */ + + field_name_array[fields_handled] = field_name; + for (int i = 0; i < fields_handled; ++i) + { + if (my_strcasecmp(system_charset_info, + field_name_array[i], field_name) == 0) + { + my_error(ER_FIELD_NOT_FOUND_PART_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } + } + fields_handled++; } if (is_list_empty) { diff --git a/sql/table.cc b/sql/table.cc index b43d29294a8..7dbf02027fa 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,4 +1,4 @@ -/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. +/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by