summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc11
-rw-r--r--client/mysqlbinlog.cc14
-rw-r--r--innobase/dict/dict0dict.c2
-rw-r--r--mysql-test/include/diff_tables.inc122
-rw-r--r--mysql-test/include/mysqldump.inc50
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/r/distinct.result8
-rw-r--r--mysql-test/r/func_compress.result9
-rw-r--r--mysql-test/r/func_str.result9
-rw-r--r--mysql-test/r/grant_cache.result2
-rw-r--r--mysql-test/r/heap_btree.result7
-rw-r--r--mysql-test/r/information_schema_db.result8
-rw-r--r--mysql-test/r/innodb_mysql.result12
-rw-r--r--mysql-test/r/mysql.result6
-rw-r--r--mysql-test/r/mysqlbinlog.result2
-rw-r--r--mysql-test/r/mysqldump_restore.result110
-rw-r--r--mysql-test/r/rpl_temporary.result19
-rw-r--r--mysql-test/r/subselect3.result19
-rw-r--r--mysql-test/r/type_time.result10
-rw-r--r--mysql-test/r/union.result13
-rw-r--r--mysql-test/r/user_var.result11
-rw-r--r--mysql-test/r/view.result19
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/func_compress.test20
-rw-r--r--mysql-test/t/func_str.test10
-rw-r--r--mysql-test/t/grant_cache.test12
-rw-r--r--mysql-test/t/heap_btree.test8
-rw-r--r--mysql-test/t/information_schema_db.test44
-rw-r--r--mysql-test/t/innodb_mysql.test9
-rw-r--r--mysql-test/t/mysql.test7
-rw-r--r--mysql-test/t/mysqlbinlog.test10
-rw-r--r--mysql-test/t/mysqldump.test1
-rw-r--r--mysql-test/t/mysqldump_restore.test111
-rw-r--r--mysql-test/t/rpl_temporary.test70
-rw-r--r--mysql-test/t/subselect3.test19
-rw-r--r--mysql-test/t/type_time.test13
-rw-r--r--mysql-test/t/union.test12
-rw-r--r--mysql-test/t/user_var.test12
-rw-r--r--mysql-test/t/view.test23
-rw-r--r--mysys/mf_getdate.c8
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_myisam.cc2
-rw-r--r--sql/ha_myisammrg.cc4
-rw-r--r--sql/item.cc3
-rw-r--r--sql/item_func.cc35
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/item_strfunc.cc20
-rw-r--r--sql/slave.cc10
-rw-r--r--sql/sql_class.cc2
-rw-r--r--sql/sql_delete.cc20
-rw-r--r--sql/sql_profile.cc5
-rw-r--r--sql/sql_select.cc8
-rw-r--r--sql/sql_union.cc16
-rw-r--r--sql/table.cc2
-rw-r--r--tests/mysql_client_test.c20
55 files changed, 946 insertions, 59 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 93aab390e5a..89f1f28bb1b 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -140,7 +140,7 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
default_charset_used= 0, opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0,
- show_warnings= 0;
+ show_warnings= 0, ignore_spaces= 0;
static volatile int executing_query= 0, interrupted_query= 0;
static my_bool preserve_comments= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
@@ -1350,8 +1350,9 @@ static struct my_option my_long_options[] =
{"no-named-commands", 'g',
"Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0,
- GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"ignore-spaces", 'i', "Ignore space after function names.",
+ (gptr*) &ignore_spaces, (gptr*) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
+ 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
(gptr*) &opt_local_infile,
(gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -1749,6 +1750,10 @@ static int get_options(int argc, char **argv)
}
if (tty_password)
opt_password= get_tty_password(NullS);
+
+ if (ignore_spaces)
+ connect_flag|= CLIENT_IGNORE_SPACE;
+
return(0);
}
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index ed072902730..36b86ae7a96 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -626,6 +626,7 @@ Create_file event for file_id: %u\n",exv->file_id);
glob_description_event= (Format_description_log_event*) ev;
print_event_info->common_header_len= glob_description_event->common_header_len;
ev->print(result_file, print_event_info);
+ ev->temp_buf= 0;
/*
We don't want this event to be deleted now, so let's hide it (I
(Guilhem) should later see if this triggers a non-serious Valgrind
@@ -668,8 +669,16 @@ Begin_load_query event for file_id: %u\n", exlq->file_id);
end:
rec_count++;
+ /*
+ Destroy the log_event object. If reading from a remote host,
+ set the temp_buf to NULL so that memory isn't freed twice.
+ */
if (ev)
+ {
+ if (remote_opt)
+ ev->temp_buf= 0;
delete ev;
+ }
DBUG_RETURN(0);
}
@@ -1151,6 +1160,11 @@ could be out of memory");
error= 1;
goto err;
}
+ /*
+ If reading from a remote host, ensure the temp_buf for the
+ Log_event class is pointing to the incoming stream.
+ */
+ ev->register_temp_buf((char *) net->read_pos + 1);
Log_event_type type= ev->get_type_code();
if (glob_description_event->binlog_version >= 3 ||
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index b0d95597153..c1ca6f369c3 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -2829,7 +2829,7 @@ scan_more:
} else if (quote) {
/* Within quotes: do not look for
starting quotes or comments. */
- } else if (*sptr == '"' || *sptr == '`') {
+ } else if (*sptr == '"' || *sptr == '`' || *sptr == '\'') {
/* Starting quote: remember the quote character. */
quote = *sptr;
} else if (*sptr == '#'
diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc
new file mode 100644
index 00000000000..d15dd56b35d
--- /dev/null
+++ b/mysql-test/include/diff_tables.inc
@@ -0,0 +1,122 @@
+# ==== Purpose ====
+#
+# Check if the two given tables (possibly residing on different
+# master/slave servers) are equal.
+#
+# ==== Usage ====
+#
+# The tables to check are given by the test language variables
+# $diff_table_1 and $diff_table_2. They must be of the
+# following form:
+#
+# [master:|slave:]database.table
+#
+# I.e., both database and table must be speicified. Optionally, you
+# can prefix the name with 'master:' (to read the table on master) or
+# with 'slave:' (to read the table on slave). If no prefix is given,
+# reads the table from the current connection. If one of these
+# variables has a prefix, both should have a prefix.
+#
+# ==== Side effects ====
+#
+# - Prints "Comparing tables $diff_table_1 and $diff_tables_2".
+#
+# - If the tables are different, prints the difference in a
+# system-specific format (unified diff if supported) and generates
+# an error.
+#
+# - If $diff_table_1 or $diff_table_2 begins with 'master:' or
+# 'slave:', it will stay connected to one of those hosts after
+# execution. The host is only guaranteed to remain unchanged if
+# none of $diff_table_1 or $diff_table_2 begins with 'master:' or
+# 'slave:'.
+#
+# ==== Bugs ====
+#
+# - It is currently not possible to use this for tables that are
+# supposed to be different, because if the files are different:
+# - 'diff' produces system-dependent output,
+# - the output includes the absolute path of the compared files,
+# - the output includes a timestamp.
+# To fix that, we'd probably have to use SQL to compute the
+# symmetric difference between the tables. I'm not sure how to do
+# that efficiently. If we implement this, it would be nice to
+# compare the table definitions too.
+#
+# - It actually compares the result of "SELECT * FROM table ORDER BY
+# col1, col2, ..., colN INTO OUTFILE 'file'". Hence, it is assumed
+# that the comparison orders for both tables are equal and that two
+# rows that are equal in the comparison order cannot differ, e.g.,
+# by character case.
+
+
+# ==== Save both tables to file ====
+
+--echo Comparing tables $diff_table_1 and $diff_table_2
+disable_query_log;
+
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2
+
+let $_diff_table=$diff_table_2;
+let $_diff_i=2;
+while ($_diff_i) {
+
+ # Parse out any leading "master:" or "slave:" from the table
+ # specification and connect the appropriate server.
+ let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`;
+ if ($_diff_conn_master) {
+ let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`;
+ connection master;
+ }
+ let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`;
+ if ($_diff_conn_slave) {
+ let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`;
+ connection slave;
+ }
+
+ # Sanity-check the input.
+ let $_diff_error= `SELECT '$_diff_table' NOT LIKE '_%._%'`;
+ if ($_diff_error) {
+ --echo !!!ERROR IN TEST: \$diff_table_$_diff_i='$_diff_table' is not in the form database.table
+ exit;
+ }
+
+ # We need the output files to be sorted (so that diff_files does not
+ # think the files are different just because they are differently
+ # ordered). To this end, we first generate a query that sorts the
+ # table by all columns. Since ORDER BY accept column indices, we
+ # just generate a comma-separated list of all numbers from 1 to the
+ # number of columns in the table.
+ let $_diff_column_index=`SELECT MAX(ordinal_position)
+ FROM information_schema.columns
+ WHERE CONCAT(table_schema, '.', table_name) =
+ '$_diff_table'`;
+ let $_diff_column_list=$_diff_column_index;
+ dec $_diff_column_index;
+ while ($_diff_column_index) {
+ let $_diff_column_list=$_diff_column_index, $_diff_column_list;
+ dec $_diff_column_index;
+ }
+
+ # Now that we have the comma-separated list of columns, we can write
+ # the table to a file.
+ eval SELECT * FROM $_diff_table ORDER BY $_diff_column_list
+ INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/diff_table_$_diff_i';
+
+ # Do the same for $diff_table_1.
+ dec $_diff_i;
+ let $_diff_table=$diff_table_1;
+}
+
+
+# ==== Compare the generated files ====
+
+diff_files $MYSQLTEST_VARDIR/tmp/diff_table_1 $MYSQLTEST_VARDIR/tmp/diff_table_2;
+
+--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1
+--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2
+
+enable_query_log;
diff --git a/mysql-test/include/mysqldump.inc b/mysql-test/include/mysqldump.inc
new file mode 100644
index 00000000000..6227138b012
--- /dev/null
+++ b/mysql-test/include/mysqldump.inc
@@ -0,0 +1,50 @@
+################################################################################
+# mysqldump.inc
+#
+# SUMMARY: include file to facilitate testing the quality of mysqldump output
+#
+# INPUTS: Two variables:
+# $table_name - the name of the table that was dumped
+# $mysqldumpfile - the name of the file that captured mysqldump output
+#
+# OUTPUTS: minor echo data:
+# We 'echo' some stage information to the .result file:
+# 'altering original table', 'restoring from dumpfile', 'comparing'
+#
+# OTHER FILES: We use include/diff_tables.inc to compare the original, renamed
+# table with the 'restored' one.
+#
+# DESCRIPTION: This file works by being fed the name of the original table
+# and a mysqldump output file. The original table is then renamed
+# to <table_name>_orig, the mysqldump file is used to recreate the
+# table, then diff_tables.inc is called to compare them.
+#
+# LIMITATIONS: Does *NOT* work with xml output!
+#
+# AUTHOR: pcrews 2009-05-21
+# Bug#40465 mysqldump.test does no checking of dump or restore
+#
+# LAST CHANGE: 2009-05-21
+#
+################################################################################
+
+--echo # Begin testing mysqldump output + restore
+--echo # Create 'original table name - <table>_orig
+# NOTE: We use SET then let as query_get_value has issues with the extra commas
+# used in the CONCAT statement.
+eval SET @orig_table_name = CONCAT('$table_name', '_orig');
+let $orig_table_name = query_get_value(SELECT @orig_table_name,@orig_table_name,1);
+--echo # Rename original table
+eval ALTER TABLE $table_name RENAME to $orig_table_name;
+--echo # Recreate table from mysqldump output
+--exec $MYSQL test < $mysqldumpfile
+--echo # Compare original and recreated tables
+--echo # Recreated table: $table_name
+--echo # Original table: $orig_table_name
+let $diff_table_1 = $table_name;
+let $diff_table_2 = $orig_table_name;
+--source include/diff_tables.inc
+--echo # Cleanup
+--remove_file $mysqldumpfile
+eval DROP TABLE $table_name, $orig_table_name;
+
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ffa9b4cb1d3..f60701b7b49 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1106,7 +1106,7 @@ sub command_line_setup () {
# On some operating systems, there is a limit to the length of a
# UNIX domain socket's path far below PATH_MAX, so try to avoid long
# socket path names.
- $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
+ $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 ) && (! $glob_win32 );
$master->[0]=
{
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 114d3088fe8..ddbee3ec79c 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -629,21 +629,21 @@ SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8;
@v5 @v6 @v7 @v8
-3 PEAR 3 PEAR
+2 APPLE 2 APPLE
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
WHERE fruit_name = 'APPLE';
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
@v5 @v6 @v7 @v8 @v9 @v10
-3 PEAR 3 PEAR 5 PEARAPPLE
+2 APPLE 2 APPLE 4 APPLEAPPLE
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v11, @v12, @v13, @v14;
@v11 @v12 @v13 @v14
-6 PEARPEAR 6 PEARPEAR
+4 APPLEAPPLE 4 APPLEAPPLE
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
SELECT @v15, @v16;
@v15 @v16
-6 PEARPEAR
+4 APPLEAPPLE
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
'APPLE';
SELECT @v17, @v18;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 4a3454cf658..d8745c38f57 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -116,4 +116,13 @@ Warnings:
Error 1259 ZLIB: Input data corrupted
Error 1259 ZLIB: Input data corrupted
drop table t1;
+CREATE TABLE t1 (c1 INT);
+INSERT INTO t1 VALUES (1), (1111), (11111);
+SELECT UNCOMPRESS(c1), UNCOMPRESSED_LENGTH(c1) FROM t1;
+UNCOMPRESS(c1) UNCOMPRESSED_LENGTH(c1)
+NULL NULL
+NULL NULL
+NULL 825307441
+EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s;
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 1d7395ae14d..75f8983e838 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2187,4 +2187,13 @@ SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i F
h i
31.12.2008 AAAAAA, aaaaaa
DROP TABLE t1;
+#
+# BUG#44774: load_file function produces valgrind warnings
+#
+CREATE TABLE t1 (a TINYBLOB);
+INSERT INTO t1 VALUES ('aaaaaaaa');
+SELECT LOAD_FILE(a) FROM t1;
+LOAD_FILE(a)
+NULL
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index 925a5918c1b..b56ad6dea2a 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -149,7 +149,7 @@ select "user3";
user3
user3
select * from t1;
-ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
select a from t1;
a
1
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index c20dfbe80d2..65ced2bd24e 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -336,4 +336,11 @@ a b
NULL NULL
NULL 1
drop table t1;
+#
+# bug#39918 - memory (heap) engine crashing while executing self join with delete
+#
+CREATE TABLE t1(a INT, KEY USING BTREE (a)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES(1),(1);
+DELETE a1 FROM t1 AS a1, t1 AS a2 WHERE a1.a=a2.a;
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 786ba5716ec..92c5b6de2ec 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -50,7 +50,7 @@ begin
select table_name from information_schema.key_column_usage
order by table_name;
end|
-create table t1
+create table t1
(f1 int(10) unsigned not null,
f2 varchar(100) not null,
primary key (f1), unique key (f2));
@@ -192,15 +192,15 @@ View Create View
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
show create view testdb_1.v1;
ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1'
-select table_name from information_schema.columns a
+select table_name from information_schema.columns a
where a.table_name = 'v2';
table_name
v2
-select view_definition from information_schema.views a
+select view_definition from information_schema.views a
where a.table_name = 'v2';
view_definition
/* ALGORITHM=UNDEFINED */ select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
-select view_definition from information_schema.views a
+select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
view_definition
select * from v2;
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index d95499fe3ba..b6fc58be4c2 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1291,4 +1291,16 @@ SAVEPOINT s4;
ROLLBACK;
ROLLBACK TO SAVEPOINT s4;
ERROR 42000: SAVEPOINT s4 does not exist
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NULL, f3 CHAR(10) DEFAULT 'My ID#', CONSTRAINT f2_ref FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=INNODB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL COMMENT 'My ID#',
+ `f2` int(11) default NULL,
+ `f3` char(10) default 'My ID#',
+ PRIMARY KEY (`f1`),
+ KEY `f2_ref` (`f2`),
+ CONSTRAINT `f2_ref` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 10537f6da16..5f315bca9c2 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -192,4 +192,10 @@ delimiter
1
1
1
+COUNT (*)
+1
+COUNT (*)
+1
+COUNT (*)
+1
End of 5.0 tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 23244d2b3c4..4cb8eb29f19 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -380,4 +380,6 @@ IS NOT NULL
1
*** Unsigned server_id 4294967295 is found: 1 ***
SET @@global.server_id= 1;
+RESET MASTER;
+FLUSH LOGS;
End of 5.0 tests
diff --git a/mysql-test/r/mysqldump_restore.result b/mysql-test/r/mysqldump_restore.result
new file mode 100644
index 00000000000..16698251913
--- /dev/null
+++ b/mysql-test/r/mysqldump_restore.result
@@ -0,0 +1,110 @@
+# Set concurrent_insert = 0 to prevent random errors
+# will reset to original value at the end of the test
+SET @old_concurrent_insert = @@global.concurrent_insert;
+SET @@global.concurrent_insert = 0;
+# Pre-test cleanup
+DROP TABLE IF EXISTS t1;
+# Begin tests
+#
+# Bug#2005 Long decimal comparison bug.
+#
+CREATE TABLE t1 (a DECIMAL(64, 20));
+INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
+("0987654321098765432109876543210987654321");
+# Begin testing mysqldump output + restore
+# Create 'original table name - <table>_orig
+SET @orig_table_name = CONCAT('test.t1', '_orig');
+# Rename original table
+ALTER TABLE test.t1 RENAME to test.t1_orig;
+# Recreate table from mysqldump output
+# Compare original and recreated tables
+# Recreated table: test.t1
+# Original table: test.t1_orig
+Comparing tables test.t1 and test.t1_orig
+# Cleanup
+DROP TABLE test.t1, test.t1_orig;
+#
+# Bug#3361 mysqldump quotes DECIMAL values inconsistently
+#
+CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+ERROR 42S22: Unknown column '1.2345' in 'field list'
+SET SQL_MODE=@OLD_SQL_MODE;
+# Begin testing mysqldump output + restore
+# Create 'original table name - <table>_orig
+SET @orig_table_name = CONCAT('test.t1', '_orig');
+# Rename original table
+ALTER TABLE test.t1 RENAME to test.t1_orig;
+# Recreate table from mysqldump output
+# Compare original and recreated tables
+# Recreated table: test.t1
+# Original table: test.t1_orig
+Comparing tables test.t1 and test.t1_orig
+# Cleanup
+DROP TABLE test.t1, test.t1_orig;
+#
+# Bug#1994 mysqldump does not correctly dump UCS2 data
+# Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
+#
+CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
+INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
+# Begin testing mysqldump output + restore
+# Create 'original table name - <table>_orig
+SET @orig_table_name = CONCAT('test.t1', '_orig');
+# Rename original table
+ALTER TABLE test.t1 RENAME to test.t1_orig;
+# Recreate table from mysqldump output
+# Compare original and recreated tables
+# Recreated table: test.t1
+# Original table: test.t1_orig
+Comparing tables test.t1 and test.t1_orig
+# Cleanup
+DROP TABLE test.t1, test.t1_orig;
+#
+# WL#2319 Exclude Tables from dump
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (4),(5),(6);
+# Begin testing mysqldump output + restore
+# Create 'original table name - <table>_orig
+SET @orig_table_name = CONCAT('test.t2', '_orig');
+# Rename original table
+ALTER TABLE test.t2 RENAME to test.t2_orig;
+# Recreate table from mysqldump output
+# Compare original and recreated tables
+# Recreated table: test.t2
+# Original table: test.t2_orig
+Comparing tables test.t2 and test.t2_orig
+# Cleanup
+DROP TABLE test.t2, test.t2_orig;
+DROP TABLE t1;
+#
+# Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
+#
+CREATE TABLE t1 (`b` blob);
+INSERT INTO `t1` VALUES (0x602010000280100005E71A);
+# Begin testing mysqldump output + restore
+# Create 'original table name - <table>_orig
+SET @orig_table_name = CONCAT('test.t1', '_orig');
+# Rename original table
+ALTER TABLE test.t1 RENAME to test.t1_orig;
+# Recreate table from mysqldump output
+# Compare original and recreated tables
+# Recreated table: test.t1
+# Original table: test.t1_orig
+Comparing tables test.t1 and test.t1_orig
+# Cleanup
+DROP TABLE test.t1, test.t1_orig;
+# End tests
+# Cleanup
+# Reset concurrent_insert to its original value
+SET @@global.concurrent_insert = @old_concurrent_insert;
+# remove mysqldumpfile
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
index 15c069ab68d..1326c7491f5 100644
--- a/mysql-test/r/rpl_temporary.result
+++ b/mysql-test/r/rpl_temporary.result
@@ -133,3 +133,22 @@ select * from t1;
a
1
drop table t1;
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE t1 (a char(1));
+INSERT INTO t1 VALUES ('a');
+include/stop_slave.inc
+include/start_slave.inc
+INSERT INTO t1 VALUES ('b');
+DROP TABLE IF EXISTS t1;
+CREATE TEMPORARY TABLE `t1`(`a` tinyint,`b` char(1))engine=myisam;
+INSERT INTO `t1` set `a`=128,`b`='128';
+Warnings:
+Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+include/stop_slave.inc
+include/start_slave.inc
+INSERT INTO `t1` set `a`=128,`b`='128';
+Warnings:
+Warning 1264 Out of range value adjusted for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+DROP TABLE t1;
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 9a6f4436ff0..759c6689be8 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -849,4 +849,23 @@ ROW(1,2) = (SELECT 1, 1) ROW(1,2) IN (SELECT 1, 1)
SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
ROW(1,2) = (SELECT 1, 2) ROW(1,2) IN (SELECT 1, 2)
1 1
+CREATE TABLE t1 (a INT, b INT, c INT);
+INSERT INTO t1 VALUES (1,1,1), (1,1,1);
+EXPLAIN EXTENDED
+SELECT c FROM
+( SELECT
+(SELECT COUNT(a) FROM
+(SELECT COUNT(b) FROM t1) AS x GROUP BY c
+) FROM t1 GROUP BY b
+) AS y;
+ERROR 42S22: Unknown column 'c' in 'field list'
+SHOW WARNINGS;
+Level Code Message
+Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2
+Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2
+Error 1054 Unknown column 'c' in 'field list'
+Note 1003 select `c` AS `c` from (select (select count(`test`.`t1`.`a`) AS `COUNT(a)` from (select count(`test`.`t1`.`b`) AS `COUNT(b)` from `test`.`t1`) `x` group by `c`) AS `(SELECT COUNT(a) FROM
+(SELECT COUNT(b) FROM t1) AS x GROUP BY c
+)` from `test`.`t1` group by `test`.`t1`.`b`) `y`
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index 96bf23109df..69dca57398f 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -128,3 +128,13 @@ SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
sum(f3)
3
drop table t1;
+#
+# Bug #44792: valgrind warning when casting from time to time
+#
+CREATE TABLE t1 (c TIME);
+INSERT INTO t1 VALUES ('0:00:00');
+SELECT CAST(c AS TIME) FROM t1;
+CAST(c AS TIME)
+00:00:00
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index a5f49eef8d1..e806ed49c34 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -1518,4 +1518,17 @@ SHOW FIELDS FROM t2;
Field Type Null Key Default Extra
d double(9,6) YES NULL
DROP TABLE t1, t2;
+CREATE TABLE t1(a INT);
+EXPLAIN EXTENDED
+SELECT a FROM t1
+UNION
+SELECT a FROM t1
+ORDER BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 UNION t1 system NULL NULL NULL NULL 0 const row not found
+NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
+Warnings:
+Note 1003 select '0' AS `a` from `test`.`t1` union select '0' AS `a` from `test`.`t1` order by `a`
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 80b5dccc198..bfa95d8f92b 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -353,3 +353,14 @@ select @a:=f4, count(f4) from t1 group by 1 desc;
2.6 1
1.6 4
drop table t1;
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (0, 0), (2, 1), (2, 3), (1, 1), (30, 20);
+SELECT a, b INTO @a, @b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b;
+SELECT @a, @b;
+@a @b
+2 3
+SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b;
+a b
+2 3
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 58aa614c508..a7ac971ef45 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3705,5 +3705,24 @@ ERROR HY000: Key 'c2' doesn't exist in table 'v1'
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
+# -- Bug#40825: Error 1356 while selecting from a view
+# -- with a "HAVING" clause though query works
+# -----------------------------------------------------------------
+
+CREATE TABLE t1 (c INT);
+
+CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias;
+SHOW CREATE VIEW v1;
+View Create View
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`c` AS `view_column` from `t1` having `view_column`
+SELECT * FROM v1;
+view_column
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+# -- End of test case for Bug#40825
+
+# -----------------------------------------------------------------
# -- End of 5.0 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 49f422af298..e9de29e2c27 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -16,7 +16,6 @@ im_daemon_life_cycle : Bug#20294: Instance manager tests fail randomly
im_options_set : Bug#20294: Instance manager tests fail randomly
im_options_unset : Bug#20294: Instance manager tests fail randomly
im_utils : Bug#20294: Instance manager tests fail randomly
-grant_cache : Bug#32651: grant_cache.test fails
ndb_backup_print : Bug#32357: ndb_backup_print test fails sometimes in pushbuild
rpl_log_pos : Bug#8693 Test 'rpl_log_pos' fails sometimes
kill : Bug#29149 Test "kill" fails on Windows
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index 68f07f258bf..c84f22c5595 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -82,4 +82,24 @@ select *, uncompress(a) from t1;
select *, uncompress(a), uncompress(a) is null from t1;
drop table t1;
+#
+# Bug #44796: valgrind: too many my_longlong10_to_str_8bit warnings after
+# uncompressed_length
+#
+
+CREATE TABLE t1 (c1 INT);
+INSERT INTO t1 VALUES (1), (1111), (11111);
+
+# Disable warnings to avoid dependency on max_allowed_packet value
+--disable_warnings
+SELECT UNCOMPRESS(c1), UNCOMPRESSED_LENGTH(c1) FROM t1;
+--enable_warnings
+
+# We do not need the results, just make sure there are no valgrind errors
+--disable_result_log
+EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s;
+--enable_result_log
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 389538c4cc0..4b0f91e4408 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1168,4 +1168,14 @@ INSERT INTO t1 VALUES ('2008-12-31','aaaaaa');
SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1;
DROP TABLE t1;
+
+--echo #
+--echo # BUG#44774: load_file function produces valgrind warnings
+--echo #
+CREATE TABLE t1 (a TINYBLOB);
+INSERT INTO t1 VALUES ('aaaaaaaa');
+SELECT LOAD_FILE(a) FROM t1;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test
index c2e31621744..616a2746148 100644
--- a/mysql-test/t/grant_cache.test
+++ b/mysql-test/t/grant_cache.test
@@ -88,7 +88,7 @@ select a from t1;
select c from t1;
select * from mysqltest.t1,test.t1;
--replace_result 127.0.0.1 localhost
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from t2;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
@@ -99,17 +99,17 @@ connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user3;
select "user3";
--replace_result 127.0.0.1 localhost
---error 1143
+--error ER_TABLEACCESS_DENIED_ERROR
select * from t1;
select a from t1;
--replace_result 127.0.0.1 localhost
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
select c from t1;
--replace_result 127.0.0.1 localhost
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from t2;
--replace_result 127.0.0.1 localhost
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
select mysqltest.t1.c from test.t1,mysqltest.t1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
@@ -120,7 +120,7 @@ connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user4;
select "user4";
show grants;
---error 1046
+--error ER_NO_DB_ERROR
select a from t1;
# The following query is not cached before (different database)
select * from mysqltest.t1,test.t1;
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index 76c319c0bc1..710c8411751 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -253,5 +253,13 @@ insert into t1 values (1, 1), (3, 3), (2, 2), (NULL, 1), (NULL, NULL), (0, 0);
select * from t1 where a is null;
drop table t1;
+-- echo #
+-- echo # bug#39918 - memory (heap) engine crashing while executing self join with delete
+-- echo #
+
+CREATE TABLE t1(a INT, KEY USING BTREE (a)) ENGINE=MEMORY;
+INSERT INTO t1 VALUES(1),(1);
+DELETE a1 FROM t1 AS a1, t1 AS a2 WHERE a1.a=a2.a;
+DROP TABLE t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test
index 6353e94fd51..0ff1d05f364 100644
--- a/mysql-test/t/information_schema_db.test
+++ b/mysql-test/t/information_schema_db.test
@@ -53,7 +53,7 @@ order by table_name;
end|
delimiter ;|
-create table t1
+create table t1
(f1 int(10) unsigned not null,
f2 varchar(100) not null,
primary key (f1), unique key (f2));
@@ -105,8 +105,8 @@ drop function f2;
drop view v1, v2;
#
-# Bug#20543: select on information_schema strange warnings, view, different
-# schemas/users
+# Bug#20543 select on information_schema strange warnings, view, different
+# schemas/users
#
#
create database testdb_1;
@@ -125,7 +125,7 @@ grant insert on v1 to testdb_2@localhost;
create view v5 as select f1 from t1;
grant show view on v5 to testdb_2@localhost;
---error 1227
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
connection default;
@@ -169,46 +169,53 @@ use testdb_1;
revoke show view on v6 from testdb_2@localhost;
connection testdb_2;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show fields from testdb_1.v5;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view testdb_1.v5;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show fields from testdb_1.v6;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view testdb_1.v6;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show fields from testdb_1.v7;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view testdb_1.v7;
---error 1345
+--error ER_VIEW_NO_EXPLAIN
show create view v4;
-#--error 1345
+#--error ER_VIEW_NO_EXPLAIN
show fields from v4;
show fields from v2;
show fields from testdb_1.v1;
show create view v2;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
show create view testdb_1.v1;
-select table_name from information_schema.columns a
+select table_name from information_schema.columns a
where a.table_name = 'v2';
-select view_definition from information_schema.views a
+select view_definition from information_schema.views a
where a.table_name = 'v2';
-select view_definition from information_schema.views a
+select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
---error 1356
+--error ER_VIEW_INVALID
select * from v2;
connection default;
use test;
drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
+connection testdb_1;
+disconnect testdb_1;
+--source include/wait_until_disconnected.inc
+connection testdb_2;
+disconnect testdb_2;
+--source include/wait_until_disconnected.inc
+connection default;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
@@ -239,4 +246,7 @@ show create view testdb_1.v1;
connection default;
drop user mysqltest_1@localhost;
drop database testdb_1;
+connection user1;
disconnect user1;
+--source include/wait_until_disconnected.inc
+connection default;
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 512f7fc7fe2..05be75fc368 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -1054,4 +1054,13 @@ ROLLBACK;
--error 1305
ROLLBACK TO SAVEPOINT s4;
+#
+# Bug#39793 Foreign keys not constructed when column has a '#' in a comment or default value
+#
+
+#This statement should be written on a single line for proper testing
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY COMMENT 'My ID#', f2 INTEGER DEFAULT NULL, f3 CHAR(10) DEFAULT 'My ID#', CONSTRAINT f2_ref FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=INNODB;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 12431e26596..0425b4b9022 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -341,4 +341,11 @@ EOF
remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
+#
+# Bug #39101: client -i (--ignore-spaces) option does not seem to work
+#
+--exec $MYSQL -i -e "SELECT COUNT (*)"
+--exec $MYSQL --ignore-spaces -e "SELECT COUNT (*)"
+--exec $MYSQL -b -i -e "SELECT COUNT (*)"
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 1ca07a40df1..dd45f499866 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -294,4 +294,14 @@ echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
eval SET @@global.server_id= $save_server_id;
--remove_file $binlog_file
+#
+# Bug #41943: mysqlbinlog.exe crashes if --hexdump option is used
+#
+
+RESET MASTER;
+FLUSH LOGS;
+
+# We do not need the results, just make sure that mysqlbinlog does not crash
+--exec $MYSQL_BINLOG --hexdump --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 >/dev/null
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 1e9090fdd01..1aceb113b65 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1,6 +1,5 @@
# Embedded server doesn't support external clients
--source include/not_embedded.inc
---source include/have_log_bin.inc
# Binlog is required
--source include/have_log_bin.inc
diff --git a/mysql-test/t/mysqldump_restore.test b/mysql-test/t/mysqldump_restore.test
new file mode 100644
index 00000000000..835ee3ee9e9
--- /dev/null
+++ b/mysql-test/t/mysqldump_restore.test
@@ -0,0 +1,111 @@
+###############################################################################
+# mysqldump_restore.test
+#
+# Purpose: Tests if mysqldump output can be used to successfully restore
+# tables and data.
+# We CREATE a table, mysqldump it to a file, ALTER the original
+# table's name, recreate the table from the mysqldump file, then
+# utilize include/diff_tables to compare the original and recreated
+# tables.
+#
+# We use several examples from mysqldump.test here and include
+# the relevant bug numbers and headers from that test.
+#
+# NOTE: This test is not currently complete and offers only basic
+# cases of mysqldump output being restored.
+# Also, does NOT work with -X (xml) output!
+#
+# Author: pcrews
+# Created: 2009-05-21
+# Last Change:
+# Change date:
+###############################################################################
+
+# Embedded server doesn't support external clients
+--source include/not_embedded.inc
+--source include/have_log_bin.inc
+
+--echo # Set concurrent_insert = 0 to prevent random errors
+--echo # will reset to original value at the end of the test
+SET @old_concurrent_insert = @@global.concurrent_insert;
+SET @@global.concurrent_insert = 0;
+
+# Define mysqldumpfile here. It is used to capture mysqldump output
+# in order to test the output's ability to restore an exact copy of the table
+let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/mysqldumpfile.sql;
+
+--echo # Pre-test cleanup
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo # Begin tests
+--echo #
+--echo # Bug#2005 Long decimal comparison bug.
+--echo #
+CREATE TABLE t1 (a DECIMAL(64, 20));
+INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
+("0987654321098765432109876543210987654321");
+--exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
+let $table_name = test.t1;
+--source include/mysqldump.inc
+
+--echo #
+--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
+--echo #
+CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
+# Check at first how mysql work with quoted decimal
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
+INSERT INTO t1 VALUES (1.2345, 2.3456);
+INSERT INTO t1 VALUES ('1.2345', 2.3456);
+--error ER_BAD_FIELD_ERROR
+INSERT INTO t1 VALUES ("1.2345", 2.3456);
+SET SQL_MODE=@OLD_SQL_MODE;
+
+# check how mysqldump make quoting
+--exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
+let $table_name = test.t1;
+--source include/mysqldump.inc
+
+--echo #
+--echo # Bug#1994 mysqldump does not correctly dump UCS2 data
+--echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
+--echo #
+CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
+INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
+--exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 > $mysqldumpfile
+let $table_name = test.t1;
+--source include/mysqldump.inc
+
+--echo #
+--echo # WL#2319 Exclude Tables from dump
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (4),(5),(6);
+--exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test > $mysqldumpfile
+let $table_name = test.t2;
+--source include/mysqldump.inc
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
+--echo #
+CREATE TABLE t1 (`b` blob);
+INSERT INTO `t1` VALUES (0x602010000280100005E71A);
+--exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 > $mysqldumpfile
+let $table_name = test.t1;
+--source include/mysqldump.inc
+
+--echo # End tests
+
+--echo # Cleanup
+--echo # Reset concurrent_insert to its original value
+SET @@global.concurrent_insert = @old_concurrent_insert;
+--echo # remove mysqldumpfile
+--error 0,1
+--remove_file $mysqldumpfile
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
index 516f3a026c9..4cd538877eb 100644
--- a/mysql-test/t/rpl_temporary.test
+++ b/mysql-test/t/rpl_temporary.test
@@ -217,4 +217,74 @@ drop table t1;
# Delete the anonymous users
source include/delete_anonymous_users.inc;
+# ##################################################################
+# BUG#41725: slave crashes when inserting into temporary table after
+# stop/start slave
+#
+# This test checks that both reported issues (assertion failure and
+# crash) go away. It is implemented as follows:
+#
+# case 1: assertion failure
+# i) create and insert into temporary table on master
+# ii) sync slave with master
+# iii) stop and restart slave
+# iv) insert into master another value
+# v) sync slave with master
+#
+#
+# case 2: crash (SIGSEV)
+# i) create and insert into temporary table on master (insert
+# produces warnings)
+# ii) sync slave with master
+# iii) stop and restart slave
+# iv) insert into master more values
+# v) sync slave with master
+
+# case 1: Assertion in Field_string::store() failed because current
+# thread reference differed from table->in_use after slave
+# restart
+
+connection master;
+
+disable_warnings;
+DROP TABLE IF EXISTS t1;
+enable_warnings;
+
+CREATE TEMPORARY TABLE t1 (a char(1));
+INSERT INTO t1 VALUES ('a');
+sync_slave_with_master;
+
+source include/stop_slave.inc;
+source include/start_slave.inc;
+
+connection master;
+INSERT INTO t1 VALUES ('b');
+sync_slave_with_master;
+
+# case 2: crash on sp_rcontext::find_handler because it used
+# reference to invalid THD object after slave restart
+
+connection master;
+
+disable_warnings;
+DROP TABLE IF EXISTS t1;
+enable_warnings;
+CREATE TEMPORARY TABLE `t1`(`a` tinyint,`b` char(1))engine=myisam;
+INSERT INTO `t1` set `a`=128,`b`='128';
+
+sync_slave_with_master;
+
+source include/stop_slave.inc;
+source include/start_slave.inc;
+
+connection master;
+INSERT INTO `t1` set `a`=128,`b`='128';
+sync_slave_with_master;
+
+# cleanup
+
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+
# End of 5.0 tests
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index 2d88d1660b0..6f08ebef86d 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -669,4 +669,23 @@ SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1);
SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1);
SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
+#
+# Bug #37362 Crash in do_field_eq
+#
+CREATE TABLE t1 (a INT, b INT, c INT);
+INSERT INTO t1 VALUES (1,1,1), (1,1,1);
+
+--error 1054
+EXPLAIN EXTENDED
+ SELECT c FROM
+ ( SELECT
+ (SELECT COUNT(a) FROM
+ (SELECT COUNT(b) FROM t1) AS x GROUP BY c
+ ) FROM t1 GROUP BY b
+ ) AS y;
+SHOW WARNINGS;
+
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index 5fc763be7fe..5bb521601e5 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -77,3 +77,16 @@ insert into t1 values('2007-07-02', 1);
insert into t1 values('2007-07-02', 2);
SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
drop table t1;
+
+
+--echo #
+--echo # Bug #44792: valgrind warning when casting from time to time
+--echo #
+
+CREATE TABLE t1 (c TIME);
+INSERT INTO t1 VALUES ('0:00:00');
+SELECT CAST(c AS TIME) FROM t1;
+DROP TABLE t1;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 1dbbdae24b7..0c8e025e54e 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1038,4 +1038,16 @@ CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1;
SHOW FIELDS FROM t2;
DROP TABLE t1, t2;
+#
+# Bug#43612 crash with explain extended, union, order by
+#
+CREATE TABLE t1(a INT);
+EXPLAIN EXTENDED
+SELECT a FROM t1
+UNION
+SELECT a FROM t1
+ORDER BY a;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index 3a3e8f88f83..d39b49a0e87 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -237,3 +237,15 @@ select @a:=f2, count(f2) from t1 group by 1 desc;
select @a:=f3, count(f3) from t1 group by 1 desc;
select @a:=f4, count(f4) from t1 group by 1 desc;
drop table t1;
+
+#
+# Bug#42009: SELECT into variable gives different results to direct SELECT
+#
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (0, 0), (2, 1), (2, 3), (1, 1), (30, 20);
+SELECT a, b INTO @a, @b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b;
+SELECT @a, @b;
+SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 6437e546697..89e68e4bd99 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3681,5 +3681,28 @@ DROP VIEW v1;
DROP TABLE t1;
--echo # -----------------------------------------------------------------
+--echo # -- Bug#40825: Error 1356 while selecting from a view
+--echo # -- with a "HAVING" clause though query works
+--echo # -----------------------------------------------------------------
+--echo
+
+CREATE TABLE t1 (c INT);
+
+--echo
+
+CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias;
+SHOW CREATE VIEW v1;
+SELECT * FROM v1;
+
+--echo
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo
+--echo # -- End of test case for Bug#40825
+--echo
+
+--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysys/mf_getdate.c b/mysys/mf_getdate.c
index 1ced312848e..247172014d8 100644
--- a/mysys/mf_getdate.c
+++ b/mysys/mf_getdate.c
@@ -45,15 +45,15 @@ void get_date(register my_string to, int flag, time_t date)
skr=date ? (time_t) date : time((time_t*) 0);
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
if (flag & GETDATE_GMT)
- localtime_r(&skr,&tm_tmp);
- else
gmtime_r(&skr,&tm_tmp);
+ else
+ localtime_r(&skr,&tm_tmp);
start_time= &tm_tmp;
#else
if (flag & GETDATE_GMT)
- start_time= localtime(&skr);
- else
start_time= gmtime(&skr);
+ else
+ start_time= localtime(&skr);
#endif
if (flag & GETDATE_SHORT_DATE)
sprintf(to,"%02d%02d%02d",
diff --git a/sql/field.cc b/sql/field.cc
index 99e9d7803e1..c7dd2afd934 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4877,7 +4877,7 @@ bool Field_time::get_time(MYSQL_TIME *ltime)
ltime->neg= 1;
tmp=-tmp;
}
- ltime->day= 0;
+ ltime->year= ltime->month= ltime->day= 0;
ltime->hour= (int) (tmp/10000);
tmp-=ltime->hour*10000;
ltime->minute= (int) tmp/100;
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 5ed791d0f68..95b7b338131 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -1684,7 +1684,7 @@ int ha_myisam::info(uint flag)
if (share->key_parts)
memcpy((char*) table->key_info[0].rec_per_key,
(char*) misam_info.rec_per_key,
- sizeof(table->key_info[0].rec_per_key)*share->key_parts);
+ sizeof(table->key_info[0].rec_per_key[0])*share->key_parts);
raid_type= misam_info.raid_type;
raid_chunks= misam_info.raid_chunks;
raid_chunksize= misam_info.raid_chunksize;
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index f15a37efdc5..fef2e21d271 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -402,11 +402,11 @@ int ha_myisammrg::info(uint flag)
with such a number, it'll be an error later anyway.
*/
bzero((char*) table->key_info[0].rec_per_key,
- sizeof(table->key_info[0].rec_per_key) * table->s->key_parts);
+ sizeof(table->key_info[0].rec_per_key[0]) * table->s->key_parts);
#endif
memcpy((char*) table->key_info[0].rec_per_key,
(char*) mrg_info.rec_per_key,
- sizeof(table->key_info[0].rec_per_key) *
+ sizeof(table->key_info[0].rec_per_key[0]) *
min(file->keys, table->s->key_parts));
}
}
diff --git a/sql/item.cc b/sql/item.cc
index 13f09914ec6..7c4e86d756f 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5648,7 +5648,8 @@ void Item_ref::print(String *str)
!table_name && name && alias_name_used)
{
THD *thd= current_thd;
- append_identifier(thd, str, name, (uint) strlen(name));
+ append_identifier(thd, str, (*ref)->real_item()->name,
+ (*ref)->real_item()->name_length);
}
else
(*ref)->print(str);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 3cbb278ea48..46e0f30d94e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4151,6 +4151,41 @@ Item_func_set_user_var::check(bool use_result_field)
}
+/**
+ @brief Evaluate and store item's result.
+ This function is invoked on "SELECT ... INTO @var ...".
+
+ @param item An item to get value from.
+*/
+
+void Item_func_set_user_var::save_item_result(Item *item)
+{
+ DBUG_ENTER("Item_func_set_user_var::save_item_result");
+
+ switch (cached_result_type) {
+ case REAL_RESULT:
+ save_result.vreal= item->val_result();
+ break;
+ case INT_RESULT:
+ save_result.vint= item->val_int_result();
+ unsigned_flag= item->unsigned_flag;
+ break;
+ case STRING_RESULT:
+ save_result.vstr= item->str_result(&value);
+ break;
+ case DECIMAL_RESULT:
+ save_result.vdec= item->val_decimal_result(&decimal_buff);
+ break;
+ case ROW_RESULT:
+ default:
+ // Should never happen
+ DBUG_ASSERT(0);
+ break;
+ }
+ DBUG_VOID_RETURN;
+}
+
+
/*
This functions is invoked on SET @variable or @variable:= expression.
diff --git a/sql/item_func.h b/sql/item_func.h
index 7e15a536cf2..33aeddfe6e6 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1308,6 +1308,7 @@ public:
bool send(Protocol *protocol, String *str_arg);
void make_field(Send_field *tmp_field);
bool check(bool use_result_field);
+ void save_item_result(Item *item);
bool update();
enum Item_result result_type () const { return cached_result_type; }
bool fix_fields(THD *thd, Item **ref);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 4640929b2bf..4941f427731 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2832,7 +2832,7 @@ String *Item_load_file::val_str(String *str)
)
goto err;
- (void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "",
+ (void) fn_format(path, file_name->c_ptr_safe(), mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
/* Read only allowed from within dir specified by secure_file_priv */
@@ -2858,7 +2858,7 @@ String *Item_load_file::val_str(String *str)
}
if (tmp_value.alloc(stat_info.st_size))
goto err;
- if ((file = my_open(file_name->c_ptr(), O_RDONLY, MYF(0))) < 0)
+ if ((file = my_open(file_name->ptr(), O_RDONLY, MYF(0))) < 0)
goto err;
if (my_read(file, (byte*) tmp_value.ptr(), stat_info.st_size, MYF(MY_NABP)))
{
@@ -3108,7 +3108,21 @@ longlong Item_func_uncompressed_length::val_int()
if (res->is_empty()) return 0;
/*
- res->ptr() using is safe because we have tested that string is not empty,
+ If length is <= 4 bytes, data is corrupt. This is the best we can do
+ to detect garbage input without decompressing it.
+ */
+ if (res->length() <= 4)
+ {
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_ZLIB_Z_DATA_ERROR,
+ ER(ER_ZLIB_Z_DATA_ERROR));
+ null_value= 1;
+ return 0;
+ }
+
+ /*
+ res->ptr() using is safe because we have tested that string is at least
+ 5 bytes long.
res->c_ptr() is not used because:
- we do not need \0 terminated string to get first 4 bytes
- c_ptr() tests simbol after string end (uninitialiozed memory) which
diff --git a/sql/slave.cc b/sql/slave.cc
index f29936c5942..88c19a04602 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -545,6 +545,14 @@ void st_relay_log_info::close_temporary_tables()
slave_open_temp_tables= 0;
}
+static void set_thd_in_use_temporary_tables(RELAY_LOG_INFO *rli)
+{
+ TABLE *table;
+
+ for (table= rli->save_temporary_tables ; table ; table= table->next)
+ table->in_use= rli->sql_thd;
+}
+
/*
purge_relay_logs()
@@ -3964,6 +3972,7 @@ slave_begin:
}
thd->init_for_queries();
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
+ set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
pthread_mutex_lock(&LOCK_thread_count);
threads.append(thd);
pthread_mutex_unlock(&LOCK_thread_count);
@@ -4136,6 +4145,7 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
DBUG_ASSERT(rli->sql_thd == thd);
THD_CHECK_SENTRY(thd);
rli->sql_thd= 0;
+ set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
pthread_mutex_lock(&LOCK_thread_count);
THD_CHECK_SENTRY(thd);
delete thd;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index f2e04647452..387e7022d71 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2069,7 +2069,7 @@ bool select_dumpvar::send_data(List<Item> &items)
{
Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
suv->fix_fields(thd, 0);
- suv->check(0);
+ suv->save_item_result(item);
suv->update();
}
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 7a48044877b..79fc4872f05 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -503,6 +503,11 @@ int mysql_multi_delete_prepare(THD *thd)
}
}
}
+ /*
+ Reset the exclude flag to false so it doesn't interfare
+ with further calls to unique_table
+ */
+ lex->select_lex.exclude_from_table_unique_test= FALSE;
DBUG_RETURN(FALSE);
}
@@ -538,11 +543,24 @@ multi_delete::initialize_tables(JOIN *join)
DBUG_RETURN(1);
table_map tables_to_delete_from=0;
+ delete_while_scanning= 1;
for (walk= delete_tables; walk; walk= walk->next_local)
+ {
tables_to_delete_from|= walk->table->map;
+ if (delete_while_scanning &&
+ unique_table(thd, walk, join->tables_list, false))
+ {
+ /*
+ If the table we are going to delete from appears
+ in join, we need to defer delete. So the delete
+ doesn't interfers with the scaning of results.
+ */
+ delete_while_scanning= 0;
+ }
+ }
+
walk= delete_tables;
- delete_while_scanning= 1;
for (JOIN_TAB *tab=join->join_tab, *end=join->join_tab+join->tables;
tab < end;
tab++)
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index 551a103da10..f87f92471a3 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -552,8 +552,9 @@ int PROFILING::fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond)
The order of these fields is set by the query_profile_statistics_info
array.
*/
- table->field[0]->store((ulonglong) query->profiling_query_id);
- table->field[1]->store((ulonglong) seq); /* the step in the sequence */
+ table->field[0]->store((ulonglong) query->profiling_query_id, TRUE);
+ /* the step in the sequence */
+ table->field[1]->store((ulonglong) seq, TRUE);
/*
This entry, n, has a point in time, T(n), and a status phrase, S(n).
The status phrase S(n) describes the period of time that begins at
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ced01c2db47..587c0b85ce6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2172,6 +2172,14 @@ JOIN::destroy()
cond_equal= 0;
cleanup(1);
+ /* Cleanup items referencing temporary table columns */
+ if (!tmp_all_fields3.is_empty())
+ {
+ List_iterator_fast<Item> it(tmp_all_fields3);
+ Item *item;
+ while ((item= it++))
+ item->cleanup();
+ }
if (exec_tmp_table1)
free_tmp_table(thd, exec_tmp_table1);
if (exec_tmp_table2)
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 2875aefbd97..fca5c205610 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -653,10 +653,22 @@ bool st_select_lex_unit::cleanup()
join->tables= 0;
}
error|= fake_select_lex->cleanup();
- if (fake_select_lex->order_list.elements)
+ /*
+ There are two cases when we should clean order items:
+ 1. UNION with SELECTs which all enclosed into braces
+ in this case global_parameters == fake_select_lex
+ 2. UNION where last SELECT is not enclosed into braces
+ in this case global_parameters == 'last select'
+ So we should use global_parameters->order_list for
+ proper order list clean up.
+ Note: global_parameters and fake_select_lex are always
+ initialized for UNION
+ */
+ DBUG_ASSERT(global_parameters);
+ if (global_parameters->order_list.elements)
{
ORDER *ord;
- for (ord= (ORDER*)fake_select_lex->order_list.first; ord; ord= ord->next)
+ for (ord= (ORDER*)global_parameters->order_list.first; ord; ord= ord->next)
(*ord->item)->cleanup();
}
}
diff --git a/sql/table.cc b/sql/table.cc
index c559b4bb7fd..55a9b50605d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -233,7 +233,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
ulong *rec_per_key;
if (!(rec_per_key= (ulong*) alloc_root(&outparam->mem_root,
- sizeof(ulong*)*key_parts)))
+ sizeof(ulong)*key_parts)))
goto err;
for (i=0 ; i < keys ; i++, keyinfo++)
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 9e026a27b6d..9dfacb7436d 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -3971,6 +3971,10 @@ static void test_fetch_date()
myheader("test_fetch_date");
+ /* Will not work if sql_mode is NO_ZERO_DATE (implicit if TRADITIONAL) /*/
+ rc= mysql_query(mysql, "SET SQL_MODE=''");
+ myquery(rc);
+
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result");
myquery(rc);
@@ -4685,6 +4689,9 @@ static void test_stmt_close()
/* set AUTOCOMMIT to ON*/
mysql_autocommit(lmysql, TRUE);
+ rc= mysql_query(lmysql, "SET SQL_MODE = ''");
+ myquery(rc);
+
rc= mysql_query(lmysql, "DROP TABLE IF EXISTS test_stmt_close");
myquery(rc);
@@ -11855,6 +11862,9 @@ static void test_bug6058()
myheader("test_bug6058");
+ rc= mysql_query(mysql, "SET SQL_MODE=''");
+ myquery(rc);
+
stmt_text= "SELECT CAST('0000-00-00' AS DATE)";
rc= mysql_real_query(mysql, stmt_text, (uint) strlen(stmt_text));
@@ -13026,6 +13036,9 @@ static void test_bug8378()
if (!opt_silent)
fprintf(stdout, " OK");
+ rc= mysql_query(lmysql, "SET SQL_MODE=''");
+ myquery(rc);
+
len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4);
/* No escaping should have actually happened. */
@@ -16056,6 +16069,11 @@ static void test_bug31669()
rc= mysql_query(mysql, query);
myquery(rc);
+ strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'localhost' IDENTIFIED BY "
+ "'", buff, "' WITH GRANT OPTION", NullS);
+ rc= mysql_query(mysql, query);
+ myquery(rc);
+
rc= mysql_query(mysql, "FLUSH PRIVILEGES");
myquery(rc);
@@ -16093,7 +16111,7 @@ static void test_bug31669()
strxmov(query, "DELETE FROM mysql.user WHERE User='", user, "'", NullS);
rc= mysql_query(mysql, query);
myquery(rc);
- DIE_UNLESS(mysql_affected_rows(mysql) == 1);
+ DIE_UNLESS(mysql_affected_rows(mysql) == 2);
#endif
DBUG_VOID_RETURN;