diff options
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/disabled.def | 2 | ||||
-rw-r--r-- | mysql-test/t/distinct.test | 17 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 12 | ||||
-rw-r--r-- | mysql-test/t/grant.test | 35 | ||||
-rw-r--r-- | mysql-test/t/information_schema.test | 12 | ||||
-rw-r--r-- | mysql-test/t/join_nested.test | 39 | ||||
-rw-r--r-- | mysql-test/t/key.test | 11 | ||||
-rw-r--r-- | mysql-test/t/log_state.test | 6 | ||||
-rw-r--r-- | mysql-test/t/mysql.test | 12 | ||||
-rw-r--r-- | mysql-test/t/mysqlbinlog.test | 19 | ||||
-rw-r--r-- | mysql-test/t/mysqlcheck.test | 10 | ||||
-rw-r--r-- | mysql-test/t/mysqltest.test | 20 | ||||
-rw-r--r-- | mysql-test/t/ndb_read_multi_range.test | 6 | ||||
-rw-r--r-- | mysql-test/t/ps_1general.test | 2 | ||||
-rw-r--r-- | mysql-test/t/rpl_ndb_dd_advance.test | 1 | ||||
-rw-r--r-- | mysql-test/t/select.test | 74 | ||||
-rw-r--r-- | mysql-test/t/subselect.test | 59 | ||||
-rw-r--r-- | mysql-test/t/subselect3.test | 17 | ||||
-rw-r--r-- | mysql-test/t/trigger-grant.test | 4 | ||||
-rw-r--r-- | mysql-test/t/trigger.test | 25 | ||||
-rw-r--r-- | mysql-test/t/wait_timeout.test | 6 |
21 files changed, 370 insertions, 19 deletions
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 8c2c4740f5e..f1e7271ce2e 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -39,4 +39,4 @@ synchronization : Bug#24529 Test 'synchronization' fails on Mac pushb flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin mysql_upgrade : Bug#25074 mysql_upgrade gives inconsisten results plugin : Bug#25659 memory leak via "plugins" test - +rpl_ndb_dd_advance : Bug#25913 rpl_ndb_dd_advance fails randomly diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 8734b940241..476e4ce7735 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -364,7 +364,8 @@ EXPLAIN SELECT a FROM t1 GROUP BY a; EXPLAIN SELECT a,b FROM t1 GROUP BY a,b; EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b; -CREATE TABLE t2(a INT, b INT, c INT, d INT, PRIMARY KEY (a,b)); +CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT, + PRIMARY KEY (a,b)); INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4); EXPLAIN SELECT DISTINCT a FROM t2; EXPLAIN SELECT DISTINCT a,a FROM t2; @@ -525,3 +526,17 @@ SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t2 WHERE a='oe' COLLATE latin1_german2_ci) dt; DROP TABLE t1, t2; + +# +# Bug #25551: inconsistent behaviour in grouping NULL, depending on index type +# +CREATE TABLE t1 (a INT, UNIQUE (a)); +INSERT INTO t1 VALUES (4),(null),(2),(1),(null),(3); +EXPLAIN SELECT DISTINCT a FROM t1; +#result must have one row with NULL +SELECT DISTINCT a FROM t1; +EXPLAIN SELECT a FROM t1 GROUP BY a; +#result must have one row with NULL +SELECT a FROM t1 GROUP BY a; + +DROP TABLE t1; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index ebaa6d84bd3..9e5a3012934 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -692,6 +692,18 @@ set time_zone= @@global.time_zone; # select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE; + +# +# Bug #25643: SEC_TO_TIME function problem +# +CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a)); +INSERT INTO t1 VALUES (1, '10:00:00', NULL, NULL), + (2, '11:00:00', '11:15:00', '1972-02-06'); +SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d) + FROM t1; +SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d) + FROM t1 ORDER BY a DESC; +DROP TABLE t1; --echo End of 5.0 tests # diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 1d8991e92a1..1fabe2667a4 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -939,4 +939,39 @@ REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost; --error ER_WRONG_STRING_LENGTH REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY; + + +# +# BUG#23556: TRUNCATE TABLE still maps to DELETE +# +CREATE USER bug23556@localhost; +CREATE DATABASE bug23556; +GRANT SELECT ON bug23556.* TO bug23556@localhost; +connect (bug23556,localhost,bug23556,,bug23556); + +connection default; +USE bug23556; +CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +GRANT DELETE ON t1 TO bug23556@localhost; + +connection bug23556; +USE bug23556; +--error ER_TABLEACCESS_DENIED_ERROR +TRUNCATE t1; + +connection default; +USE bug23556; +REVOKE DELETE ON t1 FROM bug23556@localhost; +GRANT DROP ON t1 TO bug23556@localhost; + +connection bug23556; +USE bug23556; +TRUNCATE t1; + +connection default; +USE bug23556; +DROP TABLE t1; +USE test; +DROP DATABASE bug23556; +DROP USER bug23556@localhost; --echo End of 5.0 tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 6d98e4c4aa9..de329ce7b0b 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -988,6 +988,18 @@ explain select * from v1; explain select * from (select table_name from information_schema.tables) as a; drop view v1; +# +# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail +# +create table t1 (f1 int(11)); +create table t2 (f1 int(11), f2 int(11)); + +select table_name from information_schema.tables +where table_schema = 'test' and table_name not in +(select table_name from information_schema.columns + where table_schema = 'test' and column_name = 'f3'); +drop table t1,t2; + --echo End of 5.0 tests. # # Show engines diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test index e7405418be7..f29366797f6 100644 --- a/mysql-test/t/join_nested.test +++ b/mysql-test/t/join_nested.test @@ -1045,3 +1045,42 @@ SELECT t1.*, t4.nm WHERE t1.id='5'; DROP TABLE t1,t2,t3,t4; + +# +# BUG#25575: ERROR 1052 (Column in from clause is ambiguous) with sub-join +# +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (a INT); +CREATE TABLE t3 (a INT, c INT); +CREATE TABLE t4 (a INT, c INT); +CREATE TABLE t5 (a INT, c INT); + +SELECT b FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a) +LEFT JOIN t5 USING (a)) USING (a); + +--error ER_NON_UNIQ_ERROR +SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a) +LEFT JOIN t5 USING (a)) USING (a); + +SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a) +JOIN t5 USING (a)) USING (a); + +--error ER_NON_UNIQ_ERROR +SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a) +JOIN t5 USING (a)) USING (a); + +DROP TABLE t1,t2,t3,t4,t5; +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (a INT, b INT); +CREATE TABLE t3 (a INT, b INT); + +INSERT INTO t1 VALUES (1,1); +INSERT INTO t2 VALUES (1,1); +INSERT INTO t3 VALUES (1,1); + +--error ER_NON_UNIQ_ERROR +SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a); + +DROP TABLE t1,t2,t3; + +--echo End of 5.0 tests diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index 0a5eb17f6f5..1a53344c8ef 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -442,3 +442,14 @@ alter table t1 drop index i3, drop index i2, drop index i1; alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1); drop table t1; + +# +# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX. +# + +CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM; +INSERT INTO t1 VALUES( 1 ); +ALTER TABLE t1 DISABLE KEYS; +EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a); + +drop table t1; diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test index 6fc0f3421a7..e16256d48df 100644 --- a/mysql-test/t/log_state.test +++ b/mysql-test/t/log_state.test @@ -37,7 +37,6 @@ set session long_query_time=1; select sleep(2); --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME select * from mysql.slow_log; -disconnect con1; connection default; show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or @@ -121,3 +120,8 @@ drop table t1; select * from mysql.general_log; --enable_ps_protocol + +# +# Cleanup (must be done last to avoid delayed 'Quit' message in general log) +# +disconnect con1; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index c0f33ef9204..23cdb094e83 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -44,7 +44,7 @@ unlock tables; drop table t1; # -# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\' +# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\' # # new command \C or charset @@ -263,4 +263,14 @@ drop table t17583; --exec echo "DELIMITER \\\\" > $MYSQLTEST_VARDIR/tmp/bug21412.sql --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1 +# +# Some coverage of not normally used parts +# + +--disable_query_log +--exec $MYSQL test -e "show status" 2>&1 > /dev/null +--exec $MYSQL --help 2>&1 > /dev/null +--exec $MYSQL --version 2>&1 > /dev/null +--enable_quary_log + --echo End of 5.0 tests diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index ad6a16810c5..8c5d5f772fc 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -9,7 +9,7 @@ set timestamp=1000000000; --disable_warnings -drop table if exists t1,t2; +drop table if exists t1,t2,t3,t4,t5,t03,t04; --enable_warnings create table t1 (word varchar(20)); @@ -108,8 +108,11 @@ select "--- reading stdin --" as ""; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 +drop table t1,t2; +# # Bug#16217 (mysql client did not know how not switch its internal charset) +# flush logs; create table t3 (f text character set utf8); create table t4 (f text character set cp932); @@ -123,6 +126,7 @@ select HEX(f) from t03; select HEX(f) from t3; select HEX(f) from t04; select HEX(f) from t4; +drop table t3,t4,t03,t04; # #BUG#14157: utf8 encoding in binlog without set character_set_client @@ -136,6 +140,7 @@ flush logs; flush logs; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL select * from t5 /* must be (1),(1) */; +drop table t5; # # Bug#22645 LC_TIME_NAMES: Statement not replicated @@ -143,7 +148,6 @@ select * from t5 /* must be (1),(1) */; # lc_time_names dependent values correctly # flush logs; -drop table if exists t5; create table t5 (c1 int, c2 varchar(128) character set latin1 not null); insert into t5 values (1, date_format('2001-01-01','%W')); set lc_time_names=de_DE; @@ -155,6 +159,8 @@ flush logs; drop table t5; --exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL select * from t5 order by c1; +drop table t5; + # # Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails # @@ -179,8 +185,13 @@ call p1(); call p1(); drop procedure p1; -# clean up -drop table t1, t2, t03, t04, t3, t4, t5; +# +# Some coverage of not normally used parts +# +--disable_query_log +--exec $MYSQL_BINLOG --version 2>&1 > /dev/null +--exec $MYSQL_BINLOG --help 2>&1 > /dev/null +--enable_query_log # End of 5.0 tests diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index 074faa48021..d233546f9e3 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -1,3 +1,4 @@ + # Embedded server doesn't support external clients --source include/not_embedded.inc @@ -5,13 +6,16 @@ # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc +# +# Clean up after previous tests +# + --disable_warnings +DROP TABLE IF EXISTS t1; +drop view if exists v1; drop database if exists client_test_db; --enable_warnings -DROP SCHEMA test; -CREATE SCHEMA test; -use test; # # Bug #13783 mysqlcheck tries to optimize and analyze information_schema # diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 7da84543e6d..601bf7af7d5 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1246,8 +1246,16 @@ EOF connect (con1,localhost,root,,); connection default; connection con1; +disconnect con1; --enable_abort_on_error +# Test connect without a database +connect (con2,localhost,root,,*NO-ONE*); +--error ER_NO_DB_ERROR +show tables; +disconnect con2; +connection default; + # ---------------------------------------------------------------------------- # Test mysqltest arguments # ---------------------------------------------------------------------------- @@ -1605,5 +1613,17 @@ EOF --exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1 +# ---------------------------------------------------------------------------- +# Some coverage tests +# ---------------------------------------------------------------------------- + +--disable_query_log +--exec $MYSQL_TEST --help 2>&1 > /dev/null +--exec $MYSQL_TEST --version 2>&1 > /dev/null +--enable_quary_log +--disable_abort_on_error +--error 1 +--exec $MYSQL_TEST a b c 2>&1 > /dev/null +--enable_abort_on_error --echo End of tests diff --git a/mysql-test/t/ndb_read_multi_range.test b/mysql-test/t/ndb_read_multi_range.test index 4d93c07f9be..775a2eb9cef 100644 --- a/mysql-test/t/ndb_read_multi_range.test +++ b/mysql-test/t/ndb_read_multi_range.test @@ -249,12 +249,12 @@ t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a a delete from t22 where a > 245651; update t22 set b = a + 1; select * from t22 order by 1,2,3; -select c, count(*) +select t21.c, count(*) from t21 inner join t22 using (a) where t22.b in (2,256,257,1121,1134,4102,9200,223457,245652) -group by c -order by c; +group by t21.c +order by t21.c; DROP TABLE t1, t11, t12, t21, t22; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index dd70f7edfa7..a9d4488b1be 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -579,7 +579,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ; create table t5 (a int) ; # rename must fail, t7 does not exist # Clean up the filename here because embedded server reports whole path ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ "" t7.frm t7 +--replace_result \\ / $MYSQLTEST_VARDIR . /master-data/ "" t7.frm t7 --error 1017 execute stmt1 ; create table t7 (a int) ; diff --git a/mysql-test/t/rpl_ndb_dd_advance.test b/mysql-test/t/rpl_ndb_dd_advance.test index 4730951cb47..82ec85c09a5 100644 --- a/mysql-test/t/rpl_ndb_dd_advance.test +++ b/mysql-test/t/rpl_ndb_dd_advance.test @@ -9,6 +9,7 @@ --source include/have_binlog_format_row.inc --source include/ndb_default_cluster.inc --source include/not_embedded.inc +--source include/big_test.inc #--source include/have_ndb_extra.inc --source include/master-slave.inc diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index fbb2b4d8d3d..ba4c789ec08 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3134,3 +3134,77 @@ SELECT * FROM t1 LIMIT 2, -1; DROP TABLE t1; +# +# 25407: wrong estimate of NULL keys for unique indexes +# + +CREATE TABLE t1 ( + ID_with_null int NULL, + ID_better int NOT NULL, + INDEX idx1 (ID_with_null), + INDEX idx2 (ID_better) +); + +INSERT INTO t1 VALUES (1,1), (2,1), (null,3), (null,3), (null,3), (null,3); +INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL; + +SELECT COUNT(*) FROM t1 WHERE ID_with_null IS NULL; +SELECT COUNT(*) FROM t1 WHERE ID_better=1; + +EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; + +DROP INDEX idx1 ON t1; +CREATE UNIQUE INDEX idx1 ON t1(ID_with_null); + +EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL; + +DROP TABLE t1; + +CREATE TABLE t1 ( + ID1_with_null int NULL, + ID2_with_null int NULL, + ID_better int NOT NULL, + INDEX idx1 (ID1_with_null, ID2_with_null), + INDEX idx2 (ID_better) +); + +INSERT INTO t1 VALUES (1,1,1), (2,2,1), (3,null,3), (null,3,3), (null,null,3), + (3,null,3), (null,3,3), (null,null,3), (3,null,3), (null,3,3), (null,null,3); + +INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL; +INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL; + +SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3; +SELECT COUNT(*) FROM t1 WHERE ID1_with_null=3 AND ID2_with_null IS NULL; +SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL; +SELECT COUNT(*) FROM t1 WHERE ID_better=1; + +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ; +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; + +DROP INDEX idx1 ON t1; +CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null); + +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ; +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ; +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL; +EXPLAIN SELECT * FROM t1 + WHERE ID_better=1 AND ID1_with_null IS NULL AND + (ID2_with_null=1 OR ID2_with_null=2); + +DROP TABLE t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 98471622bc5..4fd1542ea0f 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -2000,6 +2000,65 @@ SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; DROP TABLE t1; + +# +# Bug 24653: sorting by expressions containing subselects +# that return more than one row +# + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES (2), (4), (1), (3); + +CREATE TABLE t2 (b int, c int); +INSERT INTO t2 VALUES + (2,1), (1,3), (2,1), (4,4), (2,2), (1,4); + +SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 ); +--error 1242 +SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1); +SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a; +--error 1242 +SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a; + +SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2); +--error 1242 +SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1); + + +SELECT a FROM t1 GROUP BY a + HAVING IFNULL((SELECT b FROM t2 WHERE b > 2), + (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3; +--error 1242 +SELECT a FROM t1 GROUP BY a + HAVING IFNULL((SELECT b FROM t2 WHERE b > 1), + (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3; + +SELECT a FROM t1 GROUP BY a + HAVING IFNULL((SELECT b FROM t2 WHERE b > 4), + (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3; +--error 1242 +SELECT a FROM t1 GROUP BY a + HAVING IFNULL((SELECT b FROM t2 WHERE b > 4), + (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3; + +SELECT a FROM t1 + ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2), + (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)); +--error 1242 +SELECT a FROM t1 + ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1), + (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)); + +SELECT a FROM t1 + ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4), + (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)); +--error 1242 +SELECT a FROM t1 + ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4), + (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)); + +DROP TABLE t1,t2; + # End of 4.1 tests # diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test index 23d78721dbe..ed8480ba464 100644 --- a/mysql-test/t/subselect3.test +++ b/mysql-test/t/subselect3.test @@ -472,3 +472,20 @@ select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z drop table t1,t2; +# +# BUG#24420: row-based IN suqueries with aggregation when the left operand +# of the subquery predicate may contain NULL values +# + +create table t1 (a int, b int); +insert into t1 values (0,0), (2,2), (3,3); +create table t2 (a int, b int); +insert into t2 values (1,1), (3,3); + +select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1; + +insert into t2 values (NULL,4); +select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1; + +drop table t1,t2; + diff --git a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test index 6dd0c83dc92..2a0cf829bae 100644 --- a/mysql-test/t/trigger-grant.test +++ b/mysql-test/t/trigger-grant.test @@ -60,8 +60,8 @@ CREATE TABLE t2(user_str TEXT); --echo --echo ---> connection: default -GRANT INSERT, DELETE ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; -GRANT INSERT, DELETE ON mysqltest_db1.t2 TO mysqltest_dfn@localhost; +GRANT INSERT, DROP ON mysqltest_db1.t1 TO mysqltest_dfn@localhost; +GRANT INSERT, DROP ON mysqltest_db1.t2 TO mysqltest_dfn@localhost; # # Check that the user must have TRIGGER privilege to create a trigger. diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index b40a8538e04..b6bf8fcb40e 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -1505,6 +1505,31 @@ update t1 set i= i+ 10 where j > 2; select * from t1; drop table t1; +# +# Bug#23556 TRUNCATE TABLE still maps to DELETE +# +CREATE TABLE t1 (a INT PRIMARY KEY); +CREATE TABLE t2 (a INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); + +CREATE TRIGGER trg_t1 BEFORE DELETE on t1 FOR EACH ROW + INSERT INTO t2 VALUES (OLD.a); + +FLUSH STATUS; +TRUNCATE t1; +SHOW STATUS LIKE 'handler_delete'; +SELECT COUNT(*) FROM t2; + +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); +DELETE FROM t2; + +FLUSH STATUS; +DELETE FROM t1; +SHOW STATUS LIKE 'handler_delete'; +SELECT COUNT(*) FROM t2; + +DROP TRIGGER trg_t1; +DROP TABLE t1,t2; # # Bug #23651 "Server crashes when trigger which uses stored function diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test index bdff72cdc76..826a35cabdf 100644 --- a/mysql-test/t/wait_timeout.test +++ b/mysql-test/t/wait_timeout.test @@ -49,7 +49,8 @@ sleep 1; connection default; # When the connection is closed in this way, the error code should # be consistent see bug#2845 for an explanation ---error 2006 +# depending on platform/client, either errno 2006 or 2013 can occur below +--error 2006,2013 select 2; --enable_reconnect select 3; @@ -96,7 +97,8 @@ sleep 1; connection con1; # When the connection is closed in this way, the error code should # be consistent see bug#2845 for an explanation ---error 2006 +# depending on platform/client, either errno 2006 or 2013 can occur below +--error 2006,2013 select 2; --enable_reconnect select 3; |