Merge of fix for Bug#42003 and Bug#43114 into more actual GCA tree

modifications according to the reviews are included
This commit is contained in:
Matthias Leich 2009-03-05 14:35:03 +01:00
commit 7c4e55cb8a
39 changed files with 1384 additions and 933 deletions

View File

@ -2,14 +2,23 @@
#
# SUMMARY
#
# Waits until the passed number ($count_sessions) of concurrent sessions was
# observed via
# Waits until the passed number ($count_sessions) of concurrent sessions or
# a smaller number was observed via
# SHOW STATUS LIKE 'Threads_connected'
# or the operation times out.
# Note: Starting with 5.1 we could also use
# SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+
# Note:
# 1. We wait for $current_sessions <= $count_sessions because in the use case
# with count_sessions.inc before and wait_until_count_sessions.inc after
# the core of the test it could happen that the disconnects of sessions
# belonging to the preceeding test are not finished.
# sessions at test begin($count_sessions) = m + n
# sessions of the previous test which will be soon disconnected = n (n >= 0)
# sessions at test end ($current sessions, assuming the test disconnects
# all additional sessions) = m
# 2. Starting with 5.1 we could also use
# SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+
#
#
# USAGE
@ -19,7 +28,7 @@
#
# OR typical example of a test which uses more than one session
# Such a test could harm successing tests if there is no server shutdown
# and start between.cw
# and start between.
#
# If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed.
@ -79,7 +88,11 @@
# backup.test, grant3.test
#
#
# Created: 2009-01-14 mleich
# Created:
# 2009-01-14 mleich
# Modified:
# 2009-02-24 mleich Fix Bug#43114 wait_until_count_sessions too restrictive,
# random PB failures
#
let $wait_counter= 100;
@ -93,7 +106,7 @@ let $wait_timeout= 0;
while ($wait_counter)
{
let $current_sessions= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1);
let $success= `SELECT $current_sessions = $count_sessions`;
let $success= `SELECT $current_sessions <= $count_sessions`;
if ($success)
{
let $wait_counter= 0;
@ -107,7 +120,7 @@ while ($wait_counter)
if (!$success)
{
--echo # Timeout in wait_until_count_sessions.inc
--echo # Number of sessions expected: $count_sessions found: $current_sessions
--echo # Number of sessions expected: <= $count_sessions found: $current_sessions
SHOW PROCESSLIST;
}

View File

@ -1,15 +1,23 @@
drop table if exists t1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
insert into t1 values(1);
select * from t1;
DROP TABLE IF EXISTS t1;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Switch to connection con1
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# Switch to connection con2
INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a
commit;
delete from t1;
start transaction;
insert into t1 values(1);
select * from t1;
COMMIT;
DELETE FROM t1;
START TRANSACTION;
# Switch to connection con2
INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a
1
commit;
drop table t1;
COMMIT;
# Switch to connection default + close connections con1 and con2
DROP TABLE t1;

View File

@ -1,9 +1,9 @@
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
select * from t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
n
1
2
3
drop table t1;
DROP TABLE t1;

View File

@ -1,39 +1,57 @@
drop table if exists t1;
create table t1 (a int) engine=innodb;
begin;
insert into t1 values(1);
flush tables with read lock;
select * from t1;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Establish connection con3 (user=root)
# Switch to connection con1
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
BEGIN;
INSERT INTO t1 VALUES(1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
a
commit;
select * from t1;
# Switch to connection con1
COMMIT;
# Switch to connection con2
SELECT * FROM t1;
a
unlock tables;
begin;
select * from t1 for update;
UNLOCK TABLES;
# Switch to connection con1
# Switch to connection con1
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
1
begin;
select * from t1 for update;
flush tables with read lock;
commit;
# Switch to connection con2
BEGIN;
SELECT * FROM t1 FOR UPDATE;
# Switch to connection con3
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
COMMIT;
# Switch to connection con2
a
1
unlock tables;
commit;
begin;
insert into t1 values(10);
flush tables with read lock;
commit;
unlock tables;
flush tables with read lock;
unlock tables;
begin;
select * from t1;
# Switch to connection con3
UNLOCK TABLES;
# Switch to connection con2
COMMIT;
# Switch to connection con1
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
COMMIT;
UNLOCK TABLES;
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;
a
1
10
show create database test;
SHOW CREATE DATABASE test;
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1;
DROP TABLE t1;
# Switch to connection default and close connections con1, con2, con3

View File

@ -1,15 +1,23 @@
create table t1 (a int) engine=innodb;
reset master;
set autocommit=0;
insert t1 values (1);
flush tables with read lock;
show master status;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Switch to connection con1
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
commit;
show master status;
# Switch to connection con1
COMMIT;
# Switch to connection con2
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
unlock tables;
drop table t1;
set autocommit=1;
UNLOCK TABLES;
# Switch to connection con1
DROP TABLE t1;
SET AUTOCOMMIT=1;
# Switch to connection default and close connections con1 and con2

View File

@ -1,9 +1,12 @@
drop table if exists t1;
create table t1 (kill_id int);
insert into t1 values(connection_id());
flush tables with read lock;
select ((@id := kill_id) - kill_id) from t1;
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (kill_id INT);
INSERT INTO t1 VALUES(connection_id());
FLUSH TABLES WITH READ LOCK;
SELECT ((@id := kill_id) - kill_id) FROM t1;
((@id := kill_id) - kill_id)
0
kill connection @id;
drop table t1;
KILL CONNECTION @id;
DROP TABLE t1;
SET @@global.concurrent_insert= @old_concurrent_insert;

View File

@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
use mysql;
USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
use mysql;
USE mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text
@ -65,7 +65,7 @@ mysql.user optimize status OK
UNLOCK TABLES;
Select_priv
N
use test;
USE test;
use test;
CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE;
@ -93,7 +93,7 @@ create table t1 (a int);
connection: locker
lock tables t1 read;
connection: writer
create table t2 like t1;;
create table t2 like t1;
connection: default
kill query
ERROR 70100: Query execution was interrupted

View File

@ -349,9 +349,9 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
CREATE TABLE t1 (c1 CHAR(10));
flush logs;
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
FLUSH LOGS;
DROP TABLE t1;
We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
@ -361,23 +361,23 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1
1
DROP TABLE patch;
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
flush logs;
drop table t1;
FLUSH LOGS;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
FLUSH LOGS;
DROP TABLE t1;
1
drop table t1;
DROP TABLE t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
set @@global.server_id= 4294967295;
reset master;
flush logs;
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null
SET @@global.server_id= 4294967295;
RESET MASTER;
FLUSH LOGS;
SELECT
(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
IS NOT NULL;
(@a:=LOAD_FILE("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
IS NOT NULL
1
*** Unsigned server_id 4294967295 is found: 1 ***
set @@global.server_id= 1;
SET @@global.server_id= 1;
End of 5.0 tests

View File

@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt'
drop table t1,t2;
drop user test@localhost;
#
# Bug #27440 read_only allows create and drop database
# Bug#27440 read_only allows create and drop database
#
drop database if exists mysqltest_db1;
drop database if exists mysqltest_db2;

View File

@ -507,9 +507,9 @@ ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysql
drop table mysqltest.t1;
drop database mysqltest;
set names binary;
delete from mysql.user
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
@ -916,7 +916,7 @@ def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33
Trigger Event Table Statement Timing Created sql_mode Definer
t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost
----------------------------------------------------------------
SELECT
SELECT
TRIGGER_CATALOG,
TRIGGER_SCHEMA,
TRIGGER_NAME,

View File

@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
select user();
user()
SELECT USER();
USER()
#
show processlist;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>

View File

@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table
drop user user_bug14533@localhost;
drop database db_bug14533;
CREATE DATABASE db_bug7787;
use db_bug7787;
USE db_bug7787;
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
Warnings:
@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_2_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need the SUPER privilege for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
@ -373,7 +373,7 @@ Warnings:
Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root
use mysqltest;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
@ -403,7 +403,7 @@ CREATE USER mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
CREATE FUNCTION bug13198_f1() RETURNS INT
@ -416,7 +416,7 @@ bug13198_f1()
1
---> connection: mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
1
1
@ -428,7 +428,7 @@ bug13198_f1()
DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
SELECT bug13198_f1();
@ -445,7 +445,7 @@ Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con
use test;
USE test;
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
DECLARE a INT;

View File

@ -1667,9 +1667,9 @@ INSERT INTO t2 VALUES (4,3,'n');
INSERT INTO t2 VALUES (6,1,'n');
INSERT INTO t2 VALUES (8,1,'y');
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT a.col1,a.col2,b.col2,b.col3
SELECT a.col1,a.col2,b.col2,b.col3
FROM t1 a LEFT JOIN t2 b ON a.col1=b.col1
WHERE b.col2 IS NULL OR
WHERE b.col2 IS NULL OR
b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
col1 col2 col2 col3
1 trudy 2 y
@ -1681,9 +1681,9 @@ col1 col2 col2 col3
7 carsten NULL NULL
8 ranger 1 y
10 matt NULL NULL
SELECT a.col1,a.col2,b.col2,b.col3
SELECT a.col1,a.col2,b.col2,b.col3
FROM v1 a LEFT JOIN t2 b ON a.col1=b.col1
WHERE b.col2 IS NULL OR
WHERE b.col2 IS NULL OR
b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
col1 col2 col2 col3
1 trudy 2 y
@ -1737,7 +1737,7 @@ A A
2 2
3 3
create table t3 as select a a,a b from t2;
create view v2 as select * from t3 where
create view v2 as select * from t3 where
a in (select * from t1) or b in (select * from t2);
select * from v2 A, v2 B where A.a = B.b;
a b a b
@ -1993,7 +1993,7 @@ dkjhgd
drop view v1;
create table t1 (f59 int, f60 int, f61 int);
insert into t1 values (19,41,32);
create view v1 as select f59, f60 from t1 where f59 in
create view v1 as select f59, f60 from t1 where f59 in
(select f59 from t1);
update v1 set f60=2345;
ERROR HY000: The target table v1 of the UPDATE is not updatable
@ -2120,7 +2120,7 @@ pid int NOT NULL
INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d');
INSERT INTO t2 values (1,1), (2,1), (2,2);
CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid;
SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
WHERE t1.aid = t2.aid GROUP BY pid;
pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1)
1 a b,c d
@ -2222,7 +2222,7 @@ group_name varchar(32) NOT NULL
) engine = InnoDB;
create table t2 (
r_object_id char(16) NOT NULL,
i_position int(11) NOT NULL,
i_position int(11) NOT NULL,
users_names varchar(32) default NULL
) Engine = InnoDB;
create view v1 as select r_object_id, group_name from t1;
@ -2235,7 +2235,7 @@ insert into t1 values('120001a080000542','tstgroup1');
insert into t2 values('120001a080000542',-1, 'guser01');
insert into t2 values('120001a080000542',-2, 'guser02');
select v1.r_object_id, v2.users_names from v1, v2
where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
order by users_names;
r_object_id users_names
120001a080000542 guser01
@ -2385,8 +2385,8 @@ create table t4 (x int, y int, z int);
create view v1 as
select t1.x
from (
(t1 join t2 on ((t1.y = t2.y)))
join
(t1 join t2 on ((t1.y = t2.y)))
join
(t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
);
prepare stmt1 from "select count(*) from v1 where x = ?";
@ -2562,12 +2562,12 @@ Warnings:
Warning 1052 Column 'x' in group statement is ambiguous
DROP VIEW v1;
DROP TABLE t1;
drop table if exists t1;
drop view if exists v1;
create table t1 (id int);
create view v1 as select * from t1;
drop table t1;
show create view v1;
drop table if exists t1;
drop view if exists v1;
create table t1 (id int);
create view v1 as select * from t1;
drop table t1;
show create view v1;
drop view v1;
//
View Create View
@ -2614,7 +2614,7 @@ DROP VIEW v2;
DROP TABLE t1, t2;
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
td date DEFAULT NULL, KEY idx(td));
INSERT INTO t1 VALUES
INSERT INTO t1 VALUES
(1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
(4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
(7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
@ -2978,10 +2978,10 @@ drop view v1;
drop table t1;
CREATE TABLE t1(pk int PRIMARY KEY);
CREATE TABLE t2(pk int PRIMARY KEY, fk int, ver int, org int);
CREATE ALGORITHM=MERGE VIEW v1 AS
CREATE ALGORITHM=MERGE VIEW v1 AS
SELECT t1.*
FROM t1 JOIN t2
ON t2.fk = t1.pk AND
FROM t1 JOIN t2
ON t2.fk = t1.pk AND
t2.ver = (SELECT MAX(t.ver) FROM t2 t WHERE t.org = t2.org);
SHOW WARNINGS;
Level Code Message
@ -3311,7 +3311,7 @@ name char(10) NOT NULL
INSERT INTO t1 (lid, name) VALUES
(1, 'YES'), (2, 'NO');
CREATE TABLE t2 (
id int NOT NULL PRIMARY KEY,
id int NOT NULL PRIMARY KEY,
gid int NOT NULL,
lid int NOT NULL,
dt date
@ -3410,8 +3410,8 @@ CREATE TABLE t1 (id int);
CREATE TABLE t2 (id int, c int DEFAULT 0);
INSERT INTO t1 (id) VALUES (1);
INSERT INTO t2 (id) VALUES (1);
CREATE VIEW v1 AS
SELECT t2.c FROM t1, t2
CREATE VIEW v1 AS
SELECT t2.c FROM t1, t2
WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
UPDATE v1 SET c=1;
DROP VIEW v1;
@ -3519,7 +3519,7 @@ role_name varchar(100) default NULL,
app_name varchar(40) NOT NULL,
INDEX idx_app_name(app_name)
);
CREATE VIEW v1 AS
CREATE VIEW v1 AS
SELECT profile.person_id AS person_id
FROM t1 profile, t2 userrole, t3 role
WHERE userrole.person_id = profile.person_id AND
@ -3531,7 +3531,7 @@ INSERT INTO t1 VALUES
(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
INSERT INTO t2 VALUES
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
INSERT INTO t3 VALUES
INSERT INTO t3 VALUES
(1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'),
(3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'),
(5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'),
@ -3557,7 +3557,7 @@ i
2
3
4
select table_name, is_updatable from information_schema.views
select table_name, is_updatable from information_schema.views
where table_name = 'v1';
table_name is_updatable
v1 NO
@ -3603,8 +3603,8 @@ DROP VIEW v2;
DROP VIEW v3;
DROP TABLE t1;
#
# Bug#29477: Not all fields of the target table were checked to have
# a default value when inserting into a view.
# Bug#29477 Not all fields of the target table were checked to have
# a default value when inserting into a view.
#
create table t1(f1 int, f2 int not null);
create view v1 as select f1 from t1;
@ -3621,7 +3621,7 @@ drop table t1;
create table t1 (a int, key(a));
create table t2 (c int);
create view v1 as select a b from t1;
create view v2 as select 1 a from t2, v1 where c in
create view v2 as select 1 a from t2, v1 where c in
(select 1 from t1 where b = a);
insert into t1 values (1), (1);
insert into t2 values (1), (1);
@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a)
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
# -- Bug#34337: Server crash when Altering a view using a table name.
# -- Bug#34337 Server crash when Altering a view using a table name.
# -----------------------------------------------------------------
DROP TABLE IF EXISTS t1;
@ -3660,8 +3660,8 @@ DROP TABLE t1;
# -- End of test case for Bug#34337.
# -----------------------------------------------------------------
# -- Bug#35193: VIEW query is rewritten without "FROM DUAL",
# -- causing syntax error
# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
# -- causing syntax error
# -----------------------------------------------------------------
CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;

View File

@ -644,7 +644,7 @@ CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
CREATE OR REPLACE VIEW test.v1 AS
CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
DROP VIEW test2.t3;
@ -788,7 +788,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP USER u26813@localhost;
DROP DATABASE db26813;
#
# Bug#29908: A user can gain additional access through the ALTER VIEW.
# Bug#29908 A user can gain additional access through the ALTER VIEW.
#
CREATE DATABASE mysqltest_29908;
USE mysqltest_29908;

View File

@ -1,4 +1,4 @@
# In order to be more or less robust test for bug#25044 has to take
# In order to be more or less robust test for Bug#25044 has to take
# significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog.
@ -6,8 +6,8 @@
#
# Test for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock".
# Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock
#
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution.
@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
# Clean up
drop tables t1, t2;
disconnect addconroot;
--echo End of 5.0 tests

View File

@ -18,12 +18,16 @@ connect (con2,localhost,root,,test);
show tables;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,);
connection default;
disconnect con1;
disconnect con2;
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
@ -35,20 +39,23 @@ show tables;
connect (con4,localhost,test,gambling,test);
show tables;
connection default;
disconnect con3;
disconnect con4;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,"");
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql);
connection con5;
set password="";
--error 1372
--error ER_PASSWD_LENGTH
set password='gambling3';
set password=old_password('gambling3');
show tables;
connect (con6,localhost,test,gambling3,test);
show tables;
connection default;
disconnect con10;
disconnect con5;
disconnect con6;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
delete from mysql.user where user=_binary"test";
flush privileges;
@ -98,4 +109,5 @@ disconnect con7;
connection default;
drop table t1;
# End of 4.1 tests

View File

@ -1,43 +1,61 @@
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
--echo # Switch to connection con1
connection con1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--echo # Switch to connection con2
connection con2;
insert into t1 values(1);
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1;
select * from t1; # if consistent snapshot was set as expected, we
SELECT * FROM t1; # if consistent snapshot was set as expected, we
# should see nothing.
commit;
COMMIT;
### Test 2:
### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction.
delete from t1;
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
DELETE FROM t1;
START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
--echo # Switch to connection con2
connection con2;
insert into t1 values(1);
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1;
select * from t1; # if consistent snapshot was not set, as expected, we
SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
# should see 1.
commit;
COMMIT;
drop table t1;
--echo # Switch to connection default + close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,3 +1,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
@ -5,12 +9,19 @@ dirty_close con1;
connection con2;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (n int);
insert into t1 values (1),(2),(3);
select * from t1;
drop table t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,74 +4,106 @@
# This is intended to mimick how mysqldump and innobackup work.
# And it requires InnoDB
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,);
--echo # Switch to connection con1
connection con1;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (a int) engine=innodb;
CREATE TABLE t1 (a INT) ENGINE=innodb;
# blocks COMMIT ?
begin;
insert into t1 values(1);
BEGIN;
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con2
connection con2;
flush tables with read lock;
select * from t1;
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
--echo # Switch to connection con1
connection con1;
send commit; # blocked by con2
send COMMIT; # blocked by con2
sleep 1;
--echo # Switch to connection con2
connection con2;
select * from t1; # verify con1 was blocked and data did not move
unlock tables;
SELECT * FROM t1; # verify con1 was blocked and data did not move
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
reap;
# No deadlock ?
--echo # Switch to connection con1
connection con1;
begin;
select * from t1 for update;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
--echo # Switch to connection con2
connection con2;
begin;
send select * from t1 for update; # blocked by con1
BEGIN;
send SELECT * FROM t1 FOR UPDATE; # blocked by con1
sleep 1;
--echo # Switch to connection con3
connection con3;
send flush tables with read lock; # blocked by con2
send FLUSH TABLES WITH READ LOCK; # blocked by con2
--echo # Switch to connection con1
connection con1;
commit; # should not be blocked by con3
COMMIT; # should not be blocked by con3
--echo # Switch to connection con2
connection con2;
reap;
--echo # Switch to connection con3
connection con3;
reap;
unlock tables;
UNLOCK TABLES;
# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK
# Bug#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK
--echo # Switch to connection con2
connection con2;
commit; # unlock InnoDB row locks to allow insertions
COMMIT; # unlock InnoDB row locks to allow insertions
--echo # Switch to connection con1
connection con1;
begin;
insert into t1 values(10);
flush tables with read lock;
commit;
unlock tables;
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
COMMIT;
UNLOCK TABLES;
--echo # Switch to connection con2
connection con2;
flush tables with read lock; # bug caused hang here
unlock tables;
FLUSH TABLES WITH READ LOCK; # bug caused hang here
UNLOCK TABLES;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction
# Bug#7358 SHOW CREATE DATABASE fails if open transaction
begin;
select * from t1;
show create database test;
BEGIN;
SELECT * FROM t1;
SHOW CREATE DATABASE test;
drop table t1;
DROP TABLE t1;
# Cleanup
--echo # Switch to connection default and close connections con1, con2, con3
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,32 +3,51 @@
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
-- source include/have_log_bin.inc
--source include/have_log_bin.inc
# And it requires InnoDB
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
--echo # Switch to connection con1
connection con1;
create table t1 (a int) engine=innodb;
reset master;
set autocommit=0;
insert t1 values (1);
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
--echo # Switch to connection con2
connection con2;
flush tables with read lock;
show master status;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
--echo # Switch to connection con1
connection con1;
send commit;
send COMMIT;
--echo # Switch to connection con2
connection con2;
sleep 1;
show master status;
unlock tables;
SHOW MASTER STATUS;
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
reap;
drop table t1;
set autocommit=1;
DROP TABLE t1;
SET AUTOCOMMIT=1;
--echo # Switch to connection default and close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -8,19 +8,27 @@
# won't test anything interesting).
# This also won't work with the embedded server test
-- source include/not_embedded.inc
--source include/not_embedded.inc
-- source include/have_debug.inc
--source include/have_debug.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Disable concurrent inserts to avoid test failures when reading the
# connection id which was inserted into a table by another thread.
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (kill_id int);
insert into t1 values(connection_id());
CREATE TABLE t1 (kill_id INT);
INSERT INTO t1 VALUES(connection_id());
# Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It
@ -28,14 +36,14 @@ insert into t1 values(connection_id());
# --debug) it will succeed immediately
connection con1;
send flush tables with read lock;
send FLUSH TABLES WITH READ LOCK;
# kill con1
connection con2;
select ((@id := kill_id) - kill_id) from t1;
SELECT ((@id := kill_id) - kill_id) FROM t1;
--sleep 2 # leave time for FLUSH to block
kill connection @id;
KILL CONNECTION @id;
connection con1;
# On debug builds it will be error 1053 (killed); on non-debug, or
@ -46,4 +54,13 @@ connection con1;
reap;
connection con2;
drop table t1;
DROP TABLE t1;
connection default;
disconnect con2;
# Restore global concurrent_insert value
SET @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/add_anonymous_users.inc
connect (con0,localhost,root,,);
@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection con1;
select * from t1;
connection con0;
connection default;
disconnect con0;
disconnect con1;
drop trigger trg1;
@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1, t2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,4 +1,8 @@
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@ -14,12 +18,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
connection writer;
send update low_priority t1 set n = 4;
send
update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
send
select n from t1;
connection locker;
--sleep 2
# Sleep a bit till the select of connection reader is in work and hangs
# Here we cannot use include/wait_show_condition.inc because this routine
# cannot count the number of 'Locked' sessions or access two columns within
# the same query_get_value call.
--sleep 3
unlock tables;
connection writer;
reap;
@ -32,12 +47,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
connection writer;
send update low_priority t1 set n = 4;
send
update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
#
send
select n from t1;
connection locker;
--sleep 2
# Sleep a bit till the select of connection reader is in work and hangs
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
#
unlock tables;
connection writer;
reap;
@ -58,10 +84,15 @@ insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
connection writer;
--sleep 2
send update t1,t2 set c=a where b=d;
# mleich: IMHO the "send is not necessary because the update should not block.
# But it will save some runtime in case we block because of an error.
send
update t1,t2 set c=a where b=d;
connection reader;
--sleep 2
# Sleep a bit till the update of connection writer is finished
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
#
select c from t2;
connection writer;
reap;
@ -70,7 +101,7 @@ drop table t1;
drop table t2;
#
# Test problem when using locks on many tables and droping a table that
# Test problem when using locks on many tables and dropping a table that
# is to-be-locked by another thread
#
@ -79,11 +110,18 @@ create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
connection reader;
send insert t1 select * from t2;
send
insert t1 select * from t2;
connection locker;
# Sleep a bit till the insert of connection reader is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
drop table t2;
connection reader;
--error 1146
--error ER_NO_SUCH_TABLE
reap;
connection locker;
drop table t1;
@ -91,7 +129,7 @@ drop table t1;
# End of 4.1 tests
#
# BUG#9998 - MySQL client hangs on USE "database"
# Bug#9998 MySQL client hangs on USE "database"
#
create table t1(a int);
lock tables t1 write;
@ -102,7 +140,7 @@ unlock tables;
drop table t1;
#
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
# Bug#19815 CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@ -114,12 +152,18 @@ FLUSH TABLES WITH READ LOCK;
# With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock().
connection con2;
send DROP DATABASE mysqltest_1;
--sleep 1
send
DROP DATABASE mysqltest_1;
#
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
connection con1;
# Wait a bit so that the session con2 is in state "Waiting for release of readlock"
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for release of readlock';
--source include/wait_show_condition.inc
--error ER_CANT_UPDATE_WITH_READLOCK
DROP DATABASE mysqltest_1;
UNLOCK TABLES;
@ -135,26 +179,33 @@ disconnect con2;
--error ER_DB_DROP_EXISTS
DROP DATABASE mysqltest_1;
#
# Bug#16986 - Deadlock condition with MyISAM tables
# Bug#16986 Deadlock condition with MyISAM tables
#
# Need a matching user in mysql.user for multi-table select
--source include/add_anonymous_users.inc
connection locker;
use mysql;
USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
--sleep 1
#
connection reader;
use mysql;
#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
--sleep 1
USE mysql;
# Note: This must be a multi-table select, otherwise the deadlock will not occur
send
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
#
connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
# Make test case independent from earlier grants.
--replace_result "Table is already up to date" "OK"
OPTIMIZE TABLES columns_priv, db, host, user;
@ -162,7 +213,7 @@ UNLOCK TABLES;
#
connection reader;
reap;
use test;
USE test;
#
connection locker;
use test;
@ -177,11 +228,17 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
send FLUSH TABLES WITH READ LOCK;
--sleep 1
send
FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
CREATE TABLE t2 (c1 int);
UNLOCK TABLES;
#
@ -201,12 +258,18 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
send FLUSH TABLES WITH READ LOCK;
--sleep 1
send
FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
--error 1100
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
--error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1;
UNLOCK TABLES;
#
@ -220,8 +283,9 @@ DROP TABLE t1;
--source include/delete_anonymous_users.inc
#
# Bug #17264: MySQL Server freeze
# Bug#17264 MySQL Server freeze
#
connection locker;
# Disable warnings to allow test to run also without InnoDB
@ -230,17 +294,29 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
--enable_warnings
lock tables t1 write;
connection writer;
--sleep 2
# mleich: I have doubts if the next sleep is really necessary
# Therefore I set it to comment but don't remove it
# in case it hat to be enabled again.
# --sleep 2
delimiter //;
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
send
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection reader;
--sleep 2
# Wait till connection writer is blocked
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
delimiter //;
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
send
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection locker;
--sleep 2
# Wait till connection reader is blocked
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
unlock tables;
connection writer;
reap;
@ -263,7 +339,7 @@ lock tables t1 read;
--echo connection: writer
connection writer;
let $ID= `select connection_id()`;
--send create table t2 like t1;
send create table t2 like t1;
--echo connection: default
connection default;
let $show_type= open tables where in_use=2 and name_locked=1;
@ -282,8 +358,8 @@ connection default;
drop table t1;
#
# Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
#
--connection default
@ -354,7 +430,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@ -362,11 +438,11 @@ while ($i) {
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,1054
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
@ -379,7 +455,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@ -388,11 +464,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,1054
--error 0,ER_BAD_FIELD_ERROR
--reap
}
@ -400,8 +476,9 @@ while ($i) {
--connection default
DROP TABLE t1, t2, t3;
#
# Bug#38499: flush tables and multitable table update with derived table cause
# Bug#38499: flush tables and multitable table update with derived table cause
# crash
#
@ -460,7 +537,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@ -468,11 +545,11 @@ while ($i) {
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # unknown column error
--error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap
}
--enable_query_log
@ -485,7 +562,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@ -494,11 +571,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@ -557,7 +634,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@ -565,11 +642,11 @@ while ($i) {
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@ -582,7 +659,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@ -591,15 +668,25 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
DROP TABLE t1;
# Close connections used in many subtests
--disconnect reader
--disconnect locker
--disconnect writer
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -18,7 +18,7 @@ insert into t2 values ();
# set @a:=1
# insert into t2 values (@a);
# test for load data and load data distributed among the several
# test for load data and load data distributed among the several
# files (we need to fill up first binlog)
load data infile '../std_data_ln/words.dat' into table t1;
load data infile '../std_data_ln/words.dat' into table t1;
@ -103,7 +103,7 @@ select "--- --position --" as "";
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin)
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
select "--- reading stdin --" as "";
--enable_query_log
@ -117,7 +117,7 @@ select "--- reading stdin --" as "";
drop table t1,t2;
#
#BUG#14157: utf8 encoding in binlog without set character_set_client
# Bug#14157 utf8 encoding in binlog without set character_set_client
#
flush logs;
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
@ -130,8 +130,8 @@ EOF
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
# resulted binlog, parly consisting of multi-byte utf8 chars,
# must be digestable for both client and server. In 4.1 the client
# resulted binlog, parly consisting of multi-byte utf8 chars,
# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
select * from t5 /* must be (1),(1) */;
@ -157,7 +157,7 @@ select * from t5 order by c1;
drop table t5;
#
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
#
--disable_warnings
drop procedure if exists p1;
@ -174,7 +174,6 @@ flush logs;
call p1();
drop procedure p1;
--error ER_SP_DOES_NOT_EXIST
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
@ -217,14 +216,14 @@ flush logs;
#
# Bug#28293 missed '#' sign in the hex dump when the dump length
# is divisible by 16.
# is divisible by 16.
#
CREATE TABLE t1 (c1 CHAR(10));
# we need this for getting fixed timestamps inside of this test
flush logs;
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
FLUSH LOGS;
DROP TABLE t1;
# We create a table, patch, and load the output into it
@ -232,11 +231,11 @@ DROP TABLE t1;
# We can easily see if a 'Query' line is missing the '#' character
# as described in the original bug
--disable_query_log
CREATE TABLE patch (a blob);
--disable_query_log
CREATE TABLE patch (a BLOB);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED by '' LINES STARTING BY '#';
INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
@ -248,49 +247,51 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch;
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
# Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
#
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
let $a= `select a from t1`;
flush logs;
FLUSH LOGS;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
let $a= `SELECT a FROM t1`;
FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
drop table t1;
connect (con1, localhost, root, , test);
DROP TABLE t1;
connect (con1, localhost, root, , test);
connection con1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
let $b= `select a from t1`;
let $b= `SELECT a FROM t1`;
disconnect con1;
connection default;
let $c= `select $a=$b`;
let $c= `SELECT $a=$b`;
--echo $c
drop table t1;
DROP TABLE t1;
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql;
#
# Bug #37313 BINLOG Contains Incorrect server id
# Bug#37313 BINLOG Contains Incorrect server id
#
let $save_server_id= `select @@global.server_id`;
let $s_id_max=`select (1 << 32) - 1`;
eval set @@global.server_id= $s_id_max;
let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
let $save_server_id= `SELECT @@global.server_id`;
let $s_id_max= `SELECT (1 << 32) - 1`;
eval SET @@global.server_id= $s_id_max;
reset master;
flush logs;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
RESET MASTER;
FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $binlog_file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null;
let $s_id_unsigned= `select @a like "%server id $s_id_max%" /* must return 1 */`;
eval SELECT
(@a:=LOAD_FILE("$binlog_file"))
IS NOT NULL;
let $s_id_unsigned= `SELECT @a LIKE "%server id $s_id_max%" /* must return 1 */`;
echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
eval set @@global.server_id= $save_server_id;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog
eval SET @@global.server_id= $save_server_id;
--remove_file $binlog_file
--echo End of 5.0 tests

View File

@ -6,6 +6,9 @@
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# ============================================================================
#
# Test of mysqltest itself
@ -50,7 +53,7 @@ select otto from (select 1 as otto) as t1;
# ----------------------------------------------------------------------------
# Negative case(statement):
# The derived table t1 does not contain a column named 'friedrich' .
# The derived table t1 does not contain a column named 'friedrich' .
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
# --> 1054: Unknown column 'friedrich' in 'field list'
# ----------------------------------------------------------------------------
@ -117,7 +120,7 @@ select friedrich from (select 1 as otto) as t1;
# $mysql_errno is a builtin variable of mysqltest and contains the return code
# of the last command sent to the server.
#
# The following test cases often initialize $mysql_errno to 1064 by
# The following test cases often initialize $mysql_errno to 1064 by
# a command with wrong syntax.
# Example: --error 1064 To prevent the abort after the error.
# garbage ;
@ -481,7 +484,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Allow trailing # comment
--sleep 1 # Wait for insert delayed to be executed.
--sleep 1 # Wait for insert delayed to be executed.
--sleep 1 # Wait for insert delayed to be executed.
# ----------------------------------------------------------------------------
# Test error
@ -1382,7 +1385,7 @@ connection default;
# ----------------------------------------------------------------------------
# TODO Test queries, especially their errormessages... so it's easy to debug
# TODO Test queries, especially their errormessages... so it's easy to debug
# new scripts and diagnose errors
# ----------------------------------------------------------------------------
@ -1424,7 +1427,7 @@ let $message= `SELECT USER()`;
# The message contains more then 80 characters on multiple lines
# and is kept between double quotes.
let $message=
let $message=
"Here comes a very very long message that
- is longer then 80 characters and
- consists of several lines";
@ -1534,7 +1537,7 @@ remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
#
# Bug#19890 mysqltest: "query" command is broken
# Bug#19890 mysqltest: "query" command is broken
#
# It should be possible to use the command "query" to force mysqltest to
@ -1560,7 +1563,7 @@ select "at" as col1, "c" as col2;
select "at" as col1, "AT" as col2, "c" as col3;
--replace_regex /a/b/ /ct/d/
select "a" as col1, "ct" as col2;
select "a" as col1, "ct" as col2;
--replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/;
select "strawberry","blueberry","potato";
@ -1578,7 +1581,7 @@ select "strawberry","blueberry","potato";
--error 1
--exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
--error 1
--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
# REQUIREMENT
# replace_regex should replace substitutions from left to right in output
@ -1948,7 +1951,7 @@ SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
# 9. Ensure that several result formatting options including "sorted_result"
# 9. Ensure that several result formatting options including "sorted_result"
# - have all an effect
# - "--sorted_result" does not need to be direct before the statement
# - Row sorting is applied after modification of the column content
@ -2154,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
# should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
@ -40,24 +43,24 @@ connection con1;
select @@global.read_only;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
create table t3 (a int);
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
# if a statement, after parse stage, looks like it will update a
# non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1 set a=1 where 1=0;
# multi-update is special (see sql_parse.cc) so we test it
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
# check multi-delete to be sure
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
delete t1,t2 from t1,t2 where t1.a=t2.a;
# With temp tables updates should be accepted:
@ -71,7 +74,7 @@ insert into t3 values(1);
insert into t4 select * from t3;
# a non-temp table updated:
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
# no non-temp table updated (just swapped):
@ -79,7 +82,7 @@ update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
delete t1 from t1,t3 where t1.a=t3.a;
delete t3 from t1,t3 where t1.a=t3.a;
@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
#
# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
# Bug#22077 DROP TEMPORARY TABLE fails with wrong error if read_only is set
#
# check if DROP TEMPORARY on a non-existing temporary table returns the right
# error
@ -114,11 +117,12 @@ drop temporary table ttt;
drop temporary table if exists ttt;
connection default;
disconnect con1;
drop table t1,t2;
drop user test@localhost;
--echo #
--echo # Bug #27440 read_only allows create and drop database
--echo # Bug#27440 read_only allows create and drop database
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
drop database mysqltest_db1;
set global read_only=0;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,9 @@
# Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Test of some show commands
#
@ -33,7 +36,7 @@ check table t1 medium;
check table t1 extended;
show index from t1;
--disable_metadata
--error 1062
--error ER_DUP_ENTRY
insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the
@ -191,14 +194,14 @@ show columns from t1;
drop table t1;
#
# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
# Test for Bug#2593 SHOW CREATE TABLE doesn't properly double quotes
#
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
######### hook for WL#1324 #
--error 1103
--error ER_WRONG_TABLE_NAME
CREATE TABLE `a/b` (i INT);
# the above test should WORK when WL#1324 is done,
# it should be removed and
@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT);
#SHOW CREATE TABLE """a";
#DROP TABLE """a";
#
#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
#Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
#set names latin1;
#create database `ä`;
#create table `ä`.`ä` (a int) engine=heap;
@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode;
#
# Test for bug #2719 "Heap tables status shows wrong or missing data."
# Test for Bug#2719 Heap tables status shows wrong or missing data.
#
select @@max_heap_table_size;
@ -313,7 +316,7 @@ show table status;
drop table t1, t2, t3;
#
# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
# Test for Bug#3342 SHOW CREATE DATABASE seems to require DROP privilege
#
create database mysqltest;
@ -328,36 +331,39 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1;
select * from t1;
show create database mysqltest;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
drop table t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
disconnect con1;
connect (con2,localhost,mysqltest_2,,test);
connection con2;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
drop table mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
disconnect con2;
connect (con3,localhost,mysqltest_3,,test);
connection con3;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
drop table mysqltest.t1;
drop database mysqltest;
disconnect con3;
connection default;
set names binary;
delete from mysql.user
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
@ -371,7 +377,7 @@ flush privileges;
#drop database `ä`;
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
# specified during table creation, but not otherwise. (Bug #7235)
# specified during table creation, but not otherwise. (Bug#7235)
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index"
# Test for Bug#9439 Reporting wrong datatype for sub_part on show index
CREATE TABLE t1(
field1 text NOT NULL,
PRIMARY KEY(field1(1000))
@ -412,7 +418,7 @@ show index from t1;
--disable_metadata
drop table t1;
# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
# Test for Bug#11635 mysqldump exports TYPE instead of USING for HASH
create table t1 (
c1 int NOT NULL,
c2 int NOT NULL,
@ -422,7 +428,7 @@ create table t1 (
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
# Test for Bug#93 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
flush tables;
@ -430,7 +436,7 @@ flush tables;
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1';
--error 1033
--error ER_NOT_FORM_FILE
show create table t1;
drop table t1;
@ -438,7 +444,7 @@ drop table t1;
--echo End of 4.1 tests
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
# Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some.
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
#
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
# Bug#12591 SHOW TABLES FROM dbname produces wrong error message
#
--error 1049
--error ER_BAD_DB_ERROR
SHOW TABLES FROM non_existing_database;
#
# Bug#17203: "sql_no_cache sql_cache" in views created from prepared
# Bug#17203 "sql_no_cache sql_cache" in views created from prepared
# statement
#
# The problem was that initial user setting was forgotten, and current
@ -543,7 +549,7 @@ SHOW COLUMNS FROM no_such_table;
#
# Bug #19764: SHOW commands end up in the slow log as table scans
# Bug#19764 SHOW commands end up in the slow log as table scans
#
flush status;
show status like 'slow_queries';
@ -555,8 +561,8 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
# BUG#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
#
#
@ -671,7 +677,7 @@ SHOW TRIGGERS LIKE 't1';
--echo ----------------------------------------------------------------
SELECT
SELECT
TRIGGER_CATALOG,
TRIGGER_SCHEMA,
TRIGGER_NAME,
@ -827,7 +833,7 @@ DROP DATABASE mysqltest1;
use test;
#
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
# Bug#28808 log_queries_not_using_indexes variable dynamic change is ignored
#
flush status;
show variables like "log_queries_not_using_indexes";
@ -843,7 +849,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# Bug #30088: Can't disable myisam-recover by a value of ""
# Bug#30088 Can't disable myisam-recover by a value of ""
#
show variables like 'myisam_recover_options';
@ -868,3 +874,7 @@ show create table t1;
drop table t1;
--echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,7 +1,10 @@
# Can't be tested with embedded server
-- source include/not_embedded.inc
--source include/not_embedded.inc
# Bug #8471: IP address with mask fail when skip-name-resolve is on
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Bug#8471 IP address with mask fail when skip-name-resolve is on
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
@ -9,12 +12,17 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
# Bug #13407 "Remote connecting crashes server".
# Bug#13407 Remote connecting crashes server
# Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 #
select user();
SELECT USER();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
show processlist;
SHOW PROCESSLIST;
connection default;
disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,);
connection con1root;
@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select db1_secret.db();
#
# BUG#2777
# Bug#2777 Stored procedure doesn't observe definer's rights
#
connection con1root;
@ -215,7 +218,7 @@ call q();
select * from t2;
#
# BUG#6030: Stored procedure has no appropriate DROP privilege
# Bug#6030 Stored procedure has no appropriate DROP privilege
# (or ALTER for that matter)
# still connection con2user1 in db2
@ -330,7 +333,7 @@ flush privileges;
drop table t1;
#
# BUG#9503: reseting correct parameters of thread after error in SP function
# Bug#9503 reseting correct parameters of thread after error in SP function
#
connect (root,localhost,root,,test);
connection root;
@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503;
use test;
drop database mysqltest;
connection default;
disconnect root;
#
# correct value from current_user() in function run from "security definer"
# (BUG#7291)
# (Bug#7291 Stored procedures: wrong CURRENT_USER value)
#
connection con1root;
use test;
@ -398,10 +403,10 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop user user1@localhost;
#
# Bug #12318: Wrong error message when accessing an inaccessible stored
# Bug#12318 Wrong error message when accessing an inaccessible stored
# procedure in another database when the current database is
# information_schema.
#
#
--disable_warnings
drop database if exists mysqltest_1;
@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
#
# BUG#12812 create view calling a function works without execute right
# Bug#12812 create view calling a function works without execute right
# on function
delimiter |;
--disable_warnings
@ -464,7 +469,7 @@ delimiter ;|
#
# BUG#14834: Server denies to execute Stored Procedure
# Bug#14834 Server denies to execute Stored Procedure
#
# The problem here was with '_' in the database name.
#
@ -507,7 +512,7 @@ drop database db_bug14834;
#
# BUG#14533: 'desc tbl' in stored procedure causes error
# Bug#14533 'desc tbl' in stored procedure causes error
# ER_TABLEACCESS_DENIED_ERROR
#
create database db_bug14533;
@ -546,20 +551,20 @@ drop database db_bug14533;
#
# BUG#7787: Stored procedures: improper warning for "grant execute" statement
# Bug#7787 Stored procedures: improper warning for "grant execute" statement
#
# Prepare.
CREATE DATABASE db_bug7787;
use db_bug7787;
USE db_bug7787;
# Test.
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
SHOW INNODB STATUS;
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
# Cleanup.
@ -569,7 +574,7 @@ use test;
#
# WL#2897: Complete definer support in the stored routines.
# WL#2897 Complete definer support in the stored routines.
#
# The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines
@ -614,7 +619,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
use mysqltest;
USE mysqltest;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
@ -652,7 +657,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
--echo ---> connection: con1root
--connection con1root
use mysqltest;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p3;
@ -672,7 +677,7 @@ DROP DATABASE mysqltest;
#
# BUG#13198: SP executes if definer does not exist
# Bug#13198 SP executes if definer does not exist
#
# Prepare environment.
@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
@ -720,7 +725,7 @@ SELECT bug13198_f1();
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
--error ER_NO_SUCH_USER
CALL bug13198_p1();
@ -764,8 +769,8 @@ DROP DATABASE mysqltest;
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
#
# Can't test with embedded server that doesn't support grants
@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use test;
USE test;
DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC
@ -814,8 +819,7 @@ DROP USER user19857@localhost;
#
# BUG#18630: Arguments of suid routine calculated in wrong security
# context
# Bug#18630 Arguments of suid routine calculated in wrong security context
#
# Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole.
@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
DROP TABLE t1;
--echo End of 5.0 tests.
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,14 +1,17 @@
# Can't test with embedded server
-- source include/not_embedded.inc
--sleep 2
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
delimiter |;
#
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
# Bug#4902: Stored procedure with SHOW WARNINGS leads to packet error
#
# Added tests for show grants command
--disable_warnings
@ -47,7 +50,7 @@ drop procedure bug4902_2|
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
# Bug#5278: Stored procedure packets out of order if SET PASSWORD.
#
--disable_warnings
drop function if exists bug5278|
@ -58,13 +61,16 @@ begin
return 'okay';
end|
--error 1133
--error ER_PASSWORD_NO_MATCH
select bug5278()|
--error 1133
--error ER_PASSWORD_NO_MATCH
select bug5278()|
drop function bug5278|
#
# Bug#3583: query cache doesn't work for stored procedures
#
--disable_warnings
drop table if exists t1|
--enable_warnings
@ -72,9 +78,6 @@ create table t1 (
id char(16) not null default '',
data int not null
)|
#
# BUG#3583: query cache doesn't work for stored procedures
#
--disable_warnings
drop procedure if exists bug3583|
--enable_warnings
@ -110,8 +113,9 @@ delete from t1|
drop procedure bug3583|
drop table t1|
#
# BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
# Bug#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
#
--disable_warnings
drop procedure if exists bug6807|
@ -125,16 +129,16 @@ begin
select 'Not reached';
end|
--error 1317
--error ER_QUERY_INTERRUPTED
call bug6807()|
--error 1317
--error ER_QUERY_INTERRUPTED
call bug6807()|
drop procedure bug6807|
#
# BUG#10100: function (and stored procedure?) recursivity problem
# Bug#10100: function (and stored procedure?) recursivity problem
#
--disable_warnings
drop function if exists bug10100f|
@ -233,11 +237,11 @@ begin
close c;
end|
#end of the stack checking
# end of the stack checking
set @@max_sp_recursion_depth=255|
set @var=1|
#disable log because error about stack overrun contains numbers which
#depend on a system
# disable log because error about stack overrun contains numbers which
# depend on a system
-- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)|
@ -266,6 +270,7 @@ drop table t3|
delimiter ;|
#
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
#
@ -282,6 +287,11 @@ call 15298_1();
call 15298_2();
connection default;
disconnect con1;
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,12 +4,15 @@
-- source include/have_ssl.inc
-- source include/big_test.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
#
# Bug #29579 Clients using SSL can hang the server
# Bug#29579 Clients using SSL can hang the server
#
connect (ssl_con,localhost,root,,,,,SSL);
@ -18,7 +21,7 @@ create table t1 (a int);
disconnect ssl_con;
--disable_query_log
--disable_result_log
@ -26,31 +29,36 @@ let $count= 2000;
while ($count)
{
connect (ssl_con,localhost,root,,,,,SSL);
eval insert into t1 values ($count);
dec $count;
# This select causes the net buffer to fill as the server sends the results
# This select causes the net buffer to fill as the server sends the results
# but the client doesn't reap the results. The results are larger each time
# through the loop, so that eventually the buffer is completely full
# at the exact moment the server attempts to the close the connection with
# the lock held.
send select * from t1;
# now send the quit the command so the server will initiate the shutdown.
send_quit ssl_con;
send_quit ssl_con;
# if the server is hung, this will hang too:
connect (ssl_con2,localhost,root,,,,,SSL);
# no hang if we get here, close and retry
disconnect ssl_con2;
disconnect ssl_con;
}
}
--enable_query_log
--enable_result_log
connect (ssl_con,localhost,root,,,,,SSL);
drop table t1;
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,6 +3,9 @@
-- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
-- source include/have_ssl.inc
-- source include/have_compress.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
connection default;
disconnect ssl_compress_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,9 @@
# embedded server causes different stat
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# PS causes different statistics
--disable_ps_protocol
@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,9 +3,12 @@
#
# Requires privileges to be enabled
-- source include/not_embedded.inc
--source include/not_embedded.inc
# Prepare play-ground
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Prepare play-ground
--disable_warnings
drop table if exists t1;
--enable_warnings
@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
connection mqph;
select * from t1;
select * from t1;
--error 1226
--error ER_USER_LIMIT_REACHED
select * from t1;
connect (mqph2, localhost, mysqltest_1,,);
connection mqph2;
--error 1226
--error ER_USER_LIMIT_REACHED
select * from t1;
# cleanup
connection default;
@ -50,12 +53,12 @@ select * from t1;
select * from t1;
delete from t1;
delete from t1;
--error 1226
--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
connect (muph2, localhost, mysqltest_1,,);
connection muph2;
--error 1226
--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
# Cleanup
@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
connection mcph2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Old connection is still ok
select * from t1;
@ -83,7 +86,7 @@ select * from t1;
disconnect mcph1;
disconnect mcph2;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Cleanup
connection default;
@ -101,13 +104,13 @@ connect (muc2, localhost, mysqltest_1,,);
connection muc2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muc3, localhost, mysqltest_1,,);
# Closing of one of connections should help
disconnect muc1;
connect (muc3, localhost, mysqltest_1,,);
select * from t1;
# Changing of limit should also help (and immediately)
# Changing of limit should also help (and immediately)
connection default;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
flush user_resources;
@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
connection muc4;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muc5, localhost, mysqltest_1,,);
# Clean up
connection default;
@ -129,10 +132,10 @@ drop user mysqltest_1@localhost;
select @@session.max_user_connections, @@global.max_user_connections;
# Local max_user_connections variable can't be set directly
# since this limit is per-account
--error 1229
set session max_user_connections= 2;
--error ER_GLOBAL_VARIABLE
set session max_user_connections= 2;
# But it is ok to set global max_user_connections
set global max_user_connections= 2;
set global max_user_connections= 2;
select @@session.max_user_connections, @@global.max_user_connections;
# Let us check that global limit works
grant usage on *.* to mysqltest_1@localhost;
@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
connection muca2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1203
--error ER_TOO_MANY_USER_CONNECTIONS
connect (muca3, localhost, mysqltest_1,,);
# Now we are testing that per-account limit prevails over gloabl limit
connection default;
@ -154,16 +157,20 @@ connect (muca3, localhost, mysqltest_1,,);
connection muca3;
select @@session.max_user_connections, @@global.max_user_connections;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muca4, localhost, mysqltest_1,,);
# Cleanup
connection default;
disconnect muca1;
disconnect muca2;
disconnect muca3;
set global max_user_connections= 0;
set global max_user_connections= 0;
drop user mysqltest_1@localhost;
--enable_ps_protocol
# Final cleanup
drop table t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
# Can't test with embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# simple test of grants
grant create view on test.* to test@localhost;
show grants for test@localhost;
@ -26,19 +29,19 @@ grant create view,select on test.* to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
create definer=root@localhost view v1 as select * from mysqltest.t1;
create view v1 as select * from mysqltest.t1;
# try to modify view without DROP privilege on it
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
alter view v1 as select * from mysqltest.t1;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create or replace view v1 as select * from mysqltest.t1;
# no CRETE VIEW privilege
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v2 as select * from mysqltest.t1;
# no SELECT privilege
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create view v2 as select * from mysqltest.t2;
connection root;
@ -48,7 +51,7 @@ show create view v1;
grant create view,drop,select on test.* to mysqltest_1@localhost;
connection user1;
# following 'use' command is workaround of bug #9582 and should be removed
# following 'use' command is workaround of Bug#9582 and should be removed
# when that bug will be fixed
use test;
alter view v1 as select * from mysqltest.t1;
@ -76,7 +79,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
select c from mysqltest.v1;
# there are no privileges on column 'd'
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1;
connection root;
@ -96,7 +99,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
select c from mysqltest.v1;
# there are no privileges on column 'd'
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1;
connection root;
@ -111,7 +114,7 @@ connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
#prepare views and tables
# prepare views and tables
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
@ -133,21 +136,21 @@ select c from mysqltest.v4;
show columns from mysqltest.v1;
show columns from mysqltest.v2;
# but explain/show do not
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v1;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v2;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4;
# allow to see one of underlying table
@ -156,19 +159,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
connection user1;
# EXPLAIN of view on above table works
explain select c from mysqltest.v1;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1;
explain select c from mysqltest.v2;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2;
# but other EXPLAINs do not
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4;
# allow to see any view in mysqltest database
@ -222,14 +225,14 @@ select * from t1;
update v2 set a=a+c;
select * from t1;
# no rights on column
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update v2 set c=a+c;
# no rights for view
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update v3 set a=a+c;
use test;
@ -263,9 +266,9 @@ select * from t1;
delete v1 from t2,v1 where t2.x=v1.c;
select * from t1;
# no rights for view
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete v2 from t2,v2 where t2.x=v2.c;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from v2 where c < 4;
use test;
@ -299,9 +302,9 @@ select * from t1;
insert into v1 select x,y from t2;
select * from t1;
# no rights for view
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
insert into v2 values (5,6);
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
insert into v2 select x,y from t2;
use test;
@ -329,10 +332,10 @@ connection user1;
create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2;
# There are not rights on mysqltest.v1
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v1 as select * from mysqltest.t1;
# There are not any rights on mysqltest.t2.a
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
create view v3 as select a from mysqltest.t2;
# give CREATE VIEW privileges (without any privileges for result column)
@ -352,13 +355,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2;
connection root;
grant create view,update,select on test.* to mysqltest_1@localhost;
connection user1;
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2;
connection root;
@ -411,7 +414,7 @@ connection root;
# check view definer information
show create view v1;
revoke select on mysqltest.t1 from mysqltest_1@localhost;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v1;
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
@ -420,7 +423,7 @@ drop view v1;
drop database mysqltest;
#
# rights on execution of view underlying functiond (BUG#9505)
# rights on execution of view underlying functiond (Bug#9505)
#
connection root;
--disable_warnings
@ -453,11 +456,11 @@ connection user1;
use mysqltest;
select * from v1;
select * from v2;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v3;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
use test;
@ -505,13 +508,13 @@ use test;
connection root;
create view v5 as select * from v1;
revoke execute on function f2 from mysqltest_1@localhost;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v1;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v2;
select * from v3;
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
drop view v1, v2, v3, v4, v5;
@ -549,13 +552,13 @@ use test;
connection root;
revoke select on t1 from mysqltest_1@localhost;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v1;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v2;
select * from v3;
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
#drop view v1, v2, v3, v4, v5;
@ -588,11 +591,11 @@ connection user1;
use mysqltest;
select * from v1;
select * from v2;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v3;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
use test;
@ -604,7 +607,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
#
# BUG#14256: definer in view definition is not fully qualified
# Bug#14256 definer in view definition is not fully qualified
#
--disable_warnings
drop view if exists v1;
@ -641,6 +644,7 @@ drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2;
connection root;
disconnect test14256;
drop user test14256;
# Restore the anonymous users.
@ -650,8 +654,8 @@ flush privileges;
drop table t1;
#
# BUG#14726: freeing stack variable in case of an error of opening
# a view when we have locked tables with LOCK TABLES statement.
# Bug#14726 freeing stack variable in case of an error of opening a view when
# we have locked tables with LOCK TABLES statement.
#
connection root;
--disable_warnings
@ -668,7 +672,7 @@ connection user1;
use mysqltest;
LOCK TABLES v1 READ;
-- error ER_TABLEACCESS_DENIED_ERROR
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE v1;
UNLOCK TABLES;
use test;
@ -679,7 +683,7 @@ drop user mysqltest_1@localhost;
drop database mysqltest;
#
# switch to default connaction
# switch to default connection
#
disconnect user1;
disconnect root;
@ -696,7 +700,7 @@ drop view v1;
drop view v2;
#
# Bug#18681: View privileges are broken
# Bug#18681 View privileges are broken
#
CREATE DATABASE mysqltest1;
CREATE USER readonly@localhost;
@ -717,54 +721,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
CONNECT (n1,localhost,readonly,,);
CONNECTION n1;
connect (n1,localhost,readonly,,);
connection n1;
--error 1356
--error ER_VIEW_INVALID
SELECT * FROM mysqltest1.v_t1;
--error 1356
--error ER_VIEW_INVALID
INSERT INTO mysqltest1.v_t1 VALUES(4);
--error 1356
--error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1 WHERE x = 1;
--error 1356
--error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
--error 1356
--error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3;
--error 1356
--error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1;
--error 1356
--error ER_VIEW_INVALID
SELECT 1 FROM mysqltest1.v_t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.v_ts;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ti;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
INSERT INTO mysqltest1.v_ts VALUES (100);
INSERT INTO mysqltest1.v_ti VALUES (100);
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200;
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tu SET x= 200;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts WHERE x= 200;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_td WHERE x= 200;
DELETE FROM mysqltest1.v_tds WHERE x= 200;
DELETE FROM mysqltest1.v_td;
CONNECTION default;
connection default;
disconnect n1;
DROP VIEW mysqltest1.v_tds;
DROP VIEW mysqltest1.v_td;
DROP VIEW mysqltest1.v_tus;
@ -777,21 +782,21 @@ DROP USER readonly@localhost;
DROP DATABASE mysqltest1;
#
# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
# Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
#
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
#--warning 1448
#--warning ER_VIEW_OTHER_USER
SHOW CREATE VIEW v;
--error 1449
--error ER_NO_SUCH_USER
SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
USE test;
#
# Bug#20363: Create view on just created view is now denied
# Bug#20363 Create view on just created view is now denied
#
eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
@ -822,6 +827,7 @@ SELECT * FROM view2;
SELECT * from view3;
connection default;
disconnect session1;
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
@ -829,8 +835,8 @@ DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
#
# BUG#20482: failure on Create join view with sources views/tables
# in different schemas
# Bug#20482 failure on Create join view with sources views/tables
# in different schemas
#
--disable_warnings
CREATE DATABASE test1;
@ -840,7 +846,7 @@ CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
CREATE OR REPLACE VIEW test.v1 AS
CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
@ -851,8 +857,8 @@ DROP DATABASE test1;
#
# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER
# returns invoker name
# Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
# invoker name
#
--disable_warnings
DROP VIEW IF EXISTS v1;
@ -911,7 +917,7 @@ DROP USER mysqltest_u1@localhost;
#
# Bug#17254: Error for DEFINER security on VIEW provides too much info
# Bug#17254 Error for DEFINER security on VIEW provides too much info
#
connect (root,localhost,root,,);
connection root;
@ -935,12 +941,12 @@ DROP USER def_17254@localhost;
connect (inv,localhost,inv_17254,,db17254);
connection inv;
--echo for a user
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM v1;
connection root;
--echo for a superuser
--error 1449
--error ER_NO_SUCH_USER
SELECT * FROM v1;
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
@ -949,7 +955,7 @@ disconnect inv;
#
# BUG#24404: strange bug with view+permission+prepared statement
# Bug#24404 strange bug with view+permission+prepared statement
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest_db1;
@ -1017,8 +1023,8 @@ DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
#
# Bug#26813: The SUPER privilege is wrongly required to alter a view created
# by another user.
# Bug#26813 The SUPER privilege is wrongly required to alter a view created
# by another user.
#
connection root;
CREATE DATABASE db26813;
@ -1050,7 +1056,7 @@ DROP DATABASE db26813;
disconnect u1;
--echo #
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
--echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
--echo #
connection root;
CREATE DATABASE mysqltest_29908;
@ -1095,7 +1101,7 @@ disconnect u2;
--echo #######################################################################
#
# BUG#24040: Create View don't succed with "all privileges" on a database.
# Bug#24040 Create View don't succed with "all privileges" on a database.
#
# Prepare.
@ -1179,7 +1185,7 @@ SELECT * FROM mysqltest1.t4;
# Cleanup.
-- disconnect bug24040_con
disconnect bug24040_con;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
@ -1187,8 +1193,8 @@ DROP USER mysqltest_u1@localhost;
#
# Bug #41354: Access control is bypassed when all columns of a view are
# selected by * wildcard
# Bug#41354 Access control is bypassed when all columns of a view are
# selected by * wildcard
CREATE DATABASE db1;
USE db1;
@ -1202,7 +1208,6 @@ connect (addconfoo, localhost, foo,,);
connection addconfoo;
USE db1;
SELECT f1 FROM t1;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT f2 FROM t1;
@ -1216,8 +1221,9 @@ SELECT f2 FROM v1;
SELECT * FROM v1;
connection default;
USE test;
disconnect root;
disconnect addconfoo;
USE test;
REVOKE SELECT (f1) ON db1.t1 FROM foo;
REVOKE SELECT (f1) ON db1.v1 FROM foo;
DROP USER foo;
@ -1225,4 +1231,8 @@ DROP VIEW db1.v1;
DROP TABLE db1.t1;
DROP DATABASE db1;
connection default;
--echo End of 5.0 tests.
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -2,7 +2,7 @@
-- source include/not_embedded.inc
#
# Bug #8731: wait_timeout does not work on Mac OS X
# Bug#8731 wait_timeout does not work on Mac OS X
#
@ -87,6 +87,7 @@ while (!`select @aborted_clients`)
}
}
--enable_query_log
disconnect wait_con;
connection con1;
# When the connection is closed in this way, the error code should
@ -97,3 +98,5 @@ select 2;
--enable_reconnect
select 3;
disconnect con1;
# The last connect is to keep tools checking the current test happy.
connect (default,localhost,root,,test,,);

View File

@ -2,6 +2,10 @@
# WL#1756
#
-- source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@ -14,10 +18,10 @@ xa rollback 'test1';
select * from t1;
xa start 'test2';
--error 1399
--error ER_XAER_RMFAIL
xa start 'test-bad';
insert t1 values (20);
--error 1399
--error ER_XAER_RMFAIL
xa prepare 'test2';
xa end 'test2';
xa prepare 'test2';
@ -27,22 +31,22 @@ select * from t1;
xa start 'testa','testb';
insert t1 values (30);
--error 1399
--error ER_XAER_RMFAIL
commit;
xa end 'testa','testb';
--error 1399
--error ER_XAER_RMFAIL
begin;
--error 1399
--error ER_XAER_RMFAIL
create table t2 (a int);
connect (con1,localhost,root,,);
connection con1;
--error 1440
--error ER_XAER_DUPID
xa start 'testa','testb';
--error 1440
--error ER_XAER_DUPID
xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ]
@ -51,7 +55,7 @@ insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
--error 1399
--error ER_XAER_RMFAIL
start transaction;
xa recover;
@ -64,11 +68,11 @@ xa prepare 'testa','testb';
xa recover;
--error 1397
--error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb';
--error 1064
--error ER_PARSE_ERROR
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select * from t1;
@ -119,3 +123,7 @@ xa start 'a','c';
drop table t1;
--echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc