summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/create.test6
-rw-r--r--mysql-test/t/ctype_utf8.test14
-rw-r--r--mysql-test/t/ctype_utf8mb4.test12
-rw-r--r--mysql-test/t/default.test43
-rw-r--r--mysql-test/t/derived.test47
-rw-r--r--mysql-test/t/derived_view.test54
-rw-r--r--mysql-test/t/fulltext_charsets.test10
-rw-r--r--mysql-test/t/func_time.test25
-rw-r--r--mysql-test/t/group_by.test12
-rw-r--r--mysql-test/t/group_by_innodb.test10
-rw-r--r--mysql-test/t/loaddata.test1
-rw-r--r--mysql-test/t/parser.test10
-rw-r--r--mysql-test/t/selectivity.test21
-rw-r--r--mysql-test/t/sp.test51
-rw-r--r--mysql-test/t/subselect.test13
-rw-r--r--mysql-test/t/type_decimal.test5
16 files changed, 329 insertions, 5 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 10ee41ca2aa..0d260085129 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1763,3 +1763,9 @@ drop function f1;
#
--error ER_TABLE_MUST_HAVE_COLUMNS
create table t1;
+
+#
+# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
+#
+create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
+drop table t1;
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index aa947a309d5..5f1de609df1 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1702,6 +1702,20 @@ SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
--echo #
+--echo # MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*)
+--echo #
+CREATE TABLE t1 (i INT, KEY(i));
+INSERT INTO t1 VALUES (20081205),(20050327);
+SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
+SET sql_mode='STRICT_ALL_TABLES';
+SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
+# Avoid garbage in the output
+--replace_column 1 ###
+SELECT CHAR(i USING utf8) FROM t1;
+SET sql_mode=DEFAULT;
+DROP TABLE t1;
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
index 149a9a0498c..060c2aa1afb 100644
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@ -1869,6 +1869,14 @@ set @@collation_connection=utf8mb4_bin;
--echo #
--echo #
+--echo # MDEV-11343 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character
+--echo #
+CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
+LOAD DATA INFILE '../../std_data/loaddata/mdev-11343.txt' INTO TABLE t1 CHARACTER SET utf8mb4;
+SELECT HEX(a) FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion
--echo #
@@ -1910,10 +1918,6 @@ DROP TABLE t1;
--echo #
--echo #
---echo # End of tests
---echo #
-
---echo #
--echo # Start of 10.1 tests
--echo #
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 17f4383ae22..cf09ba048b8 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -169,6 +169,49 @@ drop table t1, t2;
--echo End of 5.0 tests.
--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-11265 Access defied when CREATE VIIEW v1 AS SELECT DEFAULT(column) FROM t1
+--echo #
+
+CREATE TABLE t1 (a INT DEFAULT 10);
+INSERT INTO t1 VALUES (11);
+CREATE VIEW v1 AS SELECT a AS a FROM t1;
+CREATE VIEW v2 AS SELECT DEFAULT(a) AS a FROM t1;
+CREATE VIEW v3 AS SELECT VALUES(a) AS a FROM t1;
+SELECT * FROM v1;
+SELECT * FROM v2;
+SELECT * FROM v3;
+--error ER_NONUPDATEABLE_COLUMN
+UPDATE v2 SET a=123;
+--error ER_NONUPDATEABLE_COLUMN
+UPDATE v3 SET a=123;
+DROP VIEW v3;
+DROP VIEW v2;
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-10780 Server crashes in in create_tmp_table
+--echo #
+
+# Note, the problem was not repeatable with a non-fresh connection.
+--connect (con1,localhost,root,,test)
+CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ();
+INSERT INTO t1 VALUES ();
+SELECT DISTINCT DEFAULT (pk) FROM t1 GROUP BY RAND() WITH ROLLUP;
+--disconnect con1
+--connection default
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #
+
+--echo #
--echo # Start of 10.1 tests
--echo #
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index c78613e4304..28781ad6fdb 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -831,6 +831,53 @@ DROP TABLES t1,t2;
set optimizer_switch=@save_derived_optimizer_switch;
--echo #
+--echo # MDEV-10663: Use of Inline table columns in HAVING clause
+--echo # throws 1463 Error
+--echo #
+
+set @save_sql_mode = @@sql_mode;
+set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
+
+CREATE TABLE `example1463` (
+ `Customer` varchar(255) NOT NULL,
+ `DeliveryStatus` varchar(255) NOT NULL,
+ `OrderSize` int(11) NOT NULL
+);
+INSERT INTO example1463 VALUES ('Charlie', 'Success', 100);
+INSERT INTO example1463 VALUES ('David', 'Success', 110);
+INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200);
+INSERT INTO example1463 VALUES ('David', 'Success', 100);
+INSERT INTO example1463 VALUES ('David', 'Unknown', 100);
+INSERT INTO example1463 VALUES ('Edward', 'Success', 150);
+INSERT INTO example1463 VALUES ('Edward', 'Pending', 150);
+
+SELECT Customer, Success, SUM(OrderSize)
+ FROM (SELECT Customer,
+ CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+ OrderSize
+ FROM example1463) as subQ
+ GROUP BY Success, Customer
+ WITH ROLLUP;
+SELECT Customer, Success, SUM(OrderSize)
+ FROM (SELECT Customer,
+ CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+ OrderSize
+ FROM example1463) as subQ
+ GROUP BY Success, Customer;
+SELECT Customer, Success, SUM(OrderSize)
+ FROM (SELECT Customer,
+ CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
+ OrderSize
+ FROM example1463) as subQ
+ GROUP BY Success, Customer
+ HAVING Success IS NOT NULL;
+
+DROP TABLE example1463;
+set sql_mode= @save_sql_mode;
+
+--echo # end of 5.5
+
+--echo #
--echo # Start of 10.1 tests
--echo #
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 3d9ab4e4477..ba58fada7f7 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1827,6 +1827,60 @@ DROP TABLE t1,t2;
--echo # end of 5.3 tests
--echo #
+--echo #
+--echo # Bug mdev-11161: The second execution of prepared statement
+--echo # does not use generated key for materialized
+--echo # derived table / view
+--echo # (actually this is a 5.3 bug.)
+--echo #
+
+create table t1 (
+ mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ matintnum CHAR(6) NOT NULL,
+ test MEDIUMINT UNSIGNED NULL
+);
+create table t2 (
+ mat_id MEDIUMINT UNSIGNED NOT NULL,
+ pla_id MEDIUMINT UNSIGNED NOT NULL
+);
+insert into t1 values
+ (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4),
+ (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8),
+ (NULL, 'i', 9);
+insert into t2 values
+ (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104),
+ (3, 101), (3, 102), (3, 105);
+
+explain
+ SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
+ FROM t1 m2
+ INNER JOIN
+ (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
+ FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
+ GROUP BY mp.pla_id) d
+ ON d.matintnum=m2.matintnum;
+
+prepare stmt1 from
+"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
+ FROM t1 m2
+ INNER JOIN
+ (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
+ FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
+ GROUP BY mp.pla_id) d
+ ON d.matintnum=m2.matintnum";
+
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+
+flush status;
+execute stmt1;
+show status like '%Handler_read%';
+
+deallocate prepare stmt1;
+
+drop table t1,t2;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/t/fulltext_charsets.test b/mysql-test/t/fulltext_charsets.test
new file mode 100644
index 00000000000..3ac9791bd1a
--- /dev/null
+++ b/mysql-test/t/fulltext_charsets.test
@@ -0,0 +1,10 @@
+#
+# MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches
+#
+set names utf8mb4;
+
+create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci;
+insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
+select a from t1 where match(b) against ('ciao' in boolean mode);
+drop table t1;
+
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 12b7c92688f..40a6c387448 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1709,6 +1709,31 @@ SELECT
TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
+
+--echo #
+--echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
+--echo #
+CREATE TABLE t1 (d DATE);
+INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
+SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
+SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
+SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
+SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
+SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
+DROP TABLE t1;
+
+# Maximum possible DAY_SECOND values in various formats
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
+
+# Out-of-range INTERVAL DAY_SECOND values
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
+SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
+
+
--echo #
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 4aa5c10ece8..334d9272e71 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1714,6 +1714,18 @@ SELECT MAX(i), c FROM t1
WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
drop table t1,t2;
+--echo #
+--echo # ONLY_FULL_GROUP_BY references
+--echo #
+
+set @save_sql_mode = @@sql_mode;
+set sql_mode='ONLY_FULL_GROUP_BY';
+create table t1 (a int, b int);
+select a+b as x from t1 group by x having x > 1;
+select a as x from t1 group by x having x > 1;
+select a from t1 group by a having a > 1;
+drop table t1;
+set sql_mode= @save_sql_mode;
#
# End of MariaDB 5.5 tests
#
diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test
index ed65e0c3e57..f7e035a1b54 100644
--- a/mysql-test/t/group_by_innodb.test
+++ b/mysql-test/t/group_by_innodb.test
@@ -125,6 +125,15 @@ ORDER BY id DESC;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-11162: Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint)
+--echo #
+
+CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+SELECT ( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i );
+SELECT i FROM t1 order by i LIMIT 1;
+DROP TABLE t1;
+
--echo # Port of testcase:
--echo #
--echo # Bug#20819199 ASSERTION FAILED IN TEST_IF_SKIP_SORT_ORDER
@@ -156,3 +165,4 @@ eval $query;
DROP TABLE t0, t1;
--echo # End of tests
+
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 7d0f3852b66..9f2aafc8efd 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -675,7 +675,6 @@ SELECT HEX(val) FROM t1;
CREATE DATABASE d2 CHARSET utf8;
USE d2;
CREATE TABLE t1 (val TEXT);
---error ER_INVALID_CHARACTER_STRING
LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1;
DROP TABLE d1.t1, d2.t1;
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index eec8a162748..e27db9c4e48 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -771,6 +771,16 @@ select 0<=!0, 0 <= !0;
select 1<<!0, 1 << !0;
select 0<!0, 0 < ! 0;
+--echo #
+--echo # MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*)
+--echo #
+CREATE TABLE t1 (id INT);
+--error ER_PARSE_ERROR
+CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;
+--error ER_PARSE_ERROR
+PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
+DROP TABLE t1;
+
#
# start of 10.1 tests
#
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
index 9ca3d99d39d..3e60f242083 100644
--- a/mysql-test/t/selectivity.test
+++ b/mysql-test/t/selectivity.test
@@ -1027,3 +1027,24 @@ drop table t1,t2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
+--echo #
+--echo # Bug mdev-11364: IS NULL over not nullable datetime column
+--echo # in mergeable derived
+--echo #
+
+set use_stat_tables='preferably';
+set optimizer_use_condition_selectivity=4;
+set HISTOGRAM_SIZE = 255;
+
+CREATE TABLE t1 (t TIME, d DATE NOT NULL);
+INSERT INTO t1 VALUES ('10:00:00', '0000-00-00'),('11:00:00','0000-00-00');
+
+ANALYZE TABLE t1;
+
+SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq;
+
+DROP TABLE t1;
+
+set histogram_size=@save_histogram_size;
+set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
+set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 9e6b919ea19..bcddbd6f97e 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9298,6 +9298,57 @@ CALL p1;
DROP PROCEDURE p1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-10713: signal 11 error on multi-table update - crash in
+--echo # handler::increment_statistics or in make_select or assertion
+--echo # failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS)))
+--echo #
+
+CREATE TABLE `t1` (
+ `CLOSE_YN` varchar(10) COLLATE utf8_bin DEFAULT NULL
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
+
+
+CREATE TABLE `t2` (
+ `ap_close_to` varchar(8) COLLATE utf8_bin DEFAULT NULL
+) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
+insert t1 values (1);
+
+
+--delimiter $$
+
+CREATE FUNCTION `f1`(`P_DC_CD` VARBINARY(50), `P_SYS_DATE` DATETIME) RETURNS datetime
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+BEGIN
+ DECLARE V_SYS_DATE DATETIME;
+ SELECT now() AS LOC_DATE INTO V_SYS_DATE ;
+ RETURN v_sys_date ;
+END $$
+
+--delimiter ;
+
+update t1 S
+JOIN
+(
+ SELECT CASE
+ WHEN DATE_FORMAT( f1('F01', NOW()) , '%Y%m%d') <= CLOSE_YMD
+ THEN '99991231'
+ ELSE '' END ACCOUNT_APPLY_YYYYMMDD
+ FROM (
+ select case
+ when 'AP'='AP'
+ then ap_close_to
+ end AS CLOSE_YMD
+ from t2
+ ) A
+) X
+SET S.CLOSE_YN = ''
+where 1=1;
+
+drop function if exists f1;
+drop table t1,t2;
+
--echo # End of 5.5 test
--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index dba2154ef73..38aafe39775 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -5979,6 +5979,19 @@ DROP TABLE t1;
SET SESSION big_tables=0;
--echo #
+--echo # MDEV-10776: Server crash on query
+--echo #
+create table t1 (field1 int);
+
+insert into t1 values (1);
+
+select round((select 1 from t1 limit 1))
+from t1
+group by round((select 1 from t1 limit 1));
+
+drop table t1;
+
+--echo #
--echo # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
--echo # m_lock_type != 2' failed in handler::ha_index_read_map
--echo #
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 659e75270ca..834fd0c5327 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -604,6 +604,11 @@ SHOW COLUMNS FROM t1dec102;
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
DROP TABLE t1dec102;
+#
+# MDEV-10552 equality operation on cast of the value "-0.0" to decimal not working
+#
+select cast('-0.0' as decimal(5,1)) < 0;
+
--echo #
--echo # End of 5.5 tests
--echo #