Commit 41e6a1f8 authored by Matthias Leich's avatar Matthias Leich

2. Slice of fix for Bug#42003 tests missing the disconnect of connections <> default

   - If missing: add "disconnect <session>"
   - If physical disconnect of non "default" sessions is not finished
     at test end: add routine which waits till this happened
+ additional improvements
  - remove superfluous files created by the test
  - replace error numbers by error names
  - remove trailing spaces, replace tabs by spaces
  - unify writing of bugs within comments
  - correct comments
  - minor changes of formatting
Fixed tests:
  backup
  check
  compress
  grant
  information_schema
  multi_update
  overflow
  packet
  query_cache_not_embedded
  sp-threads
  subselect
  synchronization
  timezone_grant
parent 6f19c0fc
set SQL_LOG_BIN=0; set SQL_LOG_BIN=0;
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3, t4;
create table t4(n int); create table t4(n int);
backup table t4 to '../bogus'; backup table t4 to '../bogus';
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
......
drop table if exists t1; drop table if exists t1,t2;
drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n)); create table t1(n int not null, key(n), key(n), key(n), key(n));
check table t1 extended; check table t1 extended;
insert into t1 values (200000); insert into t1 values (200000);
......
...@@ -262,7 +262,7 @@ drop user mysqltest_1@localhost; ...@@ -262,7 +262,7 @@ drop user mysqltest_1@localhost;
SET NAMES koi8r; SET NAMES koi8r;
CREATE DATABASE ; CREATE DATABASE ;
USE ; USE ;
CREATE TABLE ( int); CREATE TABLE ( INT);
GRANT SELECT ON .* TO @localhost; GRANT SELECT ON .* TO @localhost;
SHOW GRANTS FOR @localhost; SHOW GRANTS FOR @localhost;
Grants for @localhost Grants for @localhost
...@@ -383,7 +383,7 @@ grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; ...@@ -383,7 +383,7 @@ grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost''' WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE; ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'mysqltest_3'@'localhost' NULL mysqltest_1 t1 a UPDATE NO 'mysqltest_3'@'localhost' NULL mysqltest_1 t1 a UPDATE NO
'mysqltest_3'@'localhost' NULL mysqltest_2 t1 c SELECT NO 'mysqltest_3'@'localhost' NULL mysqltest_2 t1 c SELECT NO
...@@ -391,11 +391,11 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN ...@@ -391,11 +391,11 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN
'mysqltest_3'@'localhost' NULL mysqltest_2 t2 d UPDATE NO 'mysqltest_3'@'localhost' NULL mysqltest_2 t2 d UPDATE NO
SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost''' WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_NAME,PRIVILEGE_TYPE; ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost''' WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE; ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost''' WHERE GRANTEE = '''mysqltest_3''@''localhost'''
...@@ -880,11 +880,11 @@ flush privileges; ...@@ -880,11 +880,11 @@ flush privileges;
drop table t2; drop table t2;
drop table t1; drop table t1;
CREATE DATABASE mysqltest3; CREATE DATABASE mysqltest3;
use mysqltest3; USE mysqltest3;
CREATE TABLE t_nn (c1 INT); CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn; CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2; CREATE DATABASE mysqltest2;
use mysqltest2; USE mysqltest2;
CREATE TABLE t_nn (c1 INT); CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn; CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE VIEW v_yn AS SELECT * FROM t_nn; CREATE VIEW v_yn AS SELECT * FROM t_nn;
...@@ -954,7 +954,7 @@ DROP TABLE mysqltest3.t_nn; ...@@ -954,7 +954,7 @@ DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3; DROP DATABASE mysqltest3;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost'; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost'; DROP USER 'mysqltest_1'@'localhost';
use test; USE test;
create user mysqltest1_thisisreallytoolong; create user mysqltest1_thisisreallytoolong;
ERROR HY000: String 'mysqltest1_thisisreallytoolong' is too long for user name (should be no longer than 16) ERROR HY000: String 'mysqltest1_thisisreallytoolong' is too long for user name (should be no longer than 16)
GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost; GRANT CREATE ON mysqltest.* TO 1234567890abcdefGHIKL@localhost;
...@@ -1106,16 +1106,16 @@ DROP DATABASE mysqltest1; ...@@ -1106,16 +1106,16 @@ DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2; DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost; DROP USER mysqltest_2@localhost;
use test; USE test;
CREATE TABLE t1 (f1 int, f2 int); CREATE TABLE t1 (f1 int, f2 int);
INSERT INTO t1 VALUES(1,1), (2,2); INSERT INTO t1 VALUES(1,1), (2,2);
CREATE DATABASE db27878; CREATE DATABASE db27878;
GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost'; GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost'; GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost'; GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
use db27878; USE db27878;
CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1; CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
use db27878; USE db27878;
UPDATE v1 SET f2 = 4; UPDATE v1 SET f2 = 4;
ERROR HY000: View 'db27878.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ERROR HY000: View 'db27878.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
SELECT * FROM test.t1; SELECT * FROM test.t1;
...@@ -1127,7 +1127,7 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost'; ...@@ -1127,7 +1127,7 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost'; REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
DROP DATABASE db27878; DROP DATABASE db27878;
use test; USE test;
DROP TABLE t1; DROP TABLE t1;
drop table if exists test; drop table if exists test;
Warnings: Warnings:
......
set @max_allowed_packet=@@global.max_allowed_packet;
set @net_buffer_length=@@global.net_buffer_length;
set global max_allowed_packet=100; set global max_allowed_packet=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100' Warning 1292 Truncated incorrect max_allowed_packet value: '100'
...@@ -33,3 +35,5 @@ len ...@@ -33,3 +35,5 @@ len
select length(repeat('a',2000)); select length(repeat('a',2000));
length(repeat('a',2000)) length(repeat('a',2000))
2000 2000
set global max_allowed_packet=@max_allowed_packet;
set global net_buffer_length=@net_buffer_length;
...@@ -345,3 +345,19 @@ id ...@@ -345,3 +345,19 @@ id
drop table t1; drop table t1;
drop function f1; drop function f1;
set GLOBAL query_cache_size=0; set GLOBAL query_cache_size=0;
DROP TABLE IF EXISTS t1;
FLUSH STATUS;
SET GLOBAL query_cache_size=1048576;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
LOCK TABLES t1 WRITE;
SELECT * FROM t1;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
...@@ -2945,26 +2945,26 @@ create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b)); ...@@ -2945,26 +2945,26 @@ create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
1 PRIMARY r const PRIMARY PRIMARY 4 const 1 1 PRIMARY r const PRIMARY PRIMARY 4 const 1
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where 2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10; ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
a a b a a b
10 3 35989 10 3 35989
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
1 PRIMARY r const PRIMARY PRIMARY 4 const 1 1 PRIMARY r const PRIMARY PRIMARY 4 const 1
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where 2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using where
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10; ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
a a b a a b
10 1 359 10 1 359
drop table t1,t2; drop table t1,t2;
......
drop table if exists t1; DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (x1 int); CREATE TABLE t1 (x1 INT);
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -8,7 +8,7 @@ t2 CREATE TABLE `t2` ( ...@@ -8,7 +8,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` ( ...@@ -16,7 +16,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` ( ...@@ -24,7 +24,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -32,7 +32,7 @@ t2 CREATE TABLE `t2` ( ...@@ -32,7 +32,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` ( ...@@ -40,7 +40,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` ( ...@@ -48,7 +48,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -56,7 +56,7 @@ t2 CREATE TABLE `t2` ( ...@@ -56,7 +56,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` ( ...@@ -64,7 +64,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -72,7 +72,7 @@ t2 CREATE TABLE `t2` ( ...@@ -72,7 +72,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -80,7 +80,7 @@ t2 CREATE TABLE `t2` ( ...@@ -80,7 +80,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -88,7 +88,7 @@ t2 CREATE TABLE `t2` ( ...@@ -88,7 +88,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` ( ...@@ -96,7 +96,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -104,7 +104,7 @@ t2 CREATE TABLE `t2` ( ...@@ -104,7 +104,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -112,7 +112,7 @@ t2 CREATE TABLE `t2` ( ...@@ -112,7 +112,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` ( ...@@ -120,7 +120,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -128,7 +128,7 @@ t2 CREATE TABLE `t2` ( ...@@ -128,7 +128,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -136,7 +136,7 @@ t2 CREATE TABLE `t2` ( ...@@ -136,7 +136,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -144,7 +144,7 @@ t2 CREATE TABLE `t2` ( ...@@ -144,7 +144,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
...@@ -152,7 +152,7 @@ t2 CREATE TABLE `t2` ( ...@@ -152,7 +152,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 INT;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
......
# The server need to be started in $MYSQLTEST_VARDIR since it # The server need to be started in $MYSQLTEST_VARDIR since it
# uses ../std_data_ln/ # uses ../std_data_ln/
-- source include/uses_vardir.inc --source include/uses_vardir.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# This test is a bit tricky as we can't use backup table to overwrite an old # This test is a bit tricky as we can't use backup table to overwrite an old
...@@ -12,7 +15,7 @@ connect (con2,localhost,root,,); ...@@ -12,7 +15,7 @@ connect (con2,localhost,root,,);
connection con1; connection con1;
set SQL_LOG_BIN=0; set SQL_LOG_BIN=0;
--disable_warnings --disable_warnings
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3, t4;
--enable_warnings --enable_warnings
create table t4(n int); create table t4(n int);
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
...@@ -57,6 +60,9 @@ unlock tables; ...@@ -57,6 +60,9 @@ unlock tables;
connection con1; connection con1;
reap; reap;
drop table t5; drop table t5;
connection default;
disconnect con1;
disconnect con2;
remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD; remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD; remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD; remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
...@@ -68,4 +74,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/t3.frm; ...@@ -68,4 +74,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t4.frm; remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t5.frm; remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
# End of 4.1 tests # End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con1; connection con1;
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1,t2;
drop view if exists v1;
--enable_warnings --enable_warnings
# Add a lot of keys to slow down check # Add a lot of keys to slow down check
...@@ -20,16 +24,18 @@ connection con2; ...@@ -20,16 +24,18 @@ connection con2;
insert into t1 values (200000); insert into t1 values (200000);
connection con1; connection con1;
reap; reap;
connection default;
disconnect con1;
disconnect con2;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
# #
# Bug #9897 Views: 'Check Table' crashes MySQL, with a view and a table # Bug#9897 Views: 'Check Table' crashes MySQL, with a view and a table
# in the statement # in the statement
# #
connection default;
Create table t1(f1 int); Create table t1(f1 int);
Create table t2(f1 int); Create table t2(f1 int);
Create view v1 as Select * from t1; Create view v1 as Select * from t1;
...@@ -37,11 +43,15 @@ Check Table v1,t2; ...@@ -37,11 +43,15 @@ Check Table v1,t2;
drop view v1; drop view v1;
drop table t1, t2; drop table t1, t2;
# #
# BUG#26325 - TEMPORARY TABLE "corrupt" after first read, according to CHECK # Bug#26325 TEMPORARY TABLE "corrupt" after first read, according to CHECK TABLE
# TABLE
# #
CREATE TEMPORARY TABLE t1(a INT); CREATE TEMPORARY TABLE t1(a INT);
CHECK TABLE t1; CHECK TABLE t1;
REPAIR TABLE t1; REPAIR TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
-- source include/have_compress.inc -- source include/have_compress.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (comp_con,localhost,root,,,,,COMPRESS); connect (comp_con,localhost,root,,,,,COMPRESS);
# Check compression turned on # Check compression turned on
...@@ -16,3 +20,10 @@ SHOW STATUS LIKE 'Compression'; ...@@ -16,3 +20,10 @@ SHOW STATUS LIKE 'Compression';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
connection default;
disconnect comp_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
# Grant tests not performed with embedded server # Grant tests not performed with embedded server
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Cleanup # Cleanup
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -78,7 +81,7 @@ delete from mysql.db where user='mysqltest_1'; ...@@ -78,7 +81,7 @@ delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1'; delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1'; delete from mysql.columns_priv where user='mysqltest_1';
flush privileges; flush privileges;
--error 1141 --error ER_NONEXISTING_GRANT
show grants for mysqltest_1@localhost; show grants for mysqltest_1@localhost;
# #
...@@ -116,12 +119,12 @@ drop table t1; ...@@ -116,12 +119,12 @@ drop table t1;
# #
# Test some error conditions # Test some error conditions
# #
--error 1221 --error ER_WRONG_USAGE
GRANT FILE on mysqltest.* to mysqltest_1@localhost; GRANT FILE on mysqltest.* to mysqltest_1@localhost;
select 1; # To test that the previous command didn't cause problems select 1; # To test that the previous command didn't cause problems
# #
# Bug #4898: User privileges depending on ORDER BY Settings of table db # Bug#4898 User privileges depending on ORDER BY Settings of table db
# #
insert into mysql.user (host, user) values ('localhost', 'test11'); insert into mysql.user (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values insert into mysql.db (host, db, user, select_priv) values
...@@ -136,7 +139,7 @@ delete from mysql.user where user='test11'; ...@@ -136,7 +139,7 @@ delete from mysql.user where user='test11';
delete from mysql.db where user='test11'; delete from mysql.db where user='test11';
# #
# Bug#6123: GRANT USAGE inserts useless Db row # Bug#6123 GRANT USAGE inserts useless Db row
# #
create database mysqltest1; create database mysqltest1;
grant usage on mysqltest1.* to test6123 identified by 'magic123'; grant usage on mysqltest1.* to test6123 identified by 'magic123';
...@@ -160,7 +163,7 @@ grant select(a) on test.t1 to drop_user@localhost; ...@@ -160,7 +163,7 @@ grant select(a) on test.t1 to drop_user@localhost;
show grants for drop_user@localhost; show grants for drop_user@localhost;
# #
# Bug3086 # Bug#3086 SHOW GRANTS doesn't follow ANSI_QUOTES
# #
set sql_mode=ansi_quotes; set sql_mode=ansi_quotes;
show grants for drop_user@localhost; show grants for drop_user@localhost;
...@@ -178,7 +181,7 @@ show grants for drop_user@localhost; ...@@ -178,7 +181,7 @@ show grants for drop_user@localhost;
revoke all privileges, grant option from drop_user@localhost; revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost; show grants for drop_user@localhost;
drop user drop_user@localhost; drop user drop_user@localhost;
--error 1269 --error ER_REVOKE_GRANTS
revoke all privileges, grant option from drop_user@localhost; revoke all privileges, grant option from drop_user@localhost;
grant select(a) on test.t1 to drop_user1@localhost; grant select(a) on test.t1 to drop_user1@localhost;
...@@ -188,10 +191,10 @@ grant select on *.* to drop_user4@localhost; ...@@ -188,10 +191,10 @@ grant select on *.* to drop_user4@localhost;
# Drop user now implicitly revokes all privileges. # Drop user now implicitly revokes all privileges.
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost; drop_user4@localhost;
--error 1269 --error ER_REVOKE_GRANTS
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost, revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost; drop_user3@localhost, drop_user4@localhost;
--error 1396 --error ER_CANNOT_USER
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost; drop_user4@localhost;
drop table t1; drop table t1;
...@@ -201,12 +204,12 @@ show grants for mysqltest_1@localhost; ...@@ -201,12 +204,12 @@ show grants for mysqltest_1@localhost;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
# #
# Bug #3403 Wrong encodin in SHOW GRANTS output # Bug#3403 Wrong encoding in SHOW GRANTS, EPLAIN SELECT output
# #
SET NAMES koi8r; SET NAMES koi8r;
CREATE DATABASE ; CREATE DATABASE ;
USE ; USE ;
CREATE TABLE ( int); CREATE TABLE ( INT);
GRANT SELECT ON .* TO @localhost; GRANT SELECT ON .* TO @localhost;
SHOW GRANTS FOR @localhost; SHOW GRANTS FOR @localhost;
...@@ -227,7 +230,7 @@ DROP DATABASE ...@@ -227,7 +230,7 @@ DROP DATABASE
SET NAMES latin1; SET NAMES latin1;
# #
# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything # Bug#5831 REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
# #
USE test; USE test;
CREATE TABLE t1 (a int ); CREATE TABLE t1 (a int );
...@@ -296,7 +299,7 @@ DROP DATABASE testdb9; ...@@ -296,7 +299,7 @@ DROP DATABASE testdb9;
DROP DATABASE testdb10; DROP DATABASE testdb10;
# #
# Bug #6932: a problem with 'revoke ALL PRIVILEGES' # Bug#6932 a problem with 'revoke ALL PRIVILEGES'
# #
create table t1(a int, b int, c int, d int); create table t1(a int, b int, c int, d int);
...@@ -310,7 +313,7 @@ drop user grant_user@localhost; ...@@ -310,7 +313,7 @@ drop user grant_user@localhost;
drop table t1; drop table t1;
# #
# Bug#7391: Cross-database multi-table UPDATE security problem # Bug#7391 Cross-database multi-table UPDATE security problem
# #
create database mysqltest_1; create database mysqltest_1;
create database mysqltest_2; create database mysqltest_2;
...@@ -319,7 +322,7 @@ create table mysqltest_1.t2 select 1 b, 2 r; ...@@ -319,7 +322,7 @@ create table mysqltest_1.t2 select 1 b, 2 r;
create table mysqltest_2.t1 select 1 c, 2 s; create table mysqltest_2.t1 select 1 c, 2 s;
create table mysqltest_2.t2 select 1 d, 2 t; create table mysqltest_2.t2 select 1 d, 2 t;
#test the column privileges # test the column privileges
grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
...@@ -338,17 +341,17 @@ SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES ...@@ -338,17 +341,17 @@ SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost''' WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE; ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE;
--error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
--error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1; update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
--error 1143 --error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
#the following two should work # the following two should work
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
connection master; connection master;
...@@ -359,7 +362,7 @@ revoke all on mysqltest_1.t2 from mysqltest_3@localhost; ...@@ -359,7 +362,7 @@ revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
revoke all on mysqltest_2.t1 from mysqltest_3@localhost; revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost; revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
#test the db/table level privileges # test the db/table level privileges
grant all on mysqltest_2.* to mysqltest_3@localhost; grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost; grant select on *.* to mysqltest_3@localhost;
# Next grant is needed to trigger bug#7391. Do not optimize! # Next grant is needed to trigger bug#7391. Do not optimize!
...@@ -371,15 +374,15 @@ connection conn2; ...@@ -371,15 +374,15 @@ connection conn2;
use mysqltest_1; use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
# the following failed before, should fail now. # the following failed before, should fail now.
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
use mysqltest_2; use mysqltest_2;
#the following used to succeed, it must fail now. # the following used to succeed, it must fail now.
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
#lets see the result #lets see the result
connection master; connection master;
...@@ -393,6 +396,7 @@ delete from mysql.columns_priv where user="mysqltest_3"; ...@@ -393,6 +396,7 @@ delete from mysql.columns_priv where user="mysqltest_3";
flush privileges; flush privileges;
drop database mysqltest_1; drop database mysqltest_1;
drop database mysqltest_2; drop database mysqltest_2;
disconnect conn2;
# #
# just SHOW PRIVILEGES test # just SHOW PRIVILEGES test
...@@ -400,7 +404,7 @@ drop database mysqltest_2; ...@@ -400,7 +404,7 @@ drop database mysqltest_2;
SHOW PRIVILEGES; SHOW PRIVILEGES;
# #
# Rights for renaming test (Bug #3270) # Rights for renaming test (Bug#3270)
# #
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root; connection root;
...@@ -411,16 +415,18 @@ create table mysqltest.t1 (a int,b int,c int); ...@@ -411,16 +415,18 @@ create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost; grant all on mysqltest.t1 to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK); connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1; connection user1;
-- error 1142 -- error ER_TABLEACCESS_DENIED_ERROR
alter table t1 rename t2; alter table t1 rename t2;
disconnect user1; disconnect user1;
connection root; connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1'; delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest; drop database mysqltest;
connection default;
disconnect root;
# #
# check all new table priveleges # check all new table privileges
# #
CREATE USER dummy@localhost; CREATE USER dummy@localhost;
CREATE DATABASE mysqltest; CREATE DATABASE mysqltest;
...@@ -485,7 +491,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost; ...@@ -485,7 +491,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
DROP USER dummy@localhost; DROP USER dummy@localhost;
DROP DATABASE mysqltest; DROP DATABASE mysqltest;
# #
# Bug #11330: Entry in tables_priv with host = '' causes crash # Bug#11330 Entry in tables_priv with host = '' causes crash
# #
connection default; connection default;
use mysql; use mysql;
...@@ -496,7 +502,7 @@ flush privileges; ...@@ -496,7 +502,7 @@ flush privileges;
use test; use test;
# #
# Bug #10892 user variables not auto cast for comparisons # Bug#10892 user variables not auto cast for comparisons
# Check that we don't get illegal mix of collations # Check that we don't get illegal mix of collations
# #
set @user123="non-existent"; set @user123="non-existent";
...@@ -515,18 +521,18 @@ show grants for root@localhost; ...@@ -515,18 +521,18 @@ show grants for root@localhost;
set names latin1; set names latin1;
# #
# Bug #15598 Server crashes in specific case during setting new password # Bug#15598 Server crashes in specific case during setting new password
# - Caused by a user with host '' # - Caused by a user with host ''
# #
create user mysqltest_7@; create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass'); set password for mysqltest_7@ = password('systpass');
show grants for mysqltest_7@; show grants for mysqltest_7@;
drop user mysqltest_7@; drop user mysqltest_7@;
--error 1141 --error ER_NONEXISTING_GRANT
show grants for mysqltest_7@; show grants for mysqltest_7@;
# #
# Bug#14385: GRANT and mapping to correct user account problems # Bug#14385 GRANT and mapping to correct user account problems
# #
create database mysqltest; create database mysqltest;
use mysqltest; use mysqltest;
...@@ -542,7 +548,7 @@ flush privileges; ...@@ -542,7 +548,7 @@ flush privileges;
drop database mysqltest; drop database mysqltest;
# #
# Bug #27515: DROP previlege is not required for RENAME TABLE # Bug#27515 DROP previlege is not required for RENAME TABLE
# #
connection master; connection master;
create database db27515; create database db27515;
...@@ -553,7 +559,7 @@ grant insert, create on db27515.t2 to user27515@localhost; ...@@ -553,7 +559,7 @@ grant insert, create on db27515.t2 to user27515@localhost;
connect (conn27515, localhost, user27515, , db27515); connect (conn27515, localhost, user27515, , db27515);
connection conn27515; connection conn27515;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
rename table t1 to t2; rename table t1 to t2;
disconnect conn27515; disconnect conn27515;
...@@ -565,7 +571,7 @@ drop database db27515; ...@@ -565,7 +571,7 @@ drop database db27515;
--echo End of 4.1 tests --echo End of 4.1 tests
# #
# Bug #16297 In memory grant tables not flushed when users's hostname is "" # Bug#16297 In memory grant tables not flushed when users's hostname is ""
# #
use test; use test;
create table t1 (a int); create table t1 (a int);
...@@ -582,11 +588,11 @@ create user mysqltest_8; ...@@ -582,11 +588,11 @@ create user mysqltest_8;
create user mysqltest_8@host8; create user mysqltest_8@host8;
# Try to create them again # Try to create them again
--error 1396 --error ER_CANNOT_USER
create user mysqltest_8@''; create user mysqltest_8@'';
--error 1396 --error ER_CANNOT_USER
create user mysqltest_8; create user mysqltest_8;
--error 1396 --error ER_CANNOT_USER
create user mysqltest_8@host8; create user mysqltest_8@host8;
select user, QUOTE(host) from mysql.user where user="mysqltest_8"; select user, QUOTE(host) from mysql.user where user="mysqltest_8";
...@@ -681,44 +687,43 @@ flush privileges; ...@@ -681,44 +687,43 @@ flush privileges;
show grants for mysqltest_8@''; show grants for mysqltest_8@'';
show grants for mysqltest_8; show grants for mysqltest_8;
drop user mysqltest_8@''; drop user mysqltest_8@'';
--error 1141 --error ER_NONEXISTING_GRANT
show grants for mysqltest_8@''; show grants for mysqltest_8@'';
show grants for mysqltest_8; show grants for mysqltest_8;
select * from information_schema.user_privileges select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%"; where grantee like "'mysqltest_8'%";
drop user mysqltest_8; drop user mysqltest_8;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045 --error ER_ACCESS_DENIED_ERROR
connect (conn6,localhost,mysqltest_8,,); connect (conn6,localhost,mysqltest_8,,);
connection master; connection master;
--error 1141 --error ER_NONEXISTING_GRANT
show grants for mysqltest_8; show grants for mysqltest_8;
drop user mysqltest_8@host8; drop user mysqltest_8@host8;
--error 1141 --error ER_NONEXISTING_GRANT
show grants for mysqltest_8@host8; show grants for mysqltest_8@host8;
# Restore the anonymous users. # Restore the anonymous users.
insert into mysql.user select * from t2; insert into mysql.user select * from t2;
flush privileges; flush privileges;
drop table t2; drop table t2;
drop table t1; drop table t1;
# #
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non # Bug#20214 Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view # privileged view
# #
connection master; connection master;
CREATE DATABASE mysqltest3; CREATE DATABASE mysqltest3;
use mysqltest3; USE mysqltest3;
CREATE TABLE t_nn (c1 INT); CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn; CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2; CREATE DATABASE mysqltest2;
use mysqltest2; USE mysqltest2;
CREATE TABLE t_nn (c1 INT); CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn; CREATE VIEW v_nn AS SELECT * FROM t_nn;
...@@ -740,24 +745,18 @@ SHOW CREATE VIEW mysqltest2.v_nn; ...@@ -740,24 +745,18 @@ SHOW CREATE VIEW mysqltest2.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_nn; SHOW CREATE TABLE mysqltest2.v_nn;
# fail because of missing SHOW VIEW # fail because of missing SHOW VIEW
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest2.v_yn; SHOW CREATE VIEW mysqltest2.v_yn;
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_yn; SHOW CREATE TABLE mysqltest2.v_yn;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out) # succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE TABLE mysqltest2.v_ny; SHOW CREATE TABLE mysqltest2.v_ny;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out) # succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE VIEW mysqltest2.v_ny; SHOW CREATE VIEW mysqltest2.v_ny;
# fail because of missing (specific or generic) SELECT # fail because of missing (specific or generic) SELECT
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.t_nn; SHOW CREATE TABLE mysqltest3.t_nn;
...@@ -766,16 +765,12 @@ SHOW CREATE TABLE mysqltest3.t_nn; ...@@ -766,16 +765,12 @@ SHOW CREATE TABLE mysqltest3.t_nn;
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.t_nn; SHOW CREATE VIEW mysqltest3.t_nn;
# fail because of missing missing (specific or generic) SELECT (and SHOW VIEW) # fail because of missing missing (specific or generic) SELECT (and SHOW VIEW)
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.v_nn; SHOW CREATE VIEW mysqltest3.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.v_nn; SHOW CREATE TABLE mysqltest3.v_nn;
# succeed thanks to generic SELECT # succeed thanks to generic SELECT
SHOW CREATE TABLE mysqltest2.t_nn; SHOW CREATE TABLE mysqltest2.t_nn;
...@@ -783,8 +778,6 @@ SHOW CREATE TABLE mysqltest2.t_nn; ...@@ -783,8 +778,6 @@ SHOW CREATE TABLE mysqltest2.t_nn;
--error ER_WRONG_OBJECT --error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn; SHOW CREATE VIEW mysqltest2.t_nn;
# succeed, have SELECT and SHOW VIEW # succeed, have SELECT and SHOW VIEW
SHOW CREATE VIEW mysqltest2.v_yy; SHOW CREATE VIEW mysqltest2.v_yy;
...@@ -792,8 +785,7 @@ SHOW CREATE VIEW mysqltest2.v_yy; ...@@ -792,8 +785,7 @@ SHOW CREATE VIEW mysqltest2.v_yy;
SHOW CREATE TABLE mysqltest2.v_yy; SHOW CREATE TABLE mysqltest2.v_yy;
# clean-up
#clean-up
connection master; connection master;
# succeed, we're root # succeed, we're root
...@@ -806,38 +798,30 @@ SHOW CREATE TABLE mysqltest2.t_nn; ...@@ -806,38 +798,30 @@ SHOW CREATE TABLE mysqltest2.t_nn;
--error ER_WRONG_OBJECT --error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn; SHOW CREATE VIEW mysqltest2.t_nn;
DROP VIEW mysqltest2.v_nn; DROP VIEW mysqltest2.v_nn;
DROP VIEW mysqltest2.v_yn; DROP VIEW mysqltest2.v_yn;
DROP VIEW mysqltest2.v_ny; DROP VIEW mysqltest2.v_ny;
DROP VIEW mysqltest2.v_yy; DROP VIEW mysqltest2.v_yy;
DROP TABLE mysqltest2.t_nn; DROP TABLE mysqltest2.t_nn;
DROP DATABASE mysqltest2; DROP DATABASE mysqltest2;
DROP VIEW mysqltest3.v_nn; DROP VIEW mysqltest3.v_nn;
DROP TABLE mysqltest3.t_nn; DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3; DROP DATABASE mysqltest3;
disconnect mysqltest_1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost'; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost'; DROP USER 'mysqltest_1'@'localhost';
# restore the original database # restore the original database
use test; USE test;
# #
# Bug #10668: CREATE USER does not enforce username length limit # Bug#10668 CREATE USER does not enforce username length limit
# #
--error ER_WRONG_STRING_LENGTH --error ER_WRONG_STRING_LENGTH
create user mysqltest1_thisisreallytoolong; create user mysqltest1_thisisreallytoolong;
# #
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause. # Test for Bug#16899 Possible buffer overflow in handling of DEFINER-clause.
# #
# These checks are intended to ensure that appropriate errors are risen when # These checks are intended to ensure that appropriate errors are risen when
# illegal user name or hostname is specified in user-clause of GRANT/REVOKE # illegal user name or hostname is specified in user-clause of GRANT/REVOKE
...@@ -887,7 +871,7 @@ REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost; ...@@ -887,7 +871,7 @@ REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY; REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
# #
# Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES # Bug#6774 Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
# #
# Check if GRANT ... ON * ... fails when no database is selected # Check if GRANT ... ON * ... fails when no database is selected
connect (con1, localhost, root,,*NO-ONE*); connect (con1, localhost, root,,*NO-ONE*);
...@@ -899,7 +883,7 @@ connection default; ...@@ -899,7 +883,7 @@ connection default;
# #
# BUG#9504: Stored procedures: execute privilege doesn't make 'use database' # Bug#9504 Stored procedures: execute privilege doesn't make 'use database'
# okay. # okay.
# #
...@@ -981,7 +965,7 @@ DROP USER mysqltest_1@localhost; ...@@ -981,7 +965,7 @@ DROP USER mysqltest_1@localhost;
# #
# BUG#27337: Privileges are not restored properly. # Bug#27337 Privileges are not restored properly.
# #
# Actually, the patch for this bugs fixes two problems. So, here are two test # Actually, the patch for this bugs fixes two problems. So, here are two test
# cases. # cases.
...@@ -1043,7 +1027,7 @@ DROP DATABASE mysqltest2; ...@@ -1043,7 +1027,7 @@ DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
# Test case 2: priveleges are not checked properly for prepared statements. # Test case 2: privileges are not checked properly for prepared statements.
# Prepare. # Prepare.
...@@ -1116,6 +1100,7 @@ EXECUTE stmt2; ...@@ -1116,6 +1100,7 @@ EXECUTE stmt2;
--echo --echo
--echo ---> connection: default --echo ---> connection: default
--disconnect bug27337_con1
--disconnect bug27337_con2 --disconnect bug27337_con2
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
...@@ -1125,21 +1110,21 @@ DROP USER mysqltest_1@localhost; ...@@ -1125,21 +1110,21 @@ DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost; DROP USER mysqltest_2@localhost;
# #
# Bug#27878: Unchecked privileges on a view referring to a table from another # Bug#27878 Unchecked privileges on a view referring to a table from another
# database. # database.
# #
use test; USE test;
CREATE TABLE t1 (f1 int, f2 int); CREATE TABLE t1 (f1 int, f2 int);
INSERT INTO t1 VALUES(1,1), (2,2); INSERT INTO t1 VALUES(1,1), (2,2);
CREATE DATABASE db27878; CREATE DATABASE db27878;
GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost'; GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost'; GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost'; GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
use db27878; USE db27878;
CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1; CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
connect (user1,localhost,mysqltest_1,,test); connect (user1,localhost,mysqltest_1,,test);
connection user1; connection user1;
use db27878; USE db27878;
--error 1356 --error 1356
UPDATE v1 SET f2 = 4; UPDATE v1 SET f2 = 4;
SELECT * FROM test.t1; SELECT * FROM test.t1;
...@@ -1150,11 +1135,11 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost'; ...@@ -1150,11 +1135,11 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost'; REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
DROP USER mysqltest_1@localhost; DROP USER mysqltest_1@localhost;
DROP DATABASE db27878; DROP DATABASE db27878;
use test; USE test;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #33201 Crash occurs when granting update privilege on one column of a view # Bug#33201 Crash occurs when granting update privilege on one column of a view
# #
drop table if exists test; drop table if exists test;
drop function if exists test_function; drop function if exists test_function;
...@@ -1183,3 +1168,7 @@ SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); ...@@ -1183,3 +1168,7 @@ SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
--echo End of 5.0 tests --echo End of 5.0 tests
disconnect master;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
...@@ -77,6 +77,7 @@ connection user4; ...@@ -77,6 +77,7 @@ connection user4;
select table_name, column_name, privileges from information_schema.columns select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1'; where table_schema = 'mysqltest' and table_name = 'v1';
connection default; connection default;
disconnect user4;
drop view v1, mysqltest.v1; drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5; drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
...@@ -153,7 +154,7 @@ drop view v1; ...@@ -153,7 +154,7 @@ drop view v1;
connect (user1,localhost,mysqltest_1,,); connect (user1,localhost,mysqltest_1,,);
connection user1; connection user1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES; select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
--error 1305 --error ER_SP_DOES_NOT_EXIST
show create function sub1; show create function sub1;
connection user3; connection user3;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES; select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
...@@ -172,6 +173,7 @@ show create function sub2; ...@@ -172,6 +173,7 @@ show create function sub2;
show function status like "sub2"; show function status like "sub2";
connection default; connection default;
disconnect user1; disconnect user1;
disconnect user3;
drop function sub2; drop function sub2;
show create procedure sel2; show create procedure sel2;
...@@ -324,7 +326,7 @@ drop table t115; ...@@ -324,7 +326,7 @@ drop table t115;
delimiter //; delimiter //;
create procedure p108 () begin declare c cursor for select data_type create procedure p108 () begin declare c cursor for select data_type
from information_schema.columns; open c; open c; end;// from information_schema.columns; open c; open c; end;//
--error 1325 --error ER_SP_CURSOR_ALREADY_OPEN
call p108()// call p108()//
delimiter ;// delimiter ;//
drop procedure p108; drop procedure p108;
...@@ -347,11 +349,11 @@ from information_schema.tables ...@@ -347,11 +349,11 @@ from information_schema.tables
where table_schema='information_schema' limit 2; where table_schema='information_schema' limit 2;
show tables from information_schema like "T%"; show tables from information_schema like "T%";
--error 1044 --error ER_DBACCESS_DENIED_ERROR
create database information_schema; create database information_schema;
use information_schema; use information_schema;
show full tables like "T%"; show full tables like "T%";
--error 1109 --error ER_UNKNOWN_TABLE
create table t1(a int); create table t1(a int);
use test; use test;
show tables; show tables;
...@@ -359,15 +361,15 @@ use information_schema; ...@@ -359,15 +361,15 @@ use information_schema;
show tables like "T%"; show tables like "T%";
# #
# Bug#7210: information_schema: can't access when table-name = reserved word # Bug#7210 information_schema: can't access when table-name = reserved word
# #
select table_name from tables where table_name='user'; select table_name from tables where table_name='user';
select column_name, privileges from columns select column_name, privileges from columns
where table_name='user' and column_name like '%o%'; where table_name='user' and column_name like '%o%';
# #
# Bug#7212: information_schema: "Can't find file" errors if storage engine gone # Bug#7212 information_schema: "Can't find file" errors if storage engine gone
# Bug#7211: information_schema: crash if bad view # Bug#7211 information_schema: crash if bad view
# #
use test; use test;
create function sub1(i int) returns int create function sub1(i int) returns int
...@@ -394,9 +396,9 @@ drop view v3; ...@@ -394,9 +396,9 @@ drop view v3;
drop table t4; drop table t4;
# #
# Bug#7213: information_schema: redundant non-standard TABLE_NAMES table # Bug#7213 information_schema: redundant non-standard TABLE_NAMES table
# #
--error 1109 --error ER_UNKNOWN_TABLE
select * from information_schema.table_names; select * from information_schema.table_names;
# #
...@@ -422,14 +424,14 @@ show status where variable_name like "%database%"; ...@@ -422,14 +424,14 @@ show status where variable_name like "%database%";
show variables where variable_name like "skip_show_databas"; show variables where variable_name like "skip_show_databas";
# #
# Bug #7981:SHOW GLOBAL STATUS crashes server # Bug#7981 SHOW GLOBAL STATUS crashes server
# #
# We don't actually care about the value, just that it doesn't crash. # We don't actually care about the value, just that it doesn't crash.
--replace_column 2 # --replace_column 2 #
show global status like "Threads_running"; show global status like "Threads_running";
# #
# Bug #7915 crash,JOIN VIEW, subquery, # Bug#7915 crash,JOIN VIEW, subquery,
# SELECT .. FROM INFORMATION_SCHEMA.COLUMNS # SELECT .. FROM INFORMATION_SCHEMA.COLUMNS
# #
create table t1(f1 int); create table t1(f1 int);
...@@ -440,7 +442,7 @@ drop view v1; ...@@ -440,7 +442,7 @@ drop view v1;
drop table t1, t2; drop table t1, t2;
# #
# Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES # Bug#7476 crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
# #
CREATE TABLE t_crashme ( f1 BIGINT); CREATE TABLE t_crashme ( f1 BIGINT);
...@@ -468,8 +470,8 @@ drop view a2, a1; ...@@ -468,8 +470,8 @@ drop view a2, a1;
drop table t_crashme; drop table t_crashme;
# #
# Bug #7215 information_schema: columns are longtext instead of varchar # Bug#7215 information_schema: columns are longtext instead of varchar
# Bug #7217 information_schema: columns are varbinary() instead of timestamp # Bug#7217 information_schema: columns are varbinary() instead of timestamp
# #
select table_schema,table_name, column_name from select table_schema,table_name, column_name from
information_schema.columns information_schema.columns
...@@ -478,7 +480,7 @@ select table_name, column_name, data_type from information_schema.columns ...@@ -478,7 +480,7 @@ select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime'; where data_type = 'datetime';
# #
# Bug #8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU # Bug#8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
# #
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
WHERE NOT EXISTS WHERE NOT EXISTS
...@@ -487,7 +489,7 @@ WHERE NOT EXISTS ...@@ -487,7 +489,7 @@ WHERE NOT EXISTS
AND A.TABLE_NAME = B.TABLE_NAME); AND A.TABLE_NAME = B.TABLE_NAME);
# #
# Bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns # Bug#9344 INFORMATION_SCHEMA, wrong content, numeric columns
# #
create table t1 create table t1
...@@ -514,12 +516,13 @@ connection user10261; ...@@ -514,12 +516,13 @@ connection user10261;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME'; where COLUMN_NAME='TABLE_NAME';
connection default; connection default;
disconnect user10261;
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4';
flush privileges; flush privileges;
# #
# Bug #9404 information_schema: Weird error messages # Bug#9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries # with SELECT SUM() ... GROUP BY queries
# #
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA; SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
...@@ -560,7 +563,7 @@ drop table t1; ...@@ -560,7 +563,7 @@ drop table t1;
# #
# Bug #10964 Information Schema:Authorization check on privilege tables is improper # Bug#10964 Information Schema:Authorization check on privilege tables is improper
# #
create database mysqltest; create database mysqltest;
...@@ -604,12 +607,16 @@ select * from information_schema.user_privileges where grantee like '%user%' ...@@ -604,12 +607,16 @@ select * from information_schema.user_privileges where grantee like '%user%'
order by grantee; order by grantee;
show grants; show grants;
connection default; connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
use test; use test;
drop database mysqltest; drop database mysqltest;
# #
# Bug #11055 information_schema: routines.sql_data_access has wrong value # Bug#11055 information_schema: routines.sql_data_access has wrong value
# #
--disable_warnings --disable_warnings
drop procedure if exists p1; drop procedure if exists p1;
...@@ -624,13 +631,13 @@ drop procedure p1; ...@@ -624,13 +631,13 @@ drop procedure p1;
drop procedure p2; drop procedure p2;
# #
# Bug #9434 SHOW CREATE DATABASE information_schema; # Bug#9434 SHOW CREATE DATABASE information_schema;
# #
show create database information_schema; show create database information_schema;
# #
# Bug #11057 information_schema: columns table has some questionable contents # Bug#11057 information_schema: columns table has some questionable contents
# Bug #12301 information_schema: NUMERIC_SCALE must be 0 for integer columns # Bug#12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
# #
create table t1(f1 LONGBLOB, f2 LONGTEXT); create table t1(f1 LONGBLOB, f2 LONGTEXT);
select column_name,data_type,CHARACTER_OCTET_LENGTH, select column_name,data_type,CHARACTER_OCTET_LENGTH,
...@@ -646,7 +653,7 @@ where table_name='t1'; ...@@ -646,7 +653,7 @@ where table_name='t1';
drop table t1; drop table t1;
# #
# Bug #12127 triggers do not show in info_schema before they are used if set to the database # Bug#12127 triggers do not show in info_schema before they are used if set to the database
# #
create table t1 (f1 integer); create table t1 (f1 integer);
create trigger tr1 after insert on t1 for each row set @test_var=42; create trigger tr1 after insert on t1 for each row set @test_var=42;
...@@ -668,7 +675,7 @@ show columns from t1; ...@@ -668,7 +675,7 @@ show columns from t1;
drop table t1; drop table t1;
# #
# Bug #12636: SHOW TABLE STATUS with where condition containing a subquery # Bug#12636 SHOW TABLE STATUS with where condition containing a subquery
# over information schema # over information schema
# #
...@@ -683,7 +690,7 @@ SHOW TABLE STATUS FROM test ...@@ -683,7 +690,7 @@ SHOW TABLE STATUS FROM test
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #12905 show fields from view behaving erratically with current database # Bug#12905 show fields from view behaving erratically with current database
# #
create table t1(f1 int); create table t1(f1 int);
create view v1 (c) as select f1 from t1; create view v1 (c) as select f1 from t1;
...@@ -691,28 +698,29 @@ connect (con5,localhost,root,,*NO-ONE*); ...@@ -691,28 +698,29 @@ connect (con5,localhost,root,,*NO-ONE*);
select database(); select database();
show fields from test.v1; show fields from test.v1;
connection default; connection default;
disconnect con5;
drop view v1; drop view v1;
drop table t1; drop table t1;
# #
# Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA' # Bug#9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
# #
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
alter database information_schema; alter database information_schema;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
drop database information_schema; drop database information_schema;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
drop table information_schema.tables; drop table information_schema.tables;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
alter table information_schema.tables; alter table information_schema.tables;
# #
# Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB # Bug#9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
# #
use information_schema; use information_schema;
--error 1044 --error ER_DBACCESS_DENIED_ERROR
create temporary table schemata(f1 char(10)); create temporary table schemata(f1 char(10));
# #
# Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA # Bug#10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
# #
delimiter |; delimiter |;
--error ER_BAD_DB_ERROR --error ER_BAD_DB_ERROR
...@@ -723,11 +731,11 @@ END | ...@@ -723,11 +731,11 @@ END |
delimiter ;| delimiter ;|
select ROUTINE_NAME from routines; select ROUTINE_NAME from routines;
# #
# Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema # Bug#10734 Grant of privileges other than 'select' and 'create view' should fail on schema
# #
--error 1044 --error ER_DBACCESS_DENIED_ERROR
grant all on information_schema.* to 'user1'@'localhost'; grant all on information_schema.* to 'user1'@'localhost';
--error 1044 --error ER_DBACCESS_DENIED_ERROR
grant select on information_schema.* to 'user1'@'localhost'; grant select on information_schema.* to 'user1'@'localhost';
# #
...@@ -753,9 +761,9 @@ where table_name="v1"; ...@@ -753,9 +761,9 @@ where table_name="v1";
drop view v1; drop view v1;
# #
# Bug #14387 SHOW COLUMNS doesn't work on temporary tables # Bug#14387 SHOW COLUMNS doesn't work on temporary tables
# Bug #15224 SHOW INDEX from temporary table doesn't work # Bug#15224 SHOW INDEX from temporary table doesn't work
# Bug #12770 DESC cannot display the info. about temporary table # Bug#12770 DESC cannot display the info. about temporary table
# #
create temporary table t1(f1 int, index(f1)); create temporary table t1(f1 int, index(f1));
show columns from t1; show columns from t1;
...@@ -839,6 +847,7 @@ connection con16681; ...@@ -839,6 +847,7 @@ connection con16681;
select * from information_schema.views select * from information_schema.views
where table_name='v1' or table_name='v2'; where table_name='v1' or table_name='v2';
connection default; connection default;
disconnect con16681;
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
...@@ -855,7 +864,7 @@ drop table t1,t2; ...@@ -855,7 +864,7 @@ drop table t1,t2;
# #
# Bug#20230: routine_definition is not null # Bug#20230 routine_definition is not null
# #
--disable_warnings --disable_warnings
DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p1;
...@@ -888,7 +897,7 @@ DROP PROCEDURE p1; ...@@ -888,7 +897,7 @@ DROP PROCEDURE p1;
DROP USER mysql_bug20230@localhost; DROP USER mysql_bug20230@localhost;
# #
# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA # Bug#18925 subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
# #
SELECT t.table_name, c1.column_name SELECT t.table_name, c1.column_name
...@@ -921,7 +930,7 @@ SELECT t.table_name, c1.column_name ...@@ -921,7 +930,7 @@ SELECT t.table_name, c1.column_name
); );
# #
# Bug#21231: query with a simple non-correlated subquery over # Bug#2123 query with a simple non-correlated subquery over
# INFORMARTION_SCHEMA.TABLES # INFORMARTION_SCHEMA.TABLES
# #
...@@ -931,7 +940,7 @@ SELECT table_name from information_schema.tables ...@@ -931,7 +940,7 @@ SELECT table_name from information_schema.tables
FROM information_schema.tables); FROM information_schema.tables);
# #
# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table" # Bug#23037 Bug in field "Default" of query "SHOW COLUMNS FROM table"
# #
# Note, MyISAM/InnoDB can't take more that 65532 chars, because the row # Note, MyISAM/InnoDB can't take more that 65532 chars, because the row
# size is limited to 65535 bytes (BLOBs not counted) # size is limited to 65535 bytes (BLOBs not counted)
...@@ -975,7 +984,7 @@ DROP FUNCTION get_value; ...@@ -975,7 +984,7 @@ DROP FUNCTION get_value;
# #
# Bug#22413: EXPLAIN SELECT FROM view with ORDER BY yield server crash # Bug#22413 EXPLAIN SELECT FROM view with ORDER BY yield server crash
# #
create view v1 as create view v1 as
select table_schema as object_schema, select table_schema as object_schema,
...@@ -1068,6 +1077,7 @@ show triggers; ...@@ -1068,6 +1077,7 @@ show triggers;
select trigger_name from information_schema.triggers select trigger_name from information_schema.triggers
where event_object_table='t1'; where event_object_table='t1';
connection default; connection default;
disconnect con27629;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
drop database mysqltest; drop database mysqltest;
...@@ -1111,13 +1121,13 @@ select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL; ...@@ -1111,13 +1121,13 @@ select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL;
# #
# Bug#30079 A check for "hidden" I_S tables is flawed # Bug#30079 A check for "hidden" I_S tables is flawed
# #
--error 1109 --error ER_UNKNOWN_TABLE
show fields from information_schema.table_names; show fields from information_schema.table_names;
--error 1109 --error ER_UNKNOWN_TABLE
show keys from information_schema.table_names; show keys from information_schema.table_names;
# #
# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY # Bug#34529 Crash on complex Falcon I_S select after ALTER .. PARTITION BY
# #
USE information_schema; USE information_schema;
SET max_heap_table_size = 16384; SET max_heap_table_size = 16384;
......
...@@ -379,6 +379,9 @@ revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; ...@@ -379,6 +379,9 @@ revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost; revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1'; delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest; drop database mysqltest;
connection default;
disconnect user1;
disconnect root;
# #
# multi delete wrong table check # multi delete wrong table check
...@@ -401,7 +404,7 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1; ...@@ -401,7 +404,7 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1; delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
drop table t1,t2; drop table t1,t2;
# Test for BUG#5837 - delete with outer join and const tables # Test for Bug#5837 delete with outer join and const tables
--disable_warnings --disable_warnings
create table t1 ( create table t1 (
aclid bigint not null primary key, aclid bigint not null primary key,
...@@ -418,7 +421,7 @@ delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; ...@@ -418,7 +421,7 @@ delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2; drop table t1, t2;
# #
# Bug#19225: unchecked error leads to server crash # Bug#19225 unchecked error leads to server crash
# #
create table t1(a int); create table t1(a int);
create table t2(a int); create table t2(a int);
...@@ -428,7 +431,7 @@ drop table t1, t2; ...@@ -428,7 +431,7 @@ drop table t1, t2;
# End of 4.1 tests # End of 4.1 tests
# #
# Test for bug #1980. # Test for Bug#1980.
# #
--disable_warnings --disable_warnings
create table t1 ( c char(8) not null ) engine=innodb; create table t1 ( c char(8) not null ) engine=innodb;
...@@ -484,9 +487,12 @@ send alter table t1 add column c int default 100 after a; ...@@ -484,9 +487,12 @@ send alter table t1 add column c int default 100 after a;
connect (updater,localhost,root,,test); connect (updater,localhost,root,,test);
connection updater; connection updater;
# Wait till "alter table t1 ..." is in work.
sleep 2;
send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a; send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
connection locker; connection locker;
# Wait till "update t1, v1 ..." is in work.
sleep 2; sleep 2;
unlock tables; unlock tables;
...@@ -500,6 +506,12 @@ select * from t2; ...@@ -500,6 +506,12 @@ select * from t2;
drop view v1; drop view v1;
drop table t1, t2; drop table t1, t2;
connection default;
disconnect locker;
disconnect changer;
disconnect updater;
# #
# Bug#27716 multi-update did partially and has not binlogged # Bug#27716 multi-update did partially and has not binlogged
# #
...@@ -536,11 +548,12 @@ reset master; ...@@ -536,11 +548,12 @@ reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be the UPDATE query event */; show master status /* there must be the UPDATE query event */;
# cleanup bug#27716 # cleanup
drop table t1, t2; drop table t1, t2;
# #
# Bug #29136 erred multi-delete on trans table does not rollback # Bug#29136 erred multi-delete on trans table does not rollback
# #
# prepare # prepare
...@@ -569,7 +582,7 @@ select count(*) from t3 /* must be 1 */; ...@@ -569,7 +582,7 @@ select count(*) from t3 /* must be 1 */;
# the query must be in binlog (no surprise though) # the query must be in binlog (no surprise though)
source include/show_binlog_events.inc; source include/show_binlog_events.inc;
# cleanup bug#29136 # cleanup
drop table t1, t2, t3; drop table t1, t2, t3;
......
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connection con1; connection con1;
-- error 1064,1102,1280 --error ER_PARSE_ERROR,ER_WRONG_DB_NAME,ER_WRONG_NAME_FOR_INDEX
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
connection default;
disconnect con1;
# End of 4.1 tests # End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
...@@ -4,12 +4,18 @@ ...@@ -4,12 +4,18 @@
# swallowing them and returning an error # swallowing them and returning an error
--source include/not_windows.inc --source include/not_windows.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Check protocol handling # Check protocol handling
# #
connect (con1,localhost,root,,); set @max_allowed_packet=@@global.max_allowed_packet;
set @net_buffer_length=@@global.net_buffer_length;
connect (con1,localhost,root,,);
connection con1; connection con1;
set global max_allowed_packet=100; set global max_allowed_packet=100;
set max_allowed_packet=100; set max_allowed_packet=100;
...@@ -19,6 +25,8 @@ set net_buffer_length=100; ...@@ -19,6 +25,8 @@ set net_buffer_length=100;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
# Should return NULL as 2000 is bigger than max_allowed_packet # Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000); select repeat('a',2000);
connection default;
disconnect con1;
# #
# Connection 2 should get error for too big packets # Connection 2 should get error for too big packets
...@@ -26,7 +34,7 @@ select repeat('a',2000); ...@@ -26,7 +34,7 @@ select repeat('a',2000);
connect (con2,localhost,root,,); connect (con2,localhost,root,,);
connection con2; connection con2;
select @@net_buffer_length, @@max_allowed_packet; select @@net_buffer_length, @@max_allowed_packet;
--error 1153 --error ER_NET_PACKET_TOO_LARGE
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
set global max_allowed_packet=default; set global max_allowed_packet=default;
set max_allowed_packet=default; set max_allowed_packet=default;
...@@ -34,5 +42,13 @@ set global net_buffer_length=default; ...@@ -34,5 +42,13 @@ set global net_buffer_length=default;
set net_buffer_length=default; set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000)); select length(repeat('a',2000));
connection default;
disconnect con2;
set global max_allowed_packet=@max_allowed_packet;
set global net_buffer_length=@net_buffer_length;
# End of 4.1 tests # End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
-- source include/have_query_cache.inc -- source include/have_query_cache.inc
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Tests with query cache # Tests with query cache
# #
...@@ -79,7 +83,7 @@ show status like "Qcache_free_blocks"; ...@@ -79,7 +83,7 @@ show status like "Qcache_free_blocks";
drop table t1, t2, t3, t11, t21; drop table t1, t2, t3, t11, t21;
# #
# do not use QC if tables locked (BUG#12385) # do not use QC if tables locked (Bug#12385)
# #
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root; connection root;
...@@ -96,10 +100,13 @@ SELECT * FROM t1; ...@@ -96,10 +100,13 @@ SELECT * FROM t1;
connection root; connection root;
SELECT * FROM t1; SELECT * FROM t1;
drop table t1; drop table t1;
connection default;
disconnect root;
disconnect root2;
# #
# query in QC from normal execution and SP (BUG#6897) # query in QC from normal execution and SP (Bug#6897)
# improved to also test BUG#3583 and BUG#12990 # improved to also test Bug#3583 and Bug#12990
# #
flush query cache; flush query cache;
reset query cache; reset query cache;
...@@ -181,7 +188,7 @@ drop procedure f4; ...@@ -181,7 +188,7 @@ drop procedure f4;
drop table t1; drop table t1;
# #
# bug#14767: INSERT in SF + concurrent SELECT with query cache # Bug#14767 INSERT in SF + concurrent SELECT with query cache
# #
reset query cache; reset query cache;
--disable_warnings --disable_warnings
...@@ -223,4 +230,36 @@ connection default; ...@@ -223,4 +230,36 @@ connection default;
set GLOBAL query_cache_size=0; set GLOBAL query_cache_size=0;
#
# Bug#40264: Aborted cached query causes query to hang indefinitely on next cache hit
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
FLUSH STATUS;
SET GLOBAL query_cache_size=1048576;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SHOW STATUS LIKE 'Qcache_queries_in_cache';
LOCK TABLES t1 WRITE;
connect(con1,localhost,root,,);
--send SELECT * FROM t1
connection default;
let $show_type= open tables where `table`='t1' and in_use=2;
let $show_pattern= '%t1%2%';
--source include/wait_show_pattern.inc
dirty_close con1;
UNLOCK TABLES;
let $show_type= open tables where `table`='t1' and in_use=0;
let $show_pattern= '%t1%0%';
--source include/wait_show_pattern.inc
SHOW STATUS LIKE 'Qcache_queries_in_cache';
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
# End of 5.0 tests # End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
#--source include/wait_until_count_sessions.inc
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
# except security/privilege tests, they go to sp-security.test # except security/privilege tests, they go to sp-security.test
# #
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,); connect (con1root,localhost,root,,);
connect (con2root,localhost,root,,); connect (con2root,localhost,root,,);
connect (con3root,localhost,root,,); connect (con3root,localhost,root,,);
...@@ -58,7 +61,7 @@ drop procedure bug4934; ...@@ -58,7 +61,7 @@ drop procedure bug4934;
# #
# BUG #9486 "Can't perform multi-update in stored procedure" # Bug#9486 Can't perform multi-update in stored procedure
# #
--disable_warnings --disable_warnings
drop procedure if exists bug9486; drop procedure if exists bug9486;
...@@ -87,8 +90,9 @@ reap; ...@@ -87,8 +90,9 @@ reap;
drop procedure bug9486; drop procedure bug9486;
drop table t1, t2; drop table t1, t2;
# #
# BUG#11158: Can't perform multi-delete in stored procedure # Bug#11158 Can't perform multi-delete in stored procedure
# #
--disable_warnings --disable_warnings
drop procedure if exists bug11158; drop procedure if exists bug11158;
...@@ -114,8 +118,9 @@ connection con1root; ...@@ -114,8 +118,9 @@ connection con1root;
drop procedure bug11158; drop procedure bug11158;
drop table t1, t2; drop table t1, t2;
# #
# BUG#11554: Server crashes on statement indirectly using non-cached function # Bug#11554 Server crashes on statement indirectly using non-cached function
# #
--disable_warnings --disable_warnings
drop function if exists bug11554; drop function if exists bug11554;
...@@ -134,7 +139,7 @@ drop table t1; ...@@ -134,7 +139,7 @@ drop table t1;
drop view v1; drop view v1;
# BUG#12228 # Bug#12228 Crash happens during calling specific SP in multithread environment
--disable_warnings --disable_warnings
drop procedure if exists p1; drop procedure if exists p1;
drop procedure if exists p2; drop procedure if exists p2;
...@@ -168,18 +173,26 @@ connection con2root; ...@@ -168,18 +173,26 @@ connection con2root;
unlock tables; unlock tables;
connection con1root; connection con1root;
# Crash will be here if we hit BUG#12228 # Crash will be here if we hit Bug#12228
reap; reap;
drop procedure p1; drop procedure p1;
drop procedure p2; drop procedure p2;
drop table t1; drop table t1;
# #
# BUG#NNNN: New bug synopsis # Bug#NNNN New bug synopsis
# #
#--disable_warnings #--disable_warnings
#drop procedure if exists bugNNNN; #drop procedure if exists bugNNNN;
#--enable_warnings #--enable_warnings
#create procedure bugNNNN... #create procedure bugNNNN...
connection default;
disconnect con1root;
disconnect con2root;
disconnect con3root;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
...@@ -1035,8 +1035,9 @@ INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5); ...@@ -1035,8 +1035,9 @@ INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100; SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug 2198 # Bug#2198 SELECT INTO OUTFILE (with Sub-Select) Problem
# #
create table t1 (a int, b decimal(13, 3)); create table t1 (a int, b decimal(13, 3));
...@@ -1051,8 +1052,9 @@ load data infile "subselect.out.file.1" into table t1; ...@@ -1051,8 +1052,9 @@ load data infile "subselect.out.file.1" into table t1;
select * from t1; select * from t1;
drop table t1; drop table t1;
# #
# Bug 2479 # Bug#2479 dependant subquery with limit crash
# #
CREATE TABLE `t1` ( CREATE TABLE `t1` (
...@@ -1090,8 +1092,9 @@ select 2 in (select * from t1); ...@@ -1090,8 +1092,9 @@ select 2 in (select * from t1);
SET SQL_SELECT_LIMIT=default; SET SQL_SELECT_LIMIT=default;
drop table t1; drop table t1;
# #
# Bug #3118: subselect + order by # Bug#3118 subselect + order by
# #
CREATE TABLE t1 (a int, b int, INDEX (a)); CREATE TABLE t1 (a int, b int, INDEX (a));
...@@ -1130,8 +1133,9 @@ insert into t1 values (1); ...@@ -1130,8 +1133,9 @@ insert into t1 values (1);
explain select benchmark(1000, (select a from t1 where a=sha(rand()))); explain select benchmark(1000, (select a from t1 where a=sha(rand())));
drop table t1; drop table t1;
# #
# bug 3188 # Bug#3188 Ambiguous Column in Subselect crashes server
# #
create table t1(id int); create table t1(id int);
create table t2(id int); create table t2(id int);
...@@ -1140,8 +1144,9 @@ create table t3(flag int); ...@@ -1140,8 +1144,9 @@ create table t3(flag int);
select (select * from t3 where id not null) from t1, t2; select (select * from t3 where id not null) from t1, t2;
drop table t1,t2,t3; drop table t1,t2,t3;
# #
# aggregate functions (Bug #3505) # aggregate functions (Bug#3505 Wrong results on use of ORDER BY with subqueries)
# #
CREATE TABLE t1 (id INT); CREATE TABLE t1 (id INT);
CREATE TABLE t2 (id INT); CREATE TABLE t2 (id INT);
...@@ -1332,8 +1337,9 @@ select * from t1 up where exists (select * from t1 where t1.a=up.a); ...@@ -1332,8 +1337,9 @@ select * from t1 up where exists (select * from t1 where t1.a=up.a);
explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a); explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
drop table t1; drop table t1;
# #
# Bug #4102: subselect in HAVING # Bug#4102 subselect in HAVING
# #
CREATE TABLE t1 (t1_a int); CREATE TABLE t1 (t1_a int);
...@@ -1344,8 +1350,10 @@ SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1 ...@@ -1344,8 +1350,10 @@ SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1
HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a); HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a);
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Test problem with NULL and derived tables (Bug #4097) # Test problem with NULL and derived tables
# (Bug#4097 JOIN with subquery causes entire column to report NULL)
# #
CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL); CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL);
...@@ -1355,6 +1363,7 @@ INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix'); ...@@ -1355,6 +1363,7 @@ INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix');
SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id; SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id;
drop table t1,t2; drop table t1,t2;
# #
# outer fields resolving in INSERT/REPLACE and CRETE with SELECT # outer fields resolving in INSERT/REPLACE and CRETE with SELECT
# #
...@@ -1390,8 +1399,9 @@ insert into t2 values (1,2); ...@@ -1390,8 +1399,9 @@ insert into t2 values (1,2);
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1); select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
drop table t1,t2; drop table t1,t2;
# #
# BUG#4769 - fulltext in subselect # Bug#4769 - fulltext in subselect
# #
create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b)); create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan'); insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
...@@ -1401,8 +1411,9 @@ select a,b from t1 where match(b) against ('Ball') > 0; ...@@ -1401,8 +1411,9 @@ select a,b from t1 where match(b) against ('Ball') > 0;
select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0); select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
drop table t1,t2; drop table t1,t2;
# #
# BUG#5003 - like in subselect # Bug#5003 - like in subselect
# #
CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin); CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel); CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
...@@ -1459,10 +1470,10 @@ SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.s ...@@ -1459,10 +1470,10 @@ SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.s
SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b; SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
drop tables t1,t2; drop tables t1,t2;
# #
# Test for bug #6462. "Same request on same data returns different # Test for Bug#6462 Same request on same data returns different results
# results." a.k.a. "Proper cleanup of subqueries is missing for # a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements".
# SET and DO statements".
# #
create table t1 (a int not null, b int not null, c int, primary key (a,b)); create table t1 (a int not null, b int not null, c int, primary key (a,b));
insert into t1 values (1,1,1), (2,2,2), (3,3,3); insert into t1 values (1,1,1), (2,2,2), (3,3,3);
...@@ -1484,9 +1495,11 @@ drop table t1; ...@@ -1484,9 +1495,11 @@ drop table t1;
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root; connection root;
set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ; set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
connection default;
disconnect root;
# #
# primary query with temporary table and subquery with groupping # primary query with temporary table and subquery with grouping
# #
create table t1 (a int, b int); create table t1 (a int, b int);
create table t2 (a int, b int); create table t2 (a int, b int);
...@@ -1552,8 +1565,9 @@ SELECT DISTINCT Continent AS c FROM t1 outr WHERE ...@@ -1552,8 +1565,9 @@ SELECT DISTINCT Continent AS c FROM t1 outr WHERE
Population < 200); Population < 200);
drop table t1; drop table t1;
# #
# Test for BUG#7885: Server crash when 'any' subselect compared to # Test for Bug#7885 Server crash when 'any' subselect compared to
# non-existant field. # non-existant field.
# #
create table t1 (a1 int); create table t1 (a1 int);
...@@ -1603,8 +1617,9 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx; ...@@ -1603,8 +1617,9 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL; select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
drop table t1; drop table t1;
# #
# Test for BUG#8218 # Test for Bug#8218 Join does not pass string from right table
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
categoryId int(11) NOT NULL, categoryId int(11) NOT NULL,
...@@ -1704,8 +1719,9 @@ group by ...@@ -1704,8 +1719,9 @@ group by
drop table t1, t2, t3, t4, t5; drop table t1, t2, t3, t4, t5;
# #
# Transformation in left expression of subquery (BUG#8888) # Transformation in left expression of subquery (Bug#8888)
# #
create table t1 (a int); create table t1 (a int);
insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3);
...@@ -1750,8 +1766,9 @@ select (1,2,3) = (select * from t1); ...@@ -1750,8 +1766,9 @@ select (1,2,3) = (select * from t1);
select (select * from t1) = (1,2,3); select (select * from t1) = (1,2,3);
drop table t1; drop table t1;
# #
# Item_int_with_ref check (BUG#10020) # Item_int_with_ref check (Bug#10020)
# #
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment, `itemid` bigint(20) unsigned NOT NULL auto_increment,
...@@ -1774,15 +1791,16 @@ INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1'); ...@@ -1774,15 +1791,16 @@ INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30; SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2; drop tables t1,t2;
# BUG#11821 : Select from subselect using aggregate function on an enum
# segfaults: # Bug#11821 Select from subselect using aggregate function on an enum segfaults
create table t1 (fld enum('0','1')); create table t1 (fld enum('0','1'));
insert into t1 values ('1'); insert into t1 values ('1');
select * from (select max(fld) from t1) as foo; select * from (select max(fld) from t1) as foo;
drop table t1; drop table t1;
# #
# Bug #11867: queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...) # Bug#11867 queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...)
# #
CREATE TABLE t1 (one int, two int, flag char(1)); CREATE TABLE t1 (one int, two int, flag char(1));
...@@ -1812,8 +1830,9 @@ explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FR ...@@ -1812,8 +1830,9 @@ explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FR
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #12392: where cond with IN predicate for rows and NULL values in table # Bug#12392 where cond with IN predicate for rows and NULL values in table
# #
CREATE TABLE t1 (a char(5), b char(5)); CREATE TABLE t1 (a char(5), b char(5));
...@@ -1823,8 +1842,9 @@ SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb')); ...@@ -1823,8 +1842,9 @@ SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #11479: subquery over left join with an empty inner table # Bug#11479 subquery over left join with an empty inner table
# #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
...@@ -1841,8 +1861,9 @@ SELECT * FROM t1 ...@@ -1841,8 +1861,9 @@ SELECT * FROM t1
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #
# Bug#18503: Queries with a quantified subquery returning empty set may # Bug#18503 Queries with a quantified subquery returning empty set may
# return a wrong result. # return a wrong result.
# #
CREATE TABLE t1 (f1 INT); CREATE TABLE t1 (f1 INT);
...@@ -1855,8 +1876,9 @@ INSERT INTO t2 VALUES (2); ...@@ -1855,8 +1876,9 @@ INSERT INTO t2 VALUES (2);
SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0);
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug#16302: Quantified subquery without any tables gives wrong results # Bug#16302 Quantified subquery without any tables gives wrong results
# #
select 1 from dual where 1 < any (select 2); select 1 from dual where 1 < any (select 2);
select 1 from dual where 1 < all (select 2); select 1 from dual where 1 < all (select 2);
...@@ -1865,7 +1887,8 @@ select 1 from dual where 2 > all (select 1); ...@@ -1865,7 +1887,8 @@ select 1 from dual where 2 > all (select 1);
select 1 from dual where 1 < any (select 2 from dual); select 1 from dual where 1 < any (select 2 from dual);
select 1 from dual where 1 < all (select 2 from dual where 1!=1); select 1 from dual where 1 < all (select 2 from dual where 1!=1);
# BUG#20975 Wrong query results for subqueries within NOT
# Bug#20975 Wrong query results for subqueries within NOT
create table t1 (s1 char); create table t1 (s1 char);
insert into t1 values (1),(2); insert into t1 values (1),(2);
...@@ -1882,8 +1905,9 @@ select * from t1 where (s1 = ALL (select s1/s1 from t1)); ...@@ -1882,8 +1905,9 @@ select * from t1 where (s1 = ALL (select s1/s1 from t1));
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1)); select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
drop table t1; drop table t1;
# #
# Bug #16255: Subquery in where # Bug#16255 Subquery in where
# #
create table t1 ( create table t1 (
retailerID varchar(8) NOT NULL, retailerID varchar(8) NOT NULL,
...@@ -1905,8 +1929,9 @@ select * from t1 r1 ...@@ -1905,8 +1929,9 @@ select * from t1 r1
group by r2.retailerId); group by r2.retailerId);
drop table t1; drop table t1;
# #
# Bug #21180: Subselect with index for both WHERE and ORDER BY # Bug#21180 Subselect with index for both WHERE and ORDER BY
# produces empty result # produces empty result
# #
create table t1(a int, primary key (a)); create table t1(a int, primary key (a));
...@@ -1931,8 +1956,9 @@ SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ...@@ -1931,8 +1956,9 @@ SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
drop table t1,t2; drop table t1,t2;
# #
# Bug #21853: assert failure for a grouping query with # Bug#21853 assert failure for a grouping query with
# an ALL/ANY quantified subquery in HAVING # an ALL/ANY quantified subquery in HAVING
# #
...@@ -1968,8 +1994,9 @@ SELECT field1, field2 ...@@ -1968,8 +1994,9 @@ SELECT field1, field2
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug #23478: not top-level IN subquery returning a non-empty result set # Bug#23478 not top-level IN subquery returning a non-empty result set
# with possible NULL values by index access from the outer query # with possible NULL values by index access from the outer query
# #
...@@ -1985,8 +2012,9 @@ SELECT a, a IN (SELECT a FROM t1) FROM t2; ...@@ -1985,8 +2012,9 @@ SELECT a, a IN (SELECT a FROM t1) FROM t2;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #11302: getObject() returns a String for a sub-query of type datetime # Bug#11302 getObject() returns a String for a sub-query of type datetime
# #
CREATE TABLE t1 (a DATETIME); CREATE TABLE t1 (a DATETIME);
INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25'); INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
...@@ -2001,8 +2029,9 @@ SHOW CREATE TABLE t3; ...@@ -2001,8 +2029,9 @@ SHOW CREATE TABLE t3;
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #
# Bug 24670: subquery witout tables but with a WHERE clause # Bug24670 subquery witout tables but with a WHERE clause
# #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
...@@ -2014,8 +2043,9 @@ EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL; ...@@ -2014,8 +2043,9 @@ EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug 24653: sorting by expressions containing subselects # Bug#24653 sorting by expressions containing subselects
# that return more than one row # that return more than one row
# #
...@@ -2099,8 +2129,9 @@ select * from t1; ...@@ -2099,8 +2129,9 @@ select * from t1;
select min(a) from t1 group by grp; select min(a) from t1 group by grp;
drop table t1; drop table t1;
# #
# Test for bug #9338: lame substitution of c1 instead of c2 # Test for Bug#9338 lame substitution of c1 instead of c2
# #
CREATE table t1 ( c1 integer ); CREATE table t1 ( c1 integer );
...@@ -2120,8 +2151,9 @@ SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2 ...@@ -2120,8 +2151,9 @@ SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Test for bug #9516: wrong evaluation of not_null_tables attribute in SQ # Test for Bug#9516 wrong evaluation of not_null_tables attribute in SQ
# #
CREATE TABLE t1 ( c1 integer ); CREATE TABLE t1 ( c1 integer );
INSERT INTO t1 VALUES ( 1 ); INSERT INTO t1 VALUES ( 1 );
...@@ -2144,8 +2176,9 @@ SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2 ...@@ -2144,8 +2176,9 @@ SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #
# Item_int_with_ref check (BUG#10020) # Item_int_with_ref check (Bug#10020)
# #
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment, `itemid` bigint(20) unsigned NOT NULL auto_increment,
...@@ -2168,9 +2201,10 @@ INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1'); ...@@ -2168,9 +2201,10 @@ INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30; SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2; drop tables t1,t2;
# #
# Correct building of equal fields list (do not include outer # Correct building of equal fields list (do not include outer
# fields) (BUG#6384) # fields) (Bug#6384)
# #
CREATE TABLE t1 (EMPNUM CHAR(3)); CREATE TABLE t1 (EMPNUM CHAR(3));
CREATE TABLE t2 (EMPNUM CHAR(3) ); CREATE TABLE t2 (EMPNUM CHAR(3) );
...@@ -2184,8 +2218,9 @@ WHERE t1.EMPNUM NOT IN ...@@ -2184,8 +2218,9 @@ WHERE t1.EMPNUM NOT IN
select * from t1; select * from t1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Test for bug #11487: range access in a subquery # Test for Bug#11487 range access in a subquery
# #
CREATE TABLE t1(select_id BIGINT, values_id BIGINT); CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
...@@ -2206,15 +2241,16 @@ WHERE values_id IN (SELECT values_id FROM t2 ...@@ -2206,15 +2241,16 @@ WHERE values_id IN (SELECT values_id FROM t2
DROP TABLE t1, t2; DROP TABLE t1, t2;
# BUG#11821 : Select from subselect using aggregate function on an enum
# segfaults: # Bug#11821 Select from subselect using aggregate function on an enum segfaults
create table t1 (fld enum('0','1')); create table t1 (fld enum('0','1'));
insert into t1 values ('1'); insert into t1 values ('1');
select * from (select max(fld) from t1) as foo; select * from (select max(fld) from t1) as foo;
drop table t1; drop table t1;
# #
# Test for bug #11762: subquery with an aggregate function in HAVING # Test for Bug#11762 subquery with an aggregate function in HAVING
# #
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
...@@ -2297,8 +2333,9 @@ SELECT t1.a, SUM(b) AS sum FROM t1 GROUP BY t1.a ...@@ -2297,8 +2333,9 @@ SELECT t1.a, SUM(b) AS sum FROM t1 GROUP BY t1.a
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #
# Test for bug #16603: GROUP BY in a row subquery with a quantifier # Test for Bug#16603 GROUP BY in a row subquery with a quantifier
# when an index is defined on the grouping field # when an index is defined on the grouping field
CREATE TABLE t1 (a varchar(5), b varchar(10)); CREATE TABLE t1 (a varchar(5), b varchar(10));
...@@ -2318,16 +2355,18 @@ SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a); ...@@ -2318,16 +2355,18 @@ SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#17366: Unchecked Item_int results in server crash # Bug#17366 Unchecked Item_int results in server crash
# #
create table t1( f1 int,f2 int); create table t1( f1 int,f2 int);
insert into t1 values (1,1),(2,2); insert into t1 values (1,1),(2,2);
select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1'; select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
drop table t1; drop table t1;
# #
# Bug #18306: server crash on delete using subquery. # Bug#18306 server crash on delete using subquery.
# #
create table t1 (c int, key(c)); create table t1 (c int, key(c));
...@@ -2337,8 +2376,9 @@ insert into t2 values (2, 1), (1, 0); ...@@ -2337,8 +2376,9 @@ insert into t2 values (2, 1), (1, 0);
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1; delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
drop table t1, t2; drop table t1, t2;
# #
# Bug #7549: Missing error message for invalid view selection with subquery # Bug#7549 Missing error message for invalid view selection with subquery
# #
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
...@@ -2352,16 +2392,18 @@ SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1); ...@@ -2352,16 +2392,18 @@ SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#19077: A nested materialized derived table is used before being populated. # Bug#19077 A nested materialized derived table is used before being populated.
# #
create table t1 (i int, j bigint); create table t1 (i int, j bigint);
insert into t1 values (1, 2), (2, 2), (3, 2); insert into t1 values (1, 2), (2, 2), (3, 2);
select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3; select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
drop table t1; drop table t1;
# #
# Bug#19700: subselect returning BIGINT always returned it as SIGNED # Bug#19700 subselect returning BIGINT always returned it as SIGNED
# #
CREATE TABLE t1 (i BIGINT UNSIGNED); CREATE TABLE t1 (i BIGINT UNSIGNED);
INSERT INTO t1 VALUES (10000000000000000000); # > MAX SIGNED BIGINT 9323372036854775807 INSERT INTO t1 VALUES (10000000000000000000); # > MAX SIGNED BIGINT 9323372036854775807
...@@ -2383,8 +2425,9 @@ SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED); ...@@ -2383,8 +2425,9 @@ SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
# #
# Bug#20519: subselect with LIMIT M, N # Bug#20519 subselect with LIMIT M, N
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -2423,8 +2466,9 @@ SELECT *, ...@@ -2423,8 +2466,9 @@ SELECT *,
FROM t1; FROM t1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug#20869: subselect with range access by DESC # Bug#20869 subselect with range access by DESC
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -2461,9 +2505,9 @@ SELECT * FROM t1,t2 ...@@ -2461,9 +2505,9 @@ SELECT * FROM t1,t2
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug#14654 : Cannot select from the same table twice within a UNION # Bug#14654 Cannot select from the same table twice within a UNION statement
# statement
# #
CREATE TABLE t1 (i INT); CREATE TABLE t1 (i INT);
...@@ -2493,8 +2537,9 @@ explain select * from t1 where not exists ...@@ -2493,8 +2537,9 @@ explain select * from t1 where not exists
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#21798: memory leak during query execution with subquery in column # Bug#21798 memory leak during query execution with subquery in column
# list using a function # list using a function
# #
CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b)); CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
...@@ -2519,8 +2564,9 @@ SELECT a, ...@@ -2519,8 +2564,9 @@ SELECT a,
FROM t1 ORDER BY a LIMIT 5; FROM t1 ORDER BY a LIMIT 5;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #21540: Subqueries with no from and aggregate functions return # Bug#21540 Subqueries with no from and aggregate functions return
# wrong results # wrong results
CREATE TABLE t1 (a INT, b INT); CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT); CREATE TABLE t2 (a INT);
...@@ -2550,8 +2596,9 @@ FROM t1 t2 ...@@ -2550,8 +2596,9 @@ FROM t1 t2
GROUP BY t2.a; GROUP BY t2.a;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #21727: Correlated subquery that requires filesort: # Bug#21727 Correlated subquery that requires filesort:
# slow with big sort_buffer_size # slow with big sort_buffer_size
# #
...@@ -2587,8 +2634,9 @@ SELECT SQL_NO_CACHE COUNT(*) ...@@ -2587,8 +2634,9 @@ SELECT SQL_NO_CACHE COUNT(*)
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #25219: EXIST subquery with UNION over a mix of # Bug#25219 EXIST subquery with UNION over a mix of
# correlated and uncorrelated selects # correlated and uncorrelated selects
# #
...@@ -2621,8 +2669,9 @@ SELECT * FROM t1 ...@@ -2621,8 +2669,9 @@ SELECT * FROM t1
DROP TABLE t1,t2,t3; DROP TABLE t1,t2,t3;
# #
# Bug#23800: Outer fields in correlated subqueries is used in a temporary # Bug#23800 Outer fields in correlated subqueries is used in a temporary
# table created for sorting. # table created for sorting.
# #
CREATE TABLE t1(f1 int); CREATE TABLE t1(f1 int);
...@@ -2649,6 +2698,7 @@ SELECT a, MAX(b), ...@@ -2649,6 +2698,7 @@ SELECT a, MAX(b),
FROM t1 GROUP BY a; FROM t1 GROUP BY a;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#21904 (parser problem when using IN with a double "(())") # Bug#21904 (parser problem when using IN with a double "(())")
# #
...@@ -2748,8 +2798,9 @@ DROP TABLE t1; ...@@ -2748,8 +2798,9 @@ DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1xt2; DROP TABLE t1xt2;
# #
# Bug #26728: derived table with concatanation of literals in select list # Bug#26728 derived table with concatanation of literals in select list
# #
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
...@@ -2760,8 +2811,9 @@ SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t; ...@@ -2760,8 +2811,9 @@ SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
DROP table t1; DROP table t1;
# #
# Bug #27257: COUNT(*) aggregated in outer query # Bug#27257 COUNT(*) aggregated in outer query
# #
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
...@@ -2783,8 +2835,9 @@ SELECT COUNT(*), a ...@@ -2783,8 +2835,9 @@ SELECT COUNT(*), a
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #27229: GROUP_CONCAT in subselect with COUNT() as an argument # Bug#27229 GROUP_CONCAT in subselect with COUNT() as an argument
# #
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
...@@ -2802,8 +2855,9 @@ SELECT COUNT(*) c, a, ...@@ -2802,8 +2855,9 @@ SELECT COUNT(*) c, a,
DROP table t1,t2; DROP table t1,t2;
# #
# Bug#27321: Wrong subquery result in a grouping select # Bug#27321 Wrong subquery result in a grouping select
# #
CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b)); CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'), INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
...@@ -2838,8 +2892,10 @@ SELECT tt.a, MAX( ...@@ -2838,8 +2892,10 @@ SELECT tt.a, MAX(
FROM t1 as tt GROUP BY tt.a; FROM t1 as tt GROUP BY tt.a;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #27348: SET FUNCTION used in a subquery from WHERE condition # Bug#27348 SET FUNCTION used in a subquery from WHERE condition
# #
CREATE TABLE t1 (a int, b int); CREATE TABLE t1 (a int, b int);
...@@ -2865,9 +2921,9 @@ SET @@sql_mode=default; ...@@ -2865,9 +2921,9 @@ SET @@sql_mode=default;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #27363: nested aggregates in outer, subquery / sum(select # Bug#27363 nested aggregates in outer, subquery / sum(select count(outer))
# count(outer))
# #
CREATE TABLE t1 (a INT); INSERT INTO t1 values (1),(1),(1),(1); CREATE TABLE t1 (a INT); INSERT INTO t1 values (1),(1),(1),(1);
CREATE TABLE t2 (x INT); INSERT INTO t1 values (1000),(1001),(1002); CREATE TABLE t2 (x INT); INSERT INTO t1 values (1000),(1001),(1002);
...@@ -2893,16 +2949,18 @@ FROM t1; ...@@ -2893,16 +2949,18 @@ FROM t1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #27807: Server crash when executing subquery with EXPLAIN # Bug#27807 Server crash when executing subquery with EXPLAIN
# #
CREATE TABLE t1 (a int, b int, KEY (a)); CREATE TABLE t1 (a int, b int, KEY (a));
INSERT INTO t1 VALUES (1,1),(2,1); INSERT INTO t1 VALUES (1,1),(2,1);
EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #28377: grouping query with a correlated subquery in WHERE condition # Bug#28377 grouping query with a correlated subquery in WHERE condition
# #
CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
...@@ -2925,8 +2983,9 @@ SELECT id, st FROM t1 ...@@ -2925,8 +2983,9 @@ SELECT id, st FROM t1
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #28728: crash with EXPLAIN EXTENDED for a query with a derived table # Bug#28728 crash with EXPLAIN EXTENDED for a query with a derived table
# over a grouping subselect # over a grouping subselect
# #
...@@ -2939,8 +2998,9 @@ SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res; ...@@ -2939,8 +2998,9 @@ SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #28811: crash for query containing subquery with ORDER BY and LIMIT 1 # Bug#28811 crash for query containing subquery with ORDER BY and LIMIT 1
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
...@@ -2973,7 +3033,7 @@ DROP TABLE t1,t2; ...@@ -2973,7 +3033,7 @@ DROP TABLE t1,t2;
# #
# Bug #27333: subquery grouped for aggregate of outer query / no aggregate # Bug#27333 subquery grouped for aggregate of outer query / no aggregate
# of subquery # of subquery
# #
CREATE TABLE t1 (a INTEGER, b INTEGER); CREATE TABLE t1 (a INTEGER, b INTEGER);
...@@ -3013,8 +3073,9 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1; ...@@ -3013,8 +3073,9 @@ SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1; SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug31048: Many nested subqueries may cause server crash. # Bug31048 Many nested subqueries may cause server crash.
# #
create table t1(a int,b int,key(a),key(b)); create table t1(a int,b int,key(a),key(b));
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5), insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
...@@ -3059,8 +3120,9 @@ while ($nesting) ...@@ -3059,8 +3120,9 @@ while ($nesting)
--enable_query_log --enable_query_log
drop table t1; drop table t1;
# #
# Bug #31884: Assertion + crash in subquery in the SELECT clause. # Bug#31884 Assertion + crash in subquery in the SELECT clause.
# #
CREATE TABLE t1 (a1 INT, a2 INT); CREATE TABLE t1 (a1 INT, a2 INT);
...@@ -3075,7 +3137,7 @@ SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1; ...@@ -3075,7 +3137,7 @@ SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug #28076: inconsistent binary/varbinary comparison # Bug#28076 inconsistent binary/varbinary comparison
# #
CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5)); CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
...@@ -3116,8 +3178,9 @@ SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3; ...@@ -3116,8 +3178,9 @@ SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3;
SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3); SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3);
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
# #
# Bug #30788: Inconsistent retrieval of char/varchar # Bug#30788 Inconsistent retrieval of char/varchar
# #
CREATE TABLE t1 (a CHAR(1), b VARCHAR(10)); CREATE TABLE t1 (a CHAR(1), b VARCHAR(10));
...@@ -3141,9 +3204,9 @@ SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500); ...@@ -3141,9 +3204,9 @@ SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug #32400: Complex SELECT query returns correct result only on some # Bug#32400 Complex SELECT query returns correct result only on some occasions
# occasions
# #
CREATE TABLE t1(a INT, b INT); CREATE TABLE t1(a INT, b INT);
...@@ -3171,8 +3234,9 @@ GROUP BY a; ...@@ -3171,8 +3234,9 @@ GROUP BY a;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #32036: EXISTS within a WHERE clause with a UNION crashes MySQL 5.122 # Bug#32036 EXISTS within a WHERE clause with a UNION crashes MySQL 5.122
# #
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
...@@ -3196,7 +3260,7 @@ DROP TABLE t1,t2; ...@@ -3196,7 +3260,7 @@ DROP TABLE t1,t2;
# #
# Bug#33675: Usage of an uninitialized memory by filesort in a subquery # Bug#33675 Usage of an uninitialized memory by filesort in a subquery
# caused server crash. # caused server crash.
# #
create table t1(f11 int, f12 int); create table t1(f11 int, f12 int);
...@@ -3218,8 +3282,9 @@ select count(*) from t1 where f12 = ...@@ -3218,8 +3282,9 @@ select count(*) from t1 where f12 =
drop table t1,t2; drop table t1,t2;
# #
# BUG#33794 "MySQL crashes executing specific query on specific dump" # Bug#33794 "MySQL crashes executing specific query on specific dump"
# #
CREATE TABLE t4 ( CREATE TABLE t4 (
f7 varchar(32) collate utf8_bin NOT NULL default '', f7 varchar(32) collate utf8_bin NOT NULL default '',
...@@ -3272,8 +3337,9 @@ GROUP BY a4; ...@@ -3272,8 +3337,9 @@ GROUP BY a4;
DROP TABLE t1, t2, t3, t4; DROP TABLE t1, t2, t3, t4;
# #
# BUG#36139 "float, zerofill, crash with subquery" # Bug#36139 "float, zerofill, crash with subquery"
# #
create table t1 (a float(5,4) zerofill); create table t1 (a float(5,4) zerofill);
create table t2 (a float(5,4),b float(2,0)); create table t2 (a float(5,4),b float(2,0));
...@@ -3284,8 +3350,9 @@ select t1.a from t1 where ...@@ -3284,8 +3350,9 @@ select t1.a from t1 where
drop table t1, t2; drop table t1, t2;
# #
# Bug #36011: Server crash with explain extended on query with dependent # Bug#36011 Server crash with explain extended on query with dependent
# subqueries # subqueries
# #
...@@ -3295,8 +3362,9 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a); ...@@ -3295,8 +3362,9 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a); EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
DROP TABLE t1; DROP TABLE t1;
# #
# Bug #38191: Server crash with subquery containing DISTINCT and ORDER BY # Bug#38191 Server crash with subquery containing DISTINCT and ORDER BY
# #
CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a)); CREATE TABLE t1(pk int PRIMARY KEY, a int, INDEX idx(a));
...@@ -3307,6 +3375,7 @@ SELECT * FROM t1 ...@@ -3307,6 +3375,7 @@ SELECT * FROM t1
WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b); WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
# Bug#20835 (literal string with =any values) # Bug#20835 (literal string with =any values)
# #
...@@ -3315,6 +3384,7 @@ INSERT INTO t1 VALUES ('a'); ...@@ -3315,6 +3384,7 @@ INSERT INTO t1 VALUES ('a');
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1); SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#40519 Subselect query using bigint fails # Bug#40519 Subselect query using bigint fails
# #
...@@ -3325,6 +3395,7 @@ INSERT INTO t2 VALUES (2,1),(3,1); ...@@ -3325,6 +3395,7 @@ INSERT INTO t2 VALUES (2,1),(3,1);
SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1); SELECT * FROM t1 i WHERE 1 IN (SELECT l.id2 FROM t2 l WHERE i.id=l.id1);
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug#37460 Assertion failed: # Bug#37460 Assertion failed:
# !table->file || table->file->inited == handler::NONE # !table->file || table->file->inited == handler::NONE
...@@ -3346,7 +3417,7 @@ CREATE VIEW v2 (a,b) AS ...@@ -3346,7 +3417,7 @@ CREATE VIEW v2 (a,b) AS
SELECT t2.id, t2.c AS c FROM t1, t2 SELECT t2.id, t2.c AS c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION; WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
--error 1369 --error ER_VIEW_CHECK_FAILED
INSERT INTO v2(a,b) VALUES (2,2); INSERT INTO v2(a,b) VALUES (2,2);
INSERT INTO v2(a,b) VALUES (1,2); INSERT INTO v2(a,b) VALUES (1,2);
SELECT * FROM v1; SELECT * FROM v1;
......
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# #
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination # Test for Bug#2385 CREATE TABLE LIKE lacks locking on source and destination
# table # table
# #
--disable_warnings --disable_warnings
drop table if exists t1; DROP TABLE IF EXISTS t1,t2;
--enable_warnings --enable_warnings
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
...@@ -12,12 +15,12 @@ connect (con2,localhost,root,,); ...@@ -12,12 +15,12 @@ connect (con2,localhost,root,,);
# locking of source: # locking of source:
CREATE TABLE t1 (x1 int); CREATE TABLE t1 (x1 INT);
let $1= 10; let $1= 10;
while ($1) while ($1)
{ {
connection con1; connection con1;
send ALTER TABLE t1 CHANGE x1 x2 int; send ALTER TABLE t1 CHANGE x1 x2 INT;
connection con2; connection con2;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx; replace_result x1 xx x2 xx;
...@@ -25,7 +28,7 @@ while ($1) ...@@ -25,7 +28,7 @@ while ($1)
DROP TABLE t2; DROP TABLE t2;
connection con1; connection con1;
reap; reap;
send ALTER TABLE t1 CHANGE x2 x1 int; send ALTER TABLE t1 CHANGE x2 x1 INT;
connection con2; connection con2;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx; replace_result x1 xx x2 xx;
...@@ -37,4 +40,11 @@ while ($1) ...@@ -37,4 +40,11 @@ while ($1)
} }
DROP TABLE t1; DROP TABLE t1;
connection default;
disconnect con1;
disconnect con2;
# End of 4.1 tests # End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
# Embedded server testing does not support grants # Embedded server testing does not support grants
-- source include/not_embedded.inc -- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings --disable_warnings
drop tables if exists t1, t2; drop tables if exists t1, t2;
drop view if exists v1; drop view if exists v1;
--enable_warnings --enable_warnings
# #
# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone # Test for Bug#6116 SET time_zone := ... requires access to mysql.time_zone tables
# tables". We should allow implicit access to time zone description tables # We should allow implicit access to time zone description tables even for
# even for unprivileged users. # unprivileged users.
# #
# Let us prepare playground # Let us prepare playground
...@@ -33,15 +36,17 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1; ...@@ -33,15 +36,17 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2); where t1.a = t2.c and t2.d = (select max(d) from t2);
# But still these two statements should not work: # But still these two statements should not work:
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
connection default;
disconnect tzuser;
# #
# Test for bug #6765 "Implicit access to time zone description tables # Bug#6765 Implicit access to time zone description tables requires privileges
# requires privileges for them if some table or column level grants # for them if some table or column level grants present
# present"
# #
connection default; connection default;
# Let use some table-level grants instead of db-level # Let use some table-level grants instead of db-level
...@@ -61,13 +66,13 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1; ...@@ -61,13 +66,13 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2); where t1.a = t2.c and t2.d = (select max(d) from t2);
# Again these two statements should not work (but with different errors): # Again these two statements should not work (but with different errors):
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
--error 1142 --error ER_TABLEACCESS_DENIED_ERROR
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
# #
# Bug #9979: Use of CONVERT_TZ in multiple-table UPDATE causes bogus # Bug#9979 Use of CONVERT_TZ in multiple-table UPDATE causes bogus
# privilege error # privilege error
# #
drop table t1, t2; drop table t1, t2;
...@@ -80,6 +85,7 @@ update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC ...@@ -80,6 +85,7 @@ update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC
# Clean-up # Clean-up
connection default; connection default;
disconnect tzuser2;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%';
...@@ -89,8 +95,7 @@ drop table t1, t2; ...@@ -89,8 +95,7 @@ drop table t1, t2;
# End of 4.1 tests # End of 4.1 tests
# #
# Additional test for bug #15153: CONVERT_TZ() is not allowed in all # Additional test for Bug#15153 CONVERT_TZ() is not allowed in all places in views.
# places in views.
# #
# Let us check that usage of CONVERT_TZ() function in view does not # Let us check that usage of CONVERT_TZ() function in view does not
# require additional privileges. # require additional privileges.
...@@ -109,7 +114,11 @@ drop view v1; ...@@ -109,7 +114,11 @@ drop view v1;
--error ER_TABLEACCESS_DENIED_ERROR --error ER_TABLEACCESS_DENIED_ERROR
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone; create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
connection default; connection default;
disconnect tzuser3;
drop table t1; drop table t1;
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
# End of 5.0 tests # End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment