summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-04-05 10:49:38 +0200
committerSergei Golubchik <sergii@pisem.net>2012-04-05 10:49:38 +0200
commitdea3544b2d9bd68961b8e84c3772deda435f15b5 (patch)
treed65a66f9f2f9378a1f4ca014e18952ae514f4cb1 /mysql-test/t
parentc72d5e80c53c53a9a847b1c3b6ac66a7ad7eb815 (diff)
parentceec7cea338e117d15a9679e517cc2bb24d44fcc (diff)
downloadmariadb-git-dea3544b2d9bd68961b8e84c3772deda435f15b5.tar.gz
mysql-5.1.62 merge
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/ctype_utf8.test8
-rw-r--r--mysql-test/t/func_time.test61
-rw-r--r--mysql-test/t/init_connect.test8
-rw-r--r--mysql-test/t/join_outer.test58
-rw-r--r--mysql-test/t/myisam.test14
-rw-r--r--mysql-test/t/mysqldump.test112
-rw-r--r--mysql-test/t/partition.test45
-rw-r--r--mysql-test/t/range.test76
-rw-r--r--mysql-test/t/sp-bugs.test24
-rw-r--r--mysql-test/t/sp.test29
10 files changed, 435 insertions, 0 deletions
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 352ace03102..c503e9722f1 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1493,5 +1493,13 @@ SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
+--echo #
+--echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI
+--echo #
+CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci);
+INSERT INTO t1 VALUES ('a'),('r'),('s'),(_latin1 0xDF),(_latin1 0xF7),('t'),('z');
+SELECT * FROM t1 ORDER BY a;
+SELECT a, COUNT(*) FROM t1 GROUP BY a;
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 2d4f50c8271..4862324817e 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -934,4 +934,65 @@ SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
+--echo #
+--echo # BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
+--echo # SIMILAR TO '2009-10-00'
+--echo #
+
+query_vertical SELECT
+ DATE('20091000'),
+ STR_TO_DATE('200910','%Y%m'),
+ LAST_DAY('2009-10-00'),
+ LAST_DAY(DATE('2009-10-00')),
+ LAST_DAY(DATE'2009-10-00'),
+ LAST_DAY(STR_TO_DATE('200910','%Y%m')),
+ WEEK('2009-10-00'),
+ WEEK(DATE('2009-10-00')),
+ WEEK(DATE'2009-10-00'),
+ WEEK(STR_TO_DATE('200910','%Y%m')),
+ WEEKOFYEAR('2009-10-00'),
+ WEEKOFYEAR(DATE('2009-10-00')),
+ WEEKOFYEAR(DATE'2009-10-00'),
+ WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')),
+ DAYOFYEAR('2009-10-00'),
+ DAYOFYEAR(DATE('2009-10-00')),
+ DAYOFYEAR(DATE'2009-10-00'),
+ DAYOFYEAR(STR_TO_DATE('200910','%Y%m')),
+ WEEKDAY('2009-10-00'),
+ WEEKDAY(DATE('2009-10-00')),
+ WEEKDAY(DATE'2009-10-00'),
+ WEEKDAY(STR_TO_DATE('200910','%Y%m')),
+ TO_DAYs('2009-10-00'),
+ TO_DAYs(DATE('2009-10-00')),
+ TO_DAYs(DATE'2009-10-00'),
+ TO_DAYs(STR_TO_DATE('200910','%Y%m'));
+
+query_vertical SELECT
+ DATE('00000100'),
+ STR_TO_DATE('000001','%Y%m'),
+ LAST_DAY('0000-01-00'),
+ LAST_DAY(DATE('0000-01-00')),
+ LAST_DAY(DATE'0000-01-00'),
+ LAST_DAY(STR_TO_DATE('000001','%Y%m')),
+ WEEK('0000-01-00'),
+ WEEK(DATE('0000-01-00')),
+ WEEK(DATE'0000-01-00'),
+ WEEK(STR_TO_DATE('000001','%Y%m')),
+ WEEKOFYEAR('0000-01-00'),
+ WEEKOFYEAR(DATE('0000-01-00')),
+ WEEKOFYEAR(DATE'0000-01-00'),
+ WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')),
+ DAYOFYEAR('0000-01-00'),
+ DAYOFYEAR(DATE('0000-01-00')),
+ DAYOFYEAR(DATE'0000-01-00'),
+ DAYOFYEAR(STR_TO_DATE('000001','%Y%m')),
+ WEEKDAY('0000-01-00'),
+ WEEKDAY(DATE('0000-01-00')),
+ WEEKDAY(DATE'0000-01-00'),
+ WEEKDAY(STR_TO_DATE('000001','%Y%m')),
+ TO_DAYs('0000-01-00'),
+ TO_DAYs(DATE('0000-01-00')),
+ TO_DAYs(DATE'0000-01-00'),
+ TO_DAYs(STR_TO_DATE('000001','%Y%m'));
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
index b6bac5f65fa..e96d02fe0d1 100644
--- a/mysql-test/t/init_connect.test
+++ b/mysql-test/t/init_connect.test
@@ -36,6 +36,14 @@ connection con0;
set GLOBAL init_connect="adsfsdfsdfs";
connect (con5,localhost,user_1,,);
connection con5;
+# BUG#11755281/47032: ERROR 2006 / ERROR 2013 INSTEAD OF PROPER ERROR MESSAGE
+# We now throw a proper error message here:
+--replace_regex /connection .* to/connection to/
+--error ER_NEW_ABORTING_CONNECTION
+select @a;
+# We got disconnected after receiving the above error message; any further
+# requests should fail with a notice that no one's listening to us.
+# --error CR_SERVER_GONE_ERROR,CR_SERVER_LOST
--error 2013,2006
select @a;
connection con0;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index c8fa2a35538..5e18f77c422 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1103,4 +1103,62 @@ GROUP BY t2.f1, t2.f2;
DROP TABLE t1,t2;
+
+--echo
+--echo # BUG#12567331 - INFINITE LOOP WHEN RESOLVING AN ALIASED COLUMN
+--echo # USED IN GROUP BY
+--echo
+CREATE TABLE t1 (
+ col_varchar_1024_latin1_key varchar(1024),
+ col_varchar_10_latin1 varchar(10),
+ col_int int(11),
+ pk int(11)
+);
+CREATE TABLE t2 (
+ col_int_key int(11),
+ col_int int(11),
+ pk int(11)
+);
+
+PREPARE prep_stmt_9846 FROM '
+SELECT alias1.pk AS field1 FROM
+t1 AS alias1
+LEFT JOIN
+(
+ t2 AS alias2
+ RIGHT JOIN
+ (
+ t2 AS alias3
+ JOIN t1 AS alias4
+ ON 1
+ )
+ ON 1
+)
+ON 1
+GROUP BY field1';
+execute prep_stmt_9846;
+execute prep_stmt_9846;
+drop table t1,t2;
+
+--echo #
+--echo # Bug #11765810 58813: SERVER THREAD HANGS WHEN JOIN + WHERE + GROUP BY
+--echo # IS EXECUTED TWICE FROM P
+--echo #
+CREATE TABLE t1 ( a INT ) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1);
+PREPARE prep_stmt FROM '
+ SELECT 1 AS f FROM t1
+ LEFT JOIN t1 t2
+ RIGHT JOIN t1 t3
+ JOIN t1 t4
+ ON 1
+ ON 1
+ ON 1
+ GROUP BY f';
+EXECUTE prep_stmt;
+EXECUTE prep_stmt;
+
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 0af9a7b7692..cd6f4aa892f 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1710,4 +1710,18 @@ CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
+--echo #
+--echo # BUG 11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
+--echo # CASES RESETS DATA POINTER TO SMAL
+--echo #
+CREATE TABLE t1(a INT, KEY(a));
+ALTER TABLE t1 DISABLE KEYS;
+let $MYSQLD_DATADIR= `select @@datadir`;
+SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+FLUSH TABLES;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--exec $MYISAMCHK -sn $MYSQLD_DATADIR/test/t1
+SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+SELECT @before=@after;
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 99537618011..bfbb18b7aed 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2204,6 +2204,118 @@ DROP DATABASE `test-database`;
USE `test`;
--echo #
+--echo # BUG#11760384 : 52792: mysqldump in XML mode does not dump routines.
+--echo #
+CREATE DATABASE BUG52792;
+USE BUG52792;
+CREATE TABLE t1 (c1 INT, c2 VARCHAR(20));
+CREATE TABLE t2 (c1 INT);
+INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
+INSERT INTO t2 VALUES (1),(2),(3);
+
+--echo # Stored Procedures.
+
+DELIMITER //;
+CREATE PROCEDURE simpleproc1 (OUT param1 INT)
+BEGIN
+ SELECT COUNT(*) INTO param1 FROM t1;
+END//
+DELIMITER ;//
+
+DELIMITER //;
+CREATE PROCEDURE simpleproc2 (OUT param1 INT)
+BEGIN
+ SELECT COUNT(*) INTO param1 FROM t2;
+END//
+DELIMITER ;//
+
+--echo # Events.
+
+CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
+CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
+
+--echo # Functions.
+
+CREATE FUNCTION `hello1` (s CHAR(20))
+ RETURNS CHAR(50) DETERMINISTIC
+RETURN CONCAT('Hello, ' ,s ,'!');
+
+CREATE FUNCTION `hello2` (s CHAR(20))
+ RETURNS CHAR(50) DETERMINISTIC
+RETURN CONCAT(']]>, ' , s ,'!');
+
+--echo # Triggers.
+
+DELIMITER |;
+CREATE TRIGGER trig1 BEFORE INSERT ON t2
+ FOR EACH ROW BEGIN
+ INSERT INTO t2 VALUES(1);
+END;
+|
+DELIMITER ;|
+
+DELIMITER |;
+CREATE TRIGGER trig2 AFTER INSERT ON t2
+ FOR EACH ROW BEGIN
+ INSERT INTO t2 VALUES(1, ']]>');
+ INSERT INTO t2 VALUES(2, '<![CDATA]]>');
+ INSERT INTO t2 VALUES(3, '<![CDATA[');
+ INSERT INTO t2 VALUES(4, '< > & \ " _');
+END;
+|
+DELIMITER ;|
+
+--echo # Views
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+CREATE VIEW v2 AS SELECT * FROM t2;
+--echo
+--echo # Dumping BUG52792 database in xml format.
+--echo
+--echo # Running 'replace_regex on timestamp'
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/--TIME--/
+--exec $MYSQL_DUMP --user=root --compact -R -E --triggers -X BUG52792
+--echo
+--echo # Dumping BUG52792 database in xml format with comments.
+--echo
+--echo # Running 'replace_regex on timestamp'
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/--TIME--/
+--exec $MYSQL_DUMP --comments --user=root -R -E --triggers -X BUG52792
+
+--echo
+--echo # Test to check 'Insufficient privileges' error.
+--echo
+
+GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
+
+connect (conn_1, localhost, user1, , BUG52792, $MASTER_MYPORT, $MASTER_MYSOCK);
+connection conn_1;
+
+--echo # Running 'replace_regex on timestamp'
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/--TIME--/
+--error 2
+--exec $MYSQL_DUMP --user=user1 -R -E --triggers -X BUG52792
+
+connection default;
+disconnect conn_1;
+
+DROP USER user1;
+DROP DATABASE BUG52792;
+--echo # UTF-8
+CREATE DATABASE BUG52792;
+USE BUG52792;
+SET NAMES utf8;
+CREATE FUNCTION `straße` ( c1 CHAR(20))
+ RETURNS CHAR(50) DETERMINISTIC
+RETURN CONCAT(']]>, ', s, '!');
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 -R -X BUG52792
+
+DROP DATABASE BUG52792;
+
+USE test;
+
+--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 61aab8233ff..831271c68bb 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2222,4 +2222,49 @@ INSERT INTO t1 VALUES(0);
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
+--echo #
+--echo # Bug#13580775 ASSERTION FAILED: RECORD_LENGTH == M_RECORD_LENGTH,
+--echo # FILE FILESORT_UTILS.CC
+--echo #
+
+CREATE TABLE t1 (
+ a INT PRIMARY KEY,
+ b INT,
+ c CHAR(1),
+ d INT,
+ KEY (c,d)
+) PARTITION BY KEY () PARTITIONS 1;
+
+INSERT INTO t1 VALUES (1,1,'a',1), (2,2,'a',1);
+
+SELECT 1 FROM t1 WHERE 1 IN
+(SELECT group_concat(b)
+ FROM t1
+ WHERE c > geomfromtext('point(1 1)')
+ GROUP BY b
+);
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#13011410 CRASH IN FILESORT CODE WITH GROUP BY/ROLLUP
+--echo #
+
+CREATE TABLE t1 (
+ a INT,
+ b MEDIUMINT,
+ c VARCHAR(300) CHARACTER SET hp8 COLLATE hp8_bin,
+ PRIMARY KEY (a,c(299)))
+ENGINE=myisam
+PARTITION BY LINEAR KEY () PARTITIONS 2;
+
+INSERT INTO t1 VALUES (1,2,'test'), (2,3,'hi'), (4,5,'bye');
+SELECT 1 FROM t1 WHERE b < SOME
+( SELECT 1 FROM t1 WHERE a >= 1
+ GROUP BY b WITH ROLLUP
+ HAVING b > geomfromtext("")
+);
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 6c9320b708a..30d15798336 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1392,4 +1392,80 @@ SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
DROP TABLE t1;
+--echo #
+--echo # BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+--echo # WITH/WITHOUT INDEX RANGE SCAN
+--echo #
+
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+ id int unsigned not null auto_increment,
+ val decimal(5,3) not null,
+ primary key (id,val),
+ unique key (val,id),
+ unique key (id));
+--disable_warnings
+insert into t2 select null,id*0.0009 from t1;
+--enable_warnings
+
+select count(val) from t2 ignore index (val) where val > 0.1155;
+select count(val) from t2 force index (val) where val > 0.1155;
+
+drop table t2, t1;
+
+--echo #
+--echo # BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+--echo # RESULTS WITH DECIMAL CONVERSION
+--echo #
+
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+# show that the integer 3 is bigger than the decimal 2.9,
+# which should also apply to comparing "c" with 2.9
+# when c is 3.
+select convert(3, signed integer) > 2.9;
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+select * from t1 force index (primary) where a=1 and c> 2.9;
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+drop table t1;
+
+--echo #
+--echo # BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+--echo # RESULT AFTER MYSQL 5.1.
+--echo #
+
+CREATE TABLE t1(
+ F1 CHAR(5) NOT NULL,
+ F2 CHAR(5) NOT NULL,
+ F3 CHAR(5) NOT NULL,
+ PRIMARY KEY(F1),
+ INDEX IDX_F2(F2)
+);
+
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+
+SELECT * FROM t1 WHERE F1 = 'A ';
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+SELECT * FROM t1 WHERE F1 >= 'A ';
+SELECT * FROM t1 WHERE F1 > 'A ';
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test
index fe52632c784..a23ccea8189 100644
--- a/mysql-test/t/sp-bugs.test
+++ b/mysql-test/t/sp-bugs.test
@@ -138,4 +138,28 @@ DROP FUNCTION db1.f1;
DROP TABLE db1.t1;
DROP DATABASE db1;
DROP DATABASE db2;
+
+--echo #
+--echo # Bug#13105873:valgrind warning:possible crash in foreign
+--echo # key handling on subsequent create table if not exists
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS testdb;
+--enable_warnings
+CREATE DATABASE testdb;
+USE testdb;
+CREATE TABLE t1 (id1 INT PRIMARY KEY);
+DELIMITER $;
+CREATE PROCEDURE `p1`()
+BEGIN
+ CREATE TABLE IF NOT EXISTS t2(id INT PRIMARY KEY,
+ CONSTRAINT FK FOREIGN KEY (id) REFERENCES t1( id1 ));
+END$
+DELIMITER ;$
+CALL p1();
+--echo # below stmt should not return valgrind warnings
+CALL p1();
+DROP DATABASE testdb;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 141d1604065..ae4e1dd588e 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8397,6 +8397,35 @@ DROP FUNCTION f1;
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
+--echo #
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+delimiter $;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
+ BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
+ RETURN f1();
+ END;
+ END;
+RETURN 1;
+END $
+delimiter ;$
+
+# This used to cause an assertion.
+SELECT f1();
+
+DROP FUNCTION f1;
+
+
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------