summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/group_by.result30
-rw-r--r--mysql-test/r/order_by.result16
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result35
-rw-r--r--mysql-test/r/status2.result64
-rw-r--r--mysql-test/r/view.result2
-rw-r--r--mysql-test/r/windows.result1
-rw-r--r--mysql-test/r/xa.result20
-rw-r--r--mysql-test/t/group_by.test29
-rw-r--r--mysql-test/t/order_by.test18
-rw-r--r--mysql-test/t/rpl_flush_log_loop.test21
-rw-r--r--mysql-test/t/status2.test64
-rw-r--r--mysql-test/t/view.test9
-rwxr-xr-x[-rw-r--r--]mysql-test/t/windows.test1
-rw-r--r--mysql-test/t/xa.test45
-rw-r--r--mysql-test/valgrind.supp8
15 files changed, 356 insertions, 7 deletions
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 28a9e15d473..ffb7ca667c7 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1359,4 +1359,34 @@ tt
41
SET sql_mode=@save_sql_mode;
DROP TABLE t1, t2;
+#
+# BUG#38072: Wrong result: HAVING not observed in a query with aggregate
+#
+CREATE TABLE t1 (
+pk int(11) NOT NULL AUTO_INCREMENT,
+int_nokey int(11) NOT NULL,
+int_key int(11) NOT NULL,
+varchar_key varchar(1) NOT NULL,
+varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY int_key (int_key),
+KEY varchar_key (varchar_key)
+);
+INSERT INTO t1 VALUES
+(1,5,5, 'h','h'),
+(2,1,1, '{','{'),
+(3,1,1, 'z','z'),
+(4,8,8, 'x','x'),
+(5,7,7, 'o','o'),
+(6,3,3, 'p','p'),
+(7,9,9, 'c','c'),
+(8,0,0, 'k','k'),
+(9,6,6, 't','t'),
+(10,0,0,'c','c');
+explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+X
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 9f6a1b3932c..f64bbc79cbd 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -1076,3 +1076,19 @@ set session max_sort_length= 2180;
select * from t1 order by b;
ERROR HY001: Out of sort memory; increase server sort buffer size
drop table t1;
+#
+# Bug #39844: Query Crash Mysql Server 5.0.67
+#
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
+CREATE TABLE t3 (c INT);
+INSERT INTO t1 (a) VALUES (1), (2);
+INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
+INSERT INTO t3 (c) VALUES (1), (2);
+SELECT
+(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
+FROM t3;
+(SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
+2
+NULL
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index 3b1db804da9..d9bb93810d0 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -20,5 +20,36 @@ master_password='',master_port=SLAVE_PORT;
start slave;
flush logs;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 208 # # slave-bin.000001 Yes Yes 0 0 208 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 98
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 98
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
diff --git a/mysql-test/r/status2.result b/mysql-test/r/status2.result
new file mode 100644
index 00000000000..7e895381a44
--- /dev/null
+++ b/mysql-test/r/status2.result
@@ -0,0 +1,64 @@
+#
+# Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
+#
+FLUSH STATUS;
+DROP TABLE IF EXISTS t1,t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+DECLARE foo INTEGER;
+DECLARE bar INTEGER;
+SET foo=1;
+SET bar=2;
+RETURN foo;
+END $$
+CREATE PROCEDURE p1()
+BEGIN
+SELECT 1;
+END $$
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+INSERT INTO t1 VALUES (1);
+Assert Questions == 9
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 9
+SELECT f1();
+f1()
+1
+Assert Questions == 11
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 11
+CALL p1();
+1
+1
+Assert Questions == 13
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 13
+SELECT 1;
+1
+1
+Assert Questions == 15
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 15
+FLUSH STATUS;
+SELECT 1;
+1
+1
+Assert Questions == 16
+SHOW STATUS LIKE 'Questions';
+Variable_name Value
+Questions 16
+Global status updated; Assert diff == 4
+FLUSH STATUS;
+SELECT 4;
+4
+4
+DROP TABLE t1,t2;
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+End of 6.0 tests
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index eb7a89c3d12..8cbe3fc36cf 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3677,6 +3677,8 @@ DROP VIEW v1;
# -- End of test case for Bug#35193.
+CREATE VIEW v1 AS SELECT 1;
+DROP VIEW v1;
# -----------------------------------------------------------------
# -- End of 5.0 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index b5f9a48d805..5a54db8bb84 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -18,4 +18,5 @@ EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+DROP TABLE t1;
End of 5.0 tests.
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index 5fb03d2378e..592cf07522b 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -55,3 +55,23 @@ select * from t1;
a
20
drop table t1;
+drop table if exists t1;
+create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
+insert into t1 values(1, 1, 'a');
+insert into t1 values(2, 2, 'b');
+xa start 'a','b';
+update t1 set c = 'aa' where a = 1;
+xa start 'a','c';
+update t1 set c = 'bb' where a = 2;
+update t1 set c = 'bb' where a = 2;
+update t1 set c = 'aa' where a = 1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select count(*) from t1;
+count(*)
+2
+xa end 'a','c';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+xa rollback 'a','c';
+xa start 'a','c';
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 82bb8a45faa..0e5af0133ca 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1010,4 +1010,33 @@ select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order b
SET sql_mode=@save_sql_mode;
DROP TABLE t1, t2;
+--echo #
+--echo # BUG#38072: Wrong result: HAVING not observed in a query with aggregate
+--echo #
+CREATE TABLE t1 (
+ pk int(11) NOT NULL AUTO_INCREMENT,
+ int_nokey int(11) NOT NULL,
+ int_key int(11) NOT NULL,
+ varchar_key varchar(1) NOT NULL,
+ varchar_nokey varchar(1) NOT NULL,
+ PRIMARY KEY (pk),
+ KEY int_key (int_key),
+ KEY varchar_key (varchar_key)
+);
+INSERT INTO t1 VALUES
+(1,5,5, 'h','h'),
+(2,1,1, '{','{'),
+(3,1,1, 'z','z'),
+(4,8,8, 'x','x'),
+(5,7,7, 'o','o'),
+(6,3,3, 'p','p'),
+(7,9,9, 'c','c'),
+(8,0,0, 'k','k'),
+(9,6,6, 't','t'),
+(10,0,0,'c','c');
+
+explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
+drop table t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 9a55c27df99..6d7ee1c1ca7 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -738,3 +738,21 @@ set session max_sort_length= 2180;
select * from t1 order by b;
drop table t1;
+
+--echo #
+--echo # Bug #39844: Query Crash Mysql Server 5.0.67
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
+CREATE TABLE t3 (c INT);
+
+INSERT INTO t1 (a) VALUES (1), (2);
+INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
+INSERT INTO t3 (c) VALUES (1), (2);
+
+SELECT
+ (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
+ FROM t3;
+
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test
index f0b368c285b..c3707372e08 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flush_log_loop.test
@@ -12,16 +12,27 @@ stop slave;
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
start slave;
+
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
start slave;
-sleep 5;
+--source include/wait_for_slave_to_start.inc
+
+# Calculate file name of relay log after flush logs
+let $relay_file= query_get_value(show slave status, Relay_Log_File,1);
+let $relay_name= `select substring_index('$relay_file','.',1);`;
+let $relay_index= `select substring_index('$relay_file','.',-1);`;
+let $relay_index_len= `select length(substring_index('$relay_file','.',-1));`;
+let $relay_index_next=`select $relay_index+1`;
+let $relay_file=`select concat('$relay_name','.',repeat('0',($relay_index_len-length($relay_index_next))),$relay_index_next);`;
flush logs;
-sleep 5;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+let $slave_param= Relay_Log_File;
+let $slave_param_value= $relay_file;
+source include/wait_for_slave_param.inc;
+--replace_result $SLAVE_MYPORT SLAVE_PORT $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
+--query_vertical show slave status
# End of 4.1 tests
diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test
new file mode 100644
index 00000000000..058a2fa1d25
--- /dev/null
+++ b/mysql-test/t/status2.test
@@ -0,0 +1,64 @@
+--echo #
+--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
+--echo #
+# The bogus connection below is needed to make the gobal statement count
+# deterministic when the test is run for the first time.
+connect (con1,localhost,root,,);
+connection con1;
+connection default;
+disconnect con1;
+FLUSH STATUS;
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+DELIMITER $$;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+ DECLARE foo INTEGER;
+ DECLARE bar INTEGER;
+ SET foo=1;
+ SET bar=2;
+ RETURN foo;
+END $$
+CREATE PROCEDURE p1()
+BEGIN
+ SELECT 1;
+END $$
+DELIMITER ;$$
+CREATE TABLE t1 (c1 INT);
+CREATE TABLE t2 (c1 INT);
+INSERT INTO t1 VALUES (1);
+--echo Assert Questions == 9
+SHOW STATUS LIKE 'Questions';
+SELECT f1();
+--echo Assert Questions == 11
+SHOW STATUS LIKE 'Questions';
+CALL p1();
+--echo Assert Questions == 13
+SHOW STATUS LIKE 'Questions';
+SELECT 1;
+--echo Assert Questions == 15
+SHOW STATUS LIKE 'Questions';
+connect (con1,localhost,root,,);
+connection con1;
+FLUSH STATUS;
+let $org_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
+SELECT 1;
+connection default;
+--echo Assert Questions == 16
+SHOW STATUS LIKE 'Questions';
+--echo Global status updated; Assert diff == 4
+FLUSH STATUS;
+let $new_questions= `SHOW GLOBAL STATUS LIKE 'questions'`;
+--disable_log
+let $diff= `SELECT SUBSTRING('$new_questions',10)-SUBSTRING('$org_questions',10)`;
+--enable_log
+eval SELECT $diff;
+disconnect con1;
+DROP TABLE t1,t2;
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+--echo End of 6.0 tests
+
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 9fa981ccb9a..bcf31a4501d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3560,6 +3560,15 @@ DROP VIEW v1;
###########################################################################
+#
+# Bug#39040: valgrind errors/crash when creating views with binlog logging
+# enabled
+#
+# Bug is visible only when running in valgrind with binary logging.
+CREATE VIEW v1 AS SELECT 1;
+DROP VIEW v1;
+
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.0 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index 6976ee98750..6e6a7ec93a3 100644..100755
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test
@@ -33,5 +33,6 @@ drop table t1;
#
CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
+DROP TABLE t1;
--echo End of 5.0 tests.
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
index 0d564727fe3..591d7ac2c4d 100644
--- a/mysql-test/t/xa.test
+++ b/mysql-test/t/xa.test
@@ -74,3 +74,48 @@ xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select * from t1;
drop table t1;
+disconnect con1;
+
+#
+# Bug#28323: Server crashed in xid cache operations
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
+insert into t1 values(1, 1, 'a');
+insert into t1 values(2, 2, 'b');
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--connection con1
+xa start 'a','b';
+update t1 set c = 'aa' where a = 1;
+--connection con2
+xa start 'a','c';
+update t1 set c = 'bb' where a = 2;
+--connection con1
+--send update t1 set c = 'bb' where a = 2
+--connection con2
+--sleep 1
+--error ER_LOCK_DEADLOCK
+update t1 set c = 'aa' where a = 1;
+select count(*) from t1;
+--error ER_XA_RBDEADLOCK
+xa end 'a','c';
+xa rollback 'a','c';
+--disconnect con2
+
+connect (con3,localhost,root,,);
+--connection con3
+xa start 'a','c';
+
+--disconnect con1
+--disconnect con3
+--connection default
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index e71f4541cfd..d7ac6bc6c88 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -319,6 +319,14 @@
fun:_dl_map_object
}
+{
+ libc pthread_exit 8
+ Memcheck:Leak
+ fun:malloc
+ fun:local_strdup
+ fun:_dl_map_object
+ fun:dl_open_worker
+}
#