Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7c4e55cb
Commit
7c4e55cb
authored
Mar 05, 2009
by
Matthias Leich
Browse files
Options
Browse Files
Download
Plain Diff
Merge of fix for Bug#42003 and Bug#43114 into more actual GCA tree
modifications according to the reviews are included
parents
6ac6c9ed
b771483b
Changes
39
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1386 additions
and
935 deletions
+1386
-935
mysql-test/include/wait_until_count_sessions.inc
mysql-test/include/wait_until_count_sessions.inc
+23
-10
mysql-test/r/consistent_snapshot.result
mysql-test/r/consistent_snapshot.result
+20
-12
mysql-test/r/dirty_close.result
mysql-test/r/dirty_close.result
+5
-5
mysql-test/r/flush_block_commit.result
mysql-test/r/flush_block_commit.result
+46
-28
mysql-test/r/flush_block_commit_notembedded.result
mysql-test/r/flush_block_commit_notembedded.result
+19
-11
mysql-test/r/flush_read_lock_kill.result
mysql-test/r/flush_read_lock_kill.result
+10
-7
mysql-test/r/lock_multi.result
mysql-test/r/lock_multi.result
+4
-4
mysql-test/r/mysqlbinlog.result
mysql-test/r/mysqlbinlog.result
+17
-17
mysql-test/r/read_only.result
mysql-test/r/read_only.result
+1
-1
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+3
-3
mysql-test/r/skip_name_resolve.result
mysql-test/r/skip_name_resolve.result
+3
-3
mysql-test/r/sp-security.result
mysql-test/r/sp-security.result
+8
-8
mysql-test/r/view.result
mysql-test/r/view.result
+33
-33
mysql-test/r/view_grant.result
mysql-test/r/view_grant.result
+2
-2
mysql-test/t/alter_table-big.test
mysql-test/t/alter_table-big.test
+4
-3
mysql-test/t/connect.test
mysql-test/t/connect.test
+25
-13
mysql-test/t/consistent_snapshot.test
mysql-test/t/consistent_snapshot.test
+31
-13
mysql-test/t/dirty_close.test
mysql-test/t/dirty_close.test
+16
-5
mysql-test/t/flush_block_commit.test
mysql-test/t/flush_block_commit.test
+64
-32
mysql-test/t/flush_block_commit_notembedded.test
mysql-test/t/flush_block_commit_notembedded.test
+33
-14
mysql-test/t/flush_read_lock_kill.test
mysql-test/t/flush_read_lock_kill.test
+26
-9
mysql-test/t/init_connect.test
mysql-test/t/init_connect.test
+9
-1
mysql-test/t/lock_multi.test
mysql-test/t/lock_multi.test
+145
-58
mysql-test/t/mysqlbinlog.test
mysql-test/t/mysqlbinlog.test
+38
-37
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+14
-9
mysql-test/t/read_only.test
mysql-test/t/read_only.test
+18
-10
mysql-test/t/show_check.test
mysql-test/t/show_check.test
+41
-31
mysql-test/t/skip_name_resolve.test
mysql-test/t/skip_name_resolve.test
+13
-5
mysql-test/t/sp-security.test
mysql-test/t/sp-security.test
+34
-26
mysql-test/t/sp_notembedded.test
mysql-test/t/sp_notembedded.test
+25
-15
mysql-test/t/ssl-big.test
mysql-test/t/ssl-big.test
+18
-10
mysql-test/t/ssl.test
mysql-test/t/ssl.test
+8
-0
mysql-test/t/ssl_compress.test
mysql-test/t/ssl_compress.test
+10
-0
mysql-test/t/status.test
mysql-test/t/status.test
+7
-0
mysql-test/t/user_limits.test
mysql-test/t/user_limits.test
+24
-17
mysql-test/t/view.test
mysql-test/t/view.test
+461
-376
mysql-test/t/view_grant.test
mysql-test/t/view_grant.test
+106
-96
mysql-test/t/wait_timeout.test
mysql-test/t/wait_timeout.test
+4
-1
mysql-test/t/xa.test
mysql-test/t/xa.test
+18
-10
No files found.
mysql-test/include/wait_until_count_sessions.inc
View file @
7c4e55cb
...
@@ -2,11 +2,20 @@
...
@@ -2,11 +2,20 @@
#
#
# SUMMARY
# SUMMARY
#
#
# Waits until the passed number ($count_sessions) of concurrent sessions
was
# Waits until the passed number ($count_sessions) of concurrent sessions
or
# observed via
#
a smaller number was
observed via
# SHOW STATUS LIKE 'Threads_connected'
# SHOW STATUS LIKE 'Threads_connected'
# or the operation times out.
# or the operation times out.
# Note: Starting with 5.1 we could also use
# 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
# SELECT COUNT(*) FROM information_schema.processlist
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# I stay with "SHOW STATUS LIKE 'Threads_connected'" because this
# runs in all versions 5.0+
# runs in all versions 5.0+
...
@@ -19,7 +28,7 @@
...
@@ -19,7 +28,7 @@
#
#
# OR typical example of a test which uses more than one session
# 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
# 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
# If the testing box is slow than the disconnect of sessions belonging to
# the current test might happen when the successing test gets executed.
# the current test might happen when the successing test gets executed.
...
@@ -79,7 +88,11 @@
...
@@ -79,7 +88,11 @@
# backup.test, grant3.test
# 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
;
let
$wait_counter
=
100
;
...
@@ -93,7 +106,7 @@ let $wait_timeout= 0;
...
@@ -93,7 +106,7 @@ let $wait_timeout= 0;
while
(
$wait_counter
)
while
(
$wait_counter
)
{
{
let
$current_sessions
=
query_get_value
(
SHOW
STATUS
LIKE
'Threads_connected'
,
Value
,
1
);
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
)
if
(
$success
)
{
{
let
$wait_counter
=
0
;
let
$wait_counter
=
0
;
...
@@ -107,7 +120,7 @@ while ($wait_counter)
...
@@ -107,7 +120,7 @@ while ($wait_counter)
if
(
!
$success
)
if
(
!
$success
)
{
{
--
echo
# Timeout in wait_until_count_sessions.inc
--
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
;
SHOW
PROCESSLIST
;
}
}
mysql-test/r/consistent_snapshot.result
View file @
7c4e55cb
drop table if exists t1;
DROP TABLE IF EXISTS t1;
create table t1 (a int) engine=innodb;
# Establish connection con1 (user=root)
start transaction with consistent snapshot;
# Establish connection con2 (user=root)
insert into t1 values(1);
# Switch to connection con1
select * from t1;
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
a
commit;
COMMIT;
delete from t1;
DELETE FROM t1;
start transaction;
START TRANSACTION;
insert into t1 values(1);
# Switch to connection con2
select * from t1;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
SELECT * FROM t1;
a
a
1
1
commit;
COMMIT;
drop table t1;
# Switch to connection default + close connections con1 and con2
DROP TABLE t1;
mysql-test/r/dirty_close.result
View file @
7c4e55cb
drop table if exists
t1;
DROP TABLE IF EXISTS
t1;
create table t1 (n int
);
CREATE TABLE t1 (n INT
);
insert into t1 values
(1),(2),(3);
INSERT INTO t1 VALUES
(1),(2),(3);
select * from
t1;
SELECT * FROM
t1;
n
n
1
1
2
2
3
3
drop table
t1;
DROP TABLE
t1;
mysql-test/r/flush_block_commit.result
View file @
7c4e55cb
drop table if exists t1;
# Establish connection con1 (user=root)
create table t1 (a int) engine=innodb;
# Establish connection con2 (user=root)
begin;
# Establish connection con3 (user=root)
insert into t1 values(1);
# Switch to connection con1
flush tables with read lock;
DROP TABLE IF EXISTS t1;
select * from 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
a
commit;
# Switch to connection con1
select * from t1;
COMMIT;
# Switch to connection con2
SELECT * FROM t1;
a
a
unlock tables;
UNLOCK TABLES;
begin;
# Switch to connection con1
select * from t1 for update;
# Switch to connection con1
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
a
1
1
begin;
# Switch to connection con2
select * from t1 for update;
BEGIN;
flush tables with read lock;
SELECT * FROM t1 FOR UPDATE;
commit;
# Switch to connection con3
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
COMMIT;
# Switch to connection con2
a
a
1
1
unlock tables;
# Switch to connection con3
commit;
UNLOCK TABLES;
begin;
# Switch to connection con2
insert into t1 values(10);
COMMIT;
flush tables with read lock;
# Switch to connection con1
commit;
BEGIN;
unlock tables;
INSERT INTO t1 VALUES(10);
flush tables with read lock;
FLUSH TABLES WITH READ LOCK;
unlock tables;
COMMIT;
begin;
UNLOCK TABLES;
select * from t1;
# Switch to connection con2
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
SELECT * FROM t1;
a
a
1
1
10
10
show create database
test;
SHOW CREATE DATABASE
test;
Database Create Database
Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
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
mysql-test/r/flush_block_commit_notembedded.result
View file @
7c4e55cb
create table t1 (a int) engine=innodb;
# Establish connection con1 (user=root)
reset master;
# Establish connection con2 (user=root)
set autocommit=0;
# Switch to connection con1
insert t1 values (1);
CREATE TABLE t1 (a INT) ENGINE=innodb;
flush tables with read lock;
RESET MASTER;
show master status;
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
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
master-bin.000001 98
commit;
# Switch to connection con1
show master status;
COMMIT;
# Switch to connection con2
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
master-bin.000001 98
unlock tables;
UNLOCK TABLES;
drop table t1;
# Switch to connection con1
set autocommit=1;
DROP TABLE t1;
SET AUTOCOMMIT=1;
# Switch to connection default and close connections con1 and con2
mysql-test/r/flush_read_lock_kill.result
View file @
7c4e55cb
drop table if exists t1;
SET @old_concurrent_insert= @@global.concurrent_insert;
create table t1 (kill_id int);
SET @@global.concurrent_insert= 0;
insert into t1 values(connection_id());
DROP TABLE IF EXISTS t1;
flush tables with read lock;
CREATE TABLE t1 (kill_id INT);
select ((@id := kill_id) - kill_id) from t1;
INSERT INTO t1 VALUES(connection_id());
FLUSH TABLES WITH READ LOCK;
SELECT ((@id := kill_id) - kill_id) FROM t1;
((@id := kill_id) - kill_id)
((@id := kill_id) - kill_id)
0
0
kill connection @id;
KILL CONNECTION @id;
drop table t1;
DROP TABLE t1;
SET @@global.concurrent_insert= @old_concurrent_insert;
mysql-test/r/lock_multi.result
View file @
7c4e55cb
...
@@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
...
@@ -51,10 +51,10 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
UNLOCK TABLES;
UNLOCK TABLES;
DROP DATABASE mysqltest_1;
DROP DATABASE mysqltest_1;
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
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;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
FLUSH TABLES;
use
mysql;
USE
mysql;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
OPTIMIZE TABLES columns_priv, db, host, user;
OPTIMIZE TABLES columns_priv, db, host, user;
Table Op Msg_type Msg_text
Table Op Msg_type Msg_text
...
@@ -65,7 +65,7 @@ mysql.user optimize status OK
...
@@ -65,7 +65,7 @@ mysql.user optimize status OK
UNLOCK TABLES;
UNLOCK TABLES;
Select_priv
Select_priv
N
N
use
test;
USE
test;
use test;
use test;
CREATE TABLE t1 (c1 int);
CREATE TABLE t1 (c1 int);
LOCK TABLE t1 WRITE;
LOCK TABLE t1 WRITE;
...
@@ -93,7 +93,7 @@ create table t1 (a int);
...
@@ -93,7 +93,7 @@ create table t1 (a int);
connection: locker
connection: locker
lock tables t1 read;
lock tables t1 read;
connection: writer
connection: writer
create table t2 like t1;
;
create table t2 like t1;
connection: default
connection: default
kill query
kill query
ERROR 70100: Query execution was interrupted
ERROR 70100: Query execution was interrupted
...
...
mysql-test/r/mysqlbinlog.result
View file @
7c4e55cb
...
@@ -349,9 +349,9 @@ DELIMITER ;
...
@@ -349,9 +349,9 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
CREATE TABLE t1 (c1 CHAR(10));
CREATE TABLE t1 (c1 CHAR(10));
flush logs
;
FLUSH LOGS
;
INSERT INTO t1 VALUES ('0123456789');
INSERT INTO t1 VALUES ('0123456789');
flush logs
;
FLUSH LOGS
;
DROP TABLE t1;
DROP TABLE t1;
We expect this value to be 1
We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
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%';
...
@@ -361,23 +361,23 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1
BUG#28293_expect_1
1
1
DROP TABLE patch;
DROP TABLE patch;
flush logs
;
FLUSH LOGS
;
create table t1(a int
);
CREATE TABLE t1(a INT
);
insert into t1 values
(connection_id());
INSERT INTO t1 VALUES
(connection_id());
flush logs
;
FLUSH LOGS
;
drop table
t1;
DROP TABLE
t1;
1
1
drop table
t1;
DROP TABLE
t1;
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql
set
@@global.server_id= 4294967295;
SET
@@global.server_id= 4294967295;
reset master
;
RESET MASTER
;
flush logs
;
FLUSH LOGS
;
select
SELECT
(@a:=
load_file
("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
(@a:=
LOAD_FILE
("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null
;
IS NOT NULL
;
(@a:=
load_file
("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
(@a:=
LOAD_FILE
("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog"))
is not null
IS NOT NULL
1
1
*** Unsigned server_id 4294967295 is found: 1 ***
*** Unsigned server_id 4294967295 is found: 1 ***
set
@@global.server_id= 1;
SET
@@global.server_id= 1;
End of 5.0 tests
End of 5.0 tests
mysql-test/r/read_only.result
View file @
7c4e55cb
...
@@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt'
...
@@ -47,7 +47,7 @@ Note 1051 Unknown table 'ttt'
drop table t1,t2;
drop table t1,t2;
drop user test@localhost;
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_db1;
drop database if exists mysqltest_db2;
drop database if exists mysqltest_db2;
...
...
mysql-test/r/show_check.result
View file @
7c4e55cb
mysql-test/r/skip_name_resolve.result
View file @
7c4e55cb
...
@@ -5,10 +5,10 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
...
@@ -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'
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';
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';
DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
select user
();
SELECT USER
();
user
()
USER
()
#
#
show processlist
;
SHOW PROCESSLIST
;
Id User Host db Command Time State Info
Id User Host db Command Time State Info
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>
<id> root <host> test <command> <time> <state> <info>
mysql-test/r/sp-security.result
View file @
7c4e55cb
...
@@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table
...
@@ -332,7 +332,7 @@ ERROR 42000: SELECT command denied to user 'user_bug14533'@'localhost' for table
drop user user_bug14533@localhost;
drop user user_bug14533@localhost;
drop database db_bug14533;
drop database db_bug14533;
CREATE DATABASE db_bug7787;
CREATE DATABASE db_bug7787;
use
db_bug7787;
USE
db_bug7787;
CREATE PROCEDURE p1()
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
SHOW INNODB STATUS;
Warnings:
Warnings:
...
@@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
...
@@ -352,12 +352,12 @@ GRANT SUPER ON *.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_2_con
---> connection: mysqltest_2_con
use
mysqltest;
USE
mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE PROCEDURE wl2897_p1() SELECT 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
---> connection: mysqltest_1_con
---> connection: mysqltest_1_con
use
mysqltest;
USE
mysqltest;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
ERROR 42000: Access denied; you need the SUPER privilege for this operation
ERROR 42000: Access denied; you need the SUPER privilege for this operation
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
...
@@ -373,7 +373,7 @@ Warnings:
...
@@ -373,7 +373,7 @@ Warnings:
Note 1449 There is no 'a @ b @ c'@'localhost' registered
Note 1449 There is no 'a @ b @ c'@'localhost' registered
---> connection: con1root
---> connection: con1root
use
mysqltest;
USE
mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p1;
Procedure sql_mode Create Procedure
Procedure sql_mode Create Procedure
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`()
...
@@ -403,7 +403,7 @@ CREATE USER mysqltest_2@localhost;
...
@@ -403,7 +403,7 @@ CREATE USER mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
---> connection: mysqltest_1_con
---> connection: mysqltest_1_con
use
mysqltest;
USE
mysqltest;
CREATE PROCEDURE bug13198_p1()
CREATE PROCEDURE bug13198_p1()
SELECT 1;
SELECT 1;
CREATE FUNCTION bug13198_f1() RETURNS INT
CREATE FUNCTION bug13198_f1() RETURNS INT
...
@@ -416,7 +416,7 @@ bug13198_f1()
...
@@ -416,7 +416,7 @@ bug13198_f1()
1
1
---> connection: mysqltest_2_con
---> connection: mysqltest_2_con
use
mysqltest;
USE
mysqltest;
CALL bug13198_p1();
CALL bug13198_p1();
1
1
1
1
...
@@ -428,7 +428,7 @@ bug13198_f1()
...
@@ -428,7 +428,7 @@ bug13198_f1()
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_1@localhost;
---> connection: mysqltest_2_con
---> connection: mysqltest_2_con
use
mysqltest;
USE
mysqltest;
CALL bug13198_p1();
CALL bug13198_p1();
ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
ERROR HY000: There is no 'mysqltest_1'@'localhost' registered
SELECT bug13198_f1();
SELECT bug13198_f1();
...
@@ -445,7 +445,7 @@ Host User Password
...
@@ -445,7 +445,7 @@ Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
---> connection: mysqltest_2_con
---> connection: mysqltest_2_con
use
test;
USE
test;
CREATE PROCEDURE sp19857() DETERMINISTIC
CREATE PROCEDURE sp19857() DETERMINISTIC
BEGIN
BEGIN
DECLARE a INT;
DECLARE a INT;
...
...
mysql-test/r/view.result
View file @
7c4e55cb
...
@@ -3603,7 +3603,7 @@ DROP VIEW v2;
...
@@ -3603,7 +3603,7 @@ DROP VIEW v2;
DROP VIEW v3;
DROP VIEW v3;
DROP TABLE t1;
DROP TABLE t1;
#
#
# Bug#29477
:
Not all fields of the target table were checked to have
# Bug#29477 Not all fields of the target table were checked to have
# a default value when inserting into a view.
# a default value when inserting into a view.
#
#
create table t1(f1 int, f2 int not null);
create table t1(f1 int, f2 int not null);
...
@@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a)
...
@@ -3643,7 +3643,7 @@ MAX(a) COUNT(DISTINCT a)
DROP VIEW v1;
DROP VIEW v1;
DROP TABLE t1;
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;
DROP TABLE IF EXISTS t1;
...
@@ -3660,7 +3660,7 @@ DROP TABLE t1;
...
@@ -3660,7 +3660,7 @@ DROP TABLE t1;
# -- End of test case for Bug#34337.
# -- End of test case for Bug#34337.
# -----------------------------------------------------------------
# -----------------------------------------------------------------
# -- Bug#35193
:
VIEW query is rewritten without "FROM DUAL",
# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
# -- causing syntax error
# -- causing syntax error
# -----------------------------------------------------------------
# -----------------------------------------------------------------
...
...
mysql-test/r/view_grant.result
View file @
7c4e55cb
...
@@ -788,7 +788,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
...
@@ -788,7 +788,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP USER u26813@localhost;
DROP USER u26813@localhost;
DROP DATABASE db26813;
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;
CREATE DATABASE mysqltest_29908;
USE mysqltest_29908;
USE mysqltest_29908;
...
...
mysql-test/t/alter_table-big.test
View file @
7c4e55cb
# In order to be more or less robust test for
b
ug#25044 has to take
# In order to be more or less robust test for
B
ug#25044 has to take
# significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode.
# so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog.
# Also in 5.1 this test will require statement-based binlog.
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
#
#
# Test for
bug #25044 "
ALTER TABLE ... ENABLE KEYS acquires global
# Test for
Bug#25044
ALTER TABLE ... ENABLE KEYS acquires global
#
'opening tables' lock".
#
'opening tables' lock
#
#
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution.
# the whole its duration as it prevents other queries from execution.
...
@@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
...
@@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
# Clean up
# Clean up
drop
tables
t1
,
t2
;
drop
tables
t1
,
t2
;
disconnect
addconroot
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
mysql-test/t/connect.test
View file @
7c4e55cb
...
@@ -18,12 +18,16 @@ connect (con2,localhost,root,,test);
...
@@ -18,12 +18,16 @@ connect (con2,localhost,root,,test);
show
tables
;
show
tables
;
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
root
,
z
,
test2
);
connect
(
fail_con
,
localhost
,
root
,
z
,
test2
);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
root
,
z
,);
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
@
localhost
identified
by
"gambling"
;
grant
ALL
on
*.*
to
test
@
127.0
.
0.1
identified
by
"gambling"
;
grant
ALL
on
*.*
to
test
@
127.0
.
0.1
identified
by
"gambling"
;
...
@@ -35,20 +39,23 @@ show tables;
...
@@ -35,20 +39,23 @@ show tables;
connect
(
con4
,
localhost
,
test
,
gambling
,
test
);
connect
(
con4
,
localhost
,
test
,
gambling
,
test
);
show
tables
;
show
tables
;
connection
default
;
disconnect
con3
;
disconnect
con4
;
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,,
test2
);
connect
(
fail_con
,
localhost
,
test
,,
test2
);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,,
""
);
connect
(
fail_con
,
localhost
,
test
,,
""
);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,
zorro
,
test2
);
connect
(
fail_con
,
localhost
,
test
,
zorro
,
test2
);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,
zorro
,);
connect
(
fail_con
,
localhost
,
test
,
zorro
,);
# check if old password version also works
# check if old password version also works
update
mysql
.
user
set
password
=
old_password
(
"gambling2"
)
where
user
=
_binary
"test"
;
update
mysql
.
user
set
password
=
old_password
(
"gambling2"
)
where
user
=
_binary
"test"
;
flush
privileges
;
flush
privileges
;
...
@@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,);
...
@@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,);
connect
(
con5
,
localhost
,
test
,
gambling2
,
mysql
);
connect
(
con5
,
localhost
,
test
,
gambling2
,
mysql
);
connection
con5
;
connection
con5
;
set
password
=
""
;
set
password
=
""
;
--
error
1372
--
error
ER_PASSWD_LENGTH
set
password
=
'gambling3'
;
set
password
=
'gambling3'
;
set
password
=
old_password
(
'gambling3'
);
set
password
=
old_password
(
'gambling3'
);
show
tables
;
show
tables
;
connect
(
con6
,
localhost
,
test
,
gambling3
,
test
);
connect
(
con6
,
localhost
,
test
,
gambling3
,
test
);
show
tables
;
show
tables
;
connection
default
;
disconnect
con10
;
disconnect
con5
;
disconnect
con6
;
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,,
test2
);
connect
(
fail_con
,
localhost
,
test
,,
test2
);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,,);
connect
(
fail_con
,
localhost
,
test
,,);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,
zorro
,
test2
);
connect
(
fail_con
,
localhost
,
test
,
zorro
,
test2
);
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
replace_result
$MASTER_MYSOCK
MASTER_SOCKET
$MASTER_MYPORT
MASTER_PORT
--
error
1045
--
error
ER_ACCESS_DENIED_ERROR
connect
(
fail_con
,
localhost
,
test
,
zorro
,);
connect
(
fail_con
,
localhost
,
test
,
zorro
,);
# remove user 'test' so that other tests which may use 'test'
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
# do not depend on this test.
delete
from
mysql
.
user
where
user
=
_binary
"test"
;
delete
from
mysql
.
user
where
user
=
_binary
"test"
;
flush
privileges
;
flush
privileges
;
...
@@ -98,4 +109,5 @@ disconnect con7;
...
@@ -98,4 +109,5 @@ disconnect con7;
connection
default
;
connection
default
;
drop
table
t1
;
drop
table
t1
;
# End of 4.1 tests
# End of 4.1 tests
mysql-test/t/consistent_snapshot.test
View file @
7c4e55cb
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
--
echo
# Establish connection con1 (user=root)
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
--
echo
# Establish connection con2 (user=root)
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
### Test 1:
### Test 1:
### - While a consistent snapshot transaction is executed,
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
### no external inserts should be visible to the transaction.
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
create
table
t1
(
a
int
)
engine
=
innodb
;
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
innodb
;
start
transaction
with
consistent
snapshot
;
START
TRANSACTION
WITH
CONSISTENT
SNAPSHOT
;
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
insert
into
t1
values
(
1
);
INSERT
INTO
t1
VALUES
(
1
);
--
echo
# Switch to connection con1
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.
# should see nothing.
commit
;
COMMIT
;
### Test 2:
### Test 2:
### - For any non-consistent snapshot transaction, external
### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction.
### committed inserts should be visible to the transaction.
delete
from
t1
;
DELETE
FROM
t1
;
start
transaction
;
# Now we omit WITH CONSISTENT SNAPSHOT
START
TRANSACTION
;
# Now we omit WITH CONSISTENT SNAPSHOT
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
insert
into
t1
values
(
1
);
INSERT
INTO
t1
VALUES
(
1
);
--
echo
# Switch to connection con1
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.
# 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
# End of 4.1 tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/dirty_close.test
View file @
7c4e55cb
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connection
con1
;
connection
con1
;
...
@@ -5,12 +9,19 @@ dirty_close con1;
...
@@ -5,12 +9,19 @@ dirty_close con1;
connection
con2
;
connection
con2
;
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
create
table
t1
(
n
int
);
CREATE
TABLE
t1
(
n
INT
);
insert
into
t1
values
(
1
),(
2
),(
3
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
);
select
*
from
t1
;
SELECT
*
FROM
t1
;
drop
table
t1
;
DROP
TABLE
t1
;
connection
default
;
disconnect
con2
;
# End of 4.1 tests
# End of 4.1 tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/flush_block_commit.test
View file @
7c4e55cb
...
@@ -4,74 +4,106 @@
...
@@ -4,74 +4,106 @@
# This is intended to mimick how mysqldump and innobackup work.
# This is intended to mimick how mysqldump and innobackup work.
# And it requires InnoDB
# 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
,,);
connect
(
con1
,
localhost
,
root
,,);
--
echo
# Establish connection con2 (user=root)
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
--
echo
# Establish connection con3 (user=root)
connect
(
con3
,
localhost
,
root
,,);
connect
(
con3
,
localhost
,
root
,,);
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
create
table
t1
(
a
int
)
engine
=
innodb
;
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
innodb
;
# blocks COMMIT ?
# blocks COMMIT ?
begin
;
BEGIN
;
insert
into
t1
values
(
1
);
INSERT
INTO
t1
VALUES
(
1
);
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
flush
tables
with
read
lock
;
FLUSH
TABLES
WITH
READ
LOCK
;
select
*
from
t1
;
SELECT
*
FROM
t1
;
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
send
commit
;
# blocked by con2
send
COMMIT
;
# blocked by con2
sleep
1
;
sleep
1
;
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
select
*
from
t1
;
# verify con1 was blocked and data did not move
SELECT
*
FROM
t1
;
# verify con1 was blocked and data did not move
unlock
tables
;
UNLOCK
TABLES
;
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
reap
;
reap
;
# No deadlock ?
# No deadlock ?
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
begin
;
BEGIN
;
select
*
from
t1
for
update
;
SELECT
*
FROM
t1
FOR
UPDATE
;
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
begin
;
BEGIN
;
send
select
*
from
t1
for
update
;
# blocked by con1
send
SELECT
*
FROM
t1
FOR
UPDATE
;
# blocked by con1
sleep
1
;
sleep
1
;
--
echo
# Switch to connection con3
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
;
connection
con1
;
commit
;
# should not be blocked by con3
COMMIT
;
# should not be blocked by con3
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
reap
;
reap
;
--
echo
# Switch to connection con3
connection
con3
;
connection
con3
;
reap
;
reap
;
unlock
tables
;
UNLOCK
TABLES
;
# B
UG
#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# B
ug
#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK
# WITH READ LOCK
--
echo
# Switch to connection con2
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
;
connection
con1
;
begin
;
BEGIN
;
insert
into
t1
values
(
10
);
INSERT
INTO
t1
VALUES
(
10
);
flush
tables
with
read
lock
;
FLUSH
TABLES
WITH
READ
LOCK
;
commit
;
COMMIT
;
unlock
tables
;
UNLOCK
TABLES
;
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
flush
tables
with
read
lock
;
# bug caused hang here
FLUSH
TABLES
WITH
READ
LOCK
;
# bug caused hang here
unlock
tables
;
UNLOCK
TABLES
;
# Bug#7358 SHOW CREATE DATABASE fails if open transaction
BEGIN
;
SELECT
*
FROM
t1
;
SHOW
CREATE
DATABASE
test
;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction
DROP
TABLE
t1
;
begin
;
select
*
from
t1
;
show
create
database
test
;
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
# End of 4.1 tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/flush_block_commit_notembedded.test
View file @
7c4e55cb
...
@@ -3,32 +3,51 @@
...
@@ -3,32 +3,51 @@
# We verify that we did not introduce a deadlock.
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
# 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
# And it requires InnoDB
--
source
include
/
have_log_bin
.
inc
--
source
include
/
have_log_bin
.
inc
--
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
,,);
connect
(
con1
,
localhost
,
root
,,);
--
echo
# Establish connection con2 (user=root)
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
create
table
t1
(
a
int
)
engine
=
innodb
;
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
innodb
;
reset
master
;
RESET
MASTER
;
set
autocommit
=
0
;
SET
AUTOCOMMIT
=
0
;
insert
t1
values
(
1
);
INSERT
t1
VALUES
(
1
);
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
flush
tables
with
read
lock
;
FLUSH
TABLES
WITH
READ
LOCK
;
show
master
status
;
SHOW
MASTER
STATUS
;
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
send
commit
;
send
COMMIT
;
--
echo
# Switch to connection con2
connection
con2
;
connection
con2
;
sleep
1
;
sleep
1
;
show
master
status
;
SHOW
MASTER
STATUS
;
unlock
tables
;
UNLOCK
TABLES
;
--
echo
# Switch to connection con1
connection
con1
;
connection
con1
;
reap
;
reap
;
drop
table
t1
;
DROP
TABLE
t1
;
set
autocommit
=
1
;
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
mysql-test/t/flush_read_lock_kill.test
View file @
7c4e55cb
...
@@ -8,19 +8,27 @@
...
@@ -8,19 +8,27 @@
# won't test anything interesting).
# won't test anything interesting).
# This also won't work with the embedded server test
# 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
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connection
con1
;
connection
con1
;
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
;
DROP
TABLE
IF
EXISTS
t1
;
--
enable_warnings
--
enable_warnings
create
table
t1
(
kill_id
int
);
CREATE
TABLE
t1
(
kill_id
INT
);
insert
into
t1
values
(
connection_id
());
INSERT
INTO
t1
VALUES
(
connection_id
());
# Thanks to the parameter we passed to --debug, this FLUSH will
# Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It
# block on a debug build running with our --debug=make_global... It
...
@@ -28,14 +36,14 @@ insert into t1 values(connection_id());
...
@@ -28,14 +36,14 @@ insert into t1 values(connection_id());
# --debug) it will succeed immediately
# --debug) it will succeed immediately
connection
con1
;
connection
con1
;
send
flush
tables
with
read
lock
;
send
FLUSH
TABLES
WITH
READ
LOCK
;
# kill con1
# kill con1
connection
con2
;
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
--
sleep
2
# leave time for FLUSH to block
kill
connection
@
id
;
KILL
CONNECTION
@
id
;
connection
con1
;
connection
con1
;
# On debug builds it will be error 1053 (killed); on non-debug, or
# On debug builds it will be error 1053 (killed); on non-debug, or
...
@@ -46,4 +54,13 @@ connection con1;
...
@@ -46,4 +54,13 @@ connection con1;
reap
;
reap
;
connection
con2
;
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
mysql-test/t/init_connect.test
View file @
7c4e55cb
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
# should work with embedded server after mysqltest is fixed
# should work with embedded server after mysqltest is fixed
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
source
include
/
add_anonymous_users
.
inc
--
source
include
/
add_anonymous_users
.
inc
connect
(
con0
,
localhost
,
root
,,);
connect
(
con0
,
localhost
,
root
,,);
...
@@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
...
@@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection
con1
;
connection
con1
;
select
*
from
t1
;
select
*
from
t1
;
connection
con0
;
connection
default
;
disconnect
con0
;
disconnect
con1
;
disconnect
con1
;
drop
trigger
trg1
;
drop
trigger
trg1
;
...
@@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
...
@@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke
all
privileges
,
grant
option
from
mysqltest1
@
localhost
;
revoke
all
privileges
,
grant
option
from
mysqltest1
@
localhost
;
drop
user
mysqltest1
@
localhost
;
drop
user
mysqltest1
@
localhost
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/lock_multi.test
View file @
7c4e55cb
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
enable_warnings
...
@@ -14,12 +18,23 @@ create table t1(n int);
...
@@ -14,12 +18,23 @@ create table t1(n int);
insert
into
t1
values
(
1
);
insert
into
t1
values
(
1
);
lock
tables
t1
write
;
lock
tables
t1
write
;
connection
writer
;
connection
writer
;
send
update
low_priority
t1
set
n
=
4
;
send
update
low_priority
t1
set
n
=
4
;
connection
reader
;
connection
reader
;
--
sleep
2
# Sleep a bit till the update of connection writer is in work and hangs
send
select
n
from
t1
;
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
;
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
;
unlock
tables
;
connection
writer
;
connection
writer
;
reap
;
reap
;
...
@@ -32,12 +47,23 @@ create table t1(n int);
...
@@ -32,12 +47,23 @@ create table t1(n int);
insert
into
t1
values
(
1
);
insert
into
t1
values
(
1
);
lock
tables
t1
read
;
lock
tables
t1
read
;
connection
writer
;
connection
writer
;
send
update
low_priority
t1
set
n
=
4
;
send
update
low_priority
t1
set
n
=
4
;
connection
reader
;
connection
reader
;
--
sleep
2
# Sleep a bit till the update of connection writer is in work and hangs
send
select
n
from
t1
;
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
;
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
;
unlock
tables
;
connection
writer
;
connection
writer
;
reap
;
reap
;
...
@@ -58,10 +84,15 @@ insert into t1 values(2,2);
...
@@ -58,10 +84,15 @@ insert into t1 values(2,2);
insert
into
t2
values
(
1
,
2
);
insert
into
t2
values
(
1
,
2
);
lock
table
t1
read
;
lock
table
t1
read
;
connection
writer
;
connection
writer
;
--
sleep
2
# mleich: IMHO the "send is not necessary because the update should not block.
send
update
t1
,
t2
set
c
=
a
where
b
=
d
;
# 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
;
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
;
select
c
from
t2
;
connection
writer
;
connection
writer
;
reap
;
reap
;
...
@@ -70,7 +101,7 @@ drop table t1;
...
@@ -70,7 +101,7 @@ drop table t1;
drop
table
t2
;
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 drop
p
ing a table that
# is to-be-locked by another thread
# is to-be-locked by another thread
#
#
...
@@ -79,11 +110,18 @@ create table t1 (a int);
...
@@ -79,11 +110,18 @@ create table t1 (a int);
create
table
t2
(
a
int
);
create
table
t2
(
a
int
);
lock
table
t1
write
,
t2
write
;
lock
table
t1
write
,
t2
write
;
connection
reader
;
connection
reader
;
send
insert
t1
select
*
from
t2
;
send
insert
t1
select
*
from
t2
;
connection
locker
;
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
;
drop
table
t2
;
connection
reader
;
connection
reader
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
reap
;
reap
;
connection
locker
;
connection
locker
;
drop
table
t1
;
drop
table
t1
;
...
@@ -91,7 +129,7 @@ drop table t1;
...
@@ -91,7 +129,7 @@ drop table t1;
# End of 4.1 tests
# End of 4.1 tests
#
#
# B
UG#9998 -
MySQL client hangs on USE "database"
# B
ug#9998
MySQL client hangs on USE "database"
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
lock
tables
t1
write
;
lock
tables
t1
write
;
...
@@ -102,7 +140,7 @@ unlock tables;
...
@@ -102,7 +140,7 @@ unlock tables;
drop
table
t1
;
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
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
...
@@ -114,12 +152,18 @@ FLUSH TABLES WITH READ LOCK;
...
@@ -114,12 +152,18 @@ FLUSH TABLES WITH READ LOCK;
# With bug in place: acquire LOCK_mysql_create_table and
# With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock().
# wait in wait_if_global_read_lock().
connection
con2
;
connection
con2
;
send
DROP
DATABASE
mysqltest_1
;
send
--
sleep
1
DROP
DATABASE
mysqltest_1
;
#
#
# With bug in place: try to acquire LOCK_mysql_create_table...
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
# When fixed: Reject dropping db because of the read lock.
connection
con1
;
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
--
error
ER_CANT_UPDATE_WITH_READLOCK
DROP
DATABASE
mysqltest_1
;
DROP
DATABASE
mysqltest_1
;
UNLOCK
TABLES
;
UNLOCK
TABLES
;
...
@@ -135,26 +179,33 @@ disconnect con2;
...
@@ -135,26 +179,33 @@ disconnect con2;
--
error
ER_DB_DROP_EXISTS
--
error
ER_DB_DROP_EXISTS
DROP
DATABASE
mysqltest_1
;
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
# Need a matching user in mysql.user for multi-table select
--
source
include
/
add_anonymous_users
.
inc
--
source
include
/
add_anonymous_users
.
inc
connection
locker
;
connection
locker
;
use
mysql
;
USE
mysql
;
LOCK
TABLES
columns_priv
WRITE
,
db
WRITE
,
host
WRITE
,
user
WRITE
;
LOCK
TABLES
columns_priv
WRITE
,
db
WRITE
,
host
WRITE
,
user
WRITE
;
FLUSH
TABLES
;
FLUSH
TABLES
;
--
sleep
1
--
sleep
1
#
#
connection
reader
;
connection
reader
;
use
mysql
;
USE
mysql
;
#
NOTE
: This must be a multi-table select, otherwise the deadlock will not occur
#
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
;
send
--
sleep
1
SELECT
user
.
Select_priv
FROM
user
,
db
WHERE
user
.
user
=
db
.
user
LIMIT
1
;
#
#
connection
locker
;
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.
# Make test case independent from earlier grants.
--
replace_result
"Table is already up to date"
"OK"
--
replace_result
"Table is already up to date"
"OK"
OPTIMIZE
TABLES
columns_priv
,
db
,
host
,
user
;
OPTIMIZE
TABLES
columns_priv
,
db
,
host
,
user
;
...
@@ -162,7 +213,7 @@ UNLOCK TABLES;
...
@@ -162,7 +213,7 @@ UNLOCK TABLES;
#
#
connection
reader
;
connection
reader
;
reap
;
reap
;
use
test
;
USE
test
;
#
#
connection
locker
;
connection
locker
;
use
test
;
use
test
;
...
@@ -177,11 +228,17 @@ LOCK TABLE t1 WRITE;
...
@@ -177,11 +228,17 @@ LOCK TABLE t1 WRITE;
#
#
# This waits until t1 is unlocked.
# This waits until t1 is unlocked.
connection
locker
;
connection
locker
;
send
FLUSH
TABLES
WITH
READ
LOCK
;
send
--
sleep
1
FLUSH
TABLES
WITH
READ
LOCK
;
#
#
# This must not block.
# This must not block.
connection
writer
;
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
);
CREATE
TABLE
t2
(
c1
int
);
UNLOCK
TABLES
;
UNLOCK
TABLES
;
#
#
...
@@ -201,12 +258,18 @@ LOCK TABLE t1 WRITE;
...
@@ -201,12 +258,18 @@ LOCK TABLE t1 WRITE;
#
#
# This waits until t1 is unlocked.
# This waits until t1 is unlocked.
connection
locker
;
connection
locker
;
send
FLUSH
TABLES
WITH
READ
LOCK
;
send
--
sleep
1
FLUSH
TABLES
WITH
READ
LOCK
;
#
#
# This must not block.
# This must not block.
connection
writer
;
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
;
CREATE
TABLE
t2
AS
SELECT
*
FROM
t1
;
UNLOCK
TABLES
;
UNLOCK
TABLES
;
#
#
...
@@ -220,8 +283,9 @@ DROP TABLE t1;
...
@@ -220,8 +283,9 @@ DROP TABLE t1;
--
source
include
/
delete_anonymous_users
.
inc
--
source
include
/
delete_anonymous_users
.
inc
#
#
# Bug
#17264:
MySQL Server freeze
# Bug
#17264
MySQL Server freeze
#
#
connection
locker
;
connection
locker
;
# Disable warnings to allow test to run also without InnoDB
# 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
...
@@ -230,17 +294,29 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
--
enable_warnings
--
enable_warnings
lock
tables
t1
write
;
lock
tables
t1
write
;
connection
writer
;
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
//;
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
;
//
delimiter
;
//
connection
reader
;
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
//;
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
;
//
delimiter
;
//
connection
locker
;
connection
locker
;
--
sleep
2
# Wait till connection reader is blocked
# Here we cannot use include/wait_show_condition.inc.
--
sleep
3
unlock
tables
;
unlock
tables
;
connection
writer
;
connection
writer
;
reap
;
reap
;
...
@@ -263,7 +339,7 @@ lock tables t1 read;
...
@@ -263,7 +339,7 @@ lock tables t1 read;
--
echo
connection
:
writer
--
echo
connection
:
writer
connection
writer
;
connection
writer
;
let
$ID
=
`select connection_id()`
;
let
$ID
=
`select connection_id()`
;
--
send
create
table
t2
like
t1
;
send
create
table
t2
like
t1
;
--
echo
connection
:
default
--
echo
connection
:
default
connection
default
;
connection
default
;
let
$show_type
=
open
tables
where
in_use
=
2
and
name_locked
=
1
;
let
$show_type
=
open
tables
where
in_use
=
2
and
name_locked
=
1
;
...
@@ -282,7 +358,7 @@ connection default;
...
@@ -282,7 +358,7 @@ connection default;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#38691:
segfault/abort in ``UPDATE ...JOIN'' while
# Bug
#38691
segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
# ``FLUSH TABLES WITH READ LOCK''
#
#
...
@@ -354,7 +430,7 @@ while ($i) {
...
@@ -354,7 +430,7 @@ while ($i) {
dec
$i
;
dec
$i
;
--
connection
locker
--
connection
locker
--
error
0
,
1060
--
error
0
,
ER_DUP_FIELDNAME
ALTER
TABLE
t2
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
ALTER
TABLE
t2
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
UPDATE
t2
SET
a
=
b
;
UPDATE
t2
SET
a
=
b
;
...
@@ -362,11 +438,11 @@ while ($i) {
...
@@ -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
--
send
UPDATE
t2
INNER
JOIN
(
t1
JOIN
t3
USING
(
a
))
USING
(
a
)
SET
a
=
NULL
WHERE
t1
.
b
<>
t2
.
b
--
connection
locker
--
connection
locker
--
error
0
,
1091
--
error
0
,
ER_CANT_DROP_FIELD_OR_KEY
ALTER
TABLE
t2
DROP
COLUMN
a
;
ALTER
TABLE
t2
DROP
COLUMN
a
;
--
connection
writer
--
connection
writer
--
error
0
,
1054
--
error
0
,
ER_BAD_FIELD_ERROR
--
reap
--
reap
}
}
--
enable_query_log
--
enable_query_log
...
@@ -379,7 +455,7 @@ while ($i) {
...
@@ -379,7 +455,7 @@ while ($i) {
dec
$i
;
dec
$i
;
--
connection
locker
--
connection
locker
--
error
0
,
1060
--
error
0
,
ER_DUP_FIELDNAME
ALTER
TABLE
t2
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
ALTER
TABLE
t2
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
UPDATE
t2
SET
a
=
b
;
UPDATE
t2
SET
a
=
b
;
...
@@ -388,11 +464,11 @@ while ($i) {
...
@@ -388,11 +464,11 @@ while ($i) {
--
send
EXECUTE
stmt
--
send
EXECUTE
stmt
--
connection
locker
--
connection
locker
--
error
0
,
1091
--
error
0
,
ER_CANT_DROP_FIELD_OR_KEY
ALTER
TABLE
t2
DROP
COLUMN
a
;
ALTER
TABLE
t2
DROP
COLUMN
a
;
--
connection
writer
--
connection
writer
--
error
0
,
1054
--
error
0
,
ER_BAD_FIELD_ERROR
--
reap
--
reap
}
}
...
@@ -400,6 +476,7 @@ while ($i) {
...
@@ -400,6 +476,7 @@ while ($i) {
--
connection
default
--
connection
default
DROP
TABLE
t1
,
t2
,
t3
;
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
# crash
...
@@ -460,7 +537,7 @@ while ($i) {
...
@@ -460,7 +537,7 @@ while ($i) {
dec
$i
;
dec
$i
;
--
connection
locker
--
connection
locker
--
error
0
,
1060
--
error
0
,
ER_DUP_FIELDNAME
ALTER
TABLE
t1
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
ALTER
TABLE
t1
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
UPDATE
t1
SET
a
=
b
;
UPDATE
t1
SET
a
=
b
;
...
@@ -468,11 +545,11 @@ while ($i) {
...
@@ -468,11 +545,11 @@ while ($i) {
--
send
UPDATE
t1
,
(
SELECT
1
FROM
t1
t1i
)
d
SET
a
=
0
WHERE
1
=
0
;
--
send
UPDATE
t1
,
(
SELECT
1
FROM
t1
t1i
)
d
SET
a
=
0
WHERE
1
=
0
;
--
connection
locker
--
connection
locker
--
error
0
,
1091
--
error
0
,
ER_CANT_DROP_FIELD_OR_KEY
ALTER
TABLE
t1
DROP
COLUMN
a
;
ALTER
TABLE
t1
DROP
COLUMN
a
;
--
connection
writer
--
connection
writer
--
error
0
,
1054
# unknown column error
--
error
0
,
ER_BAD_FIELD_ERROR
# unknown column error
--
reap
--
reap
}
}
--
enable_query_log
--
enable_query_log
...
@@ -485,7 +562,7 @@ while ($i) {
...
@@ -485,7 +562,7 @@ while ($i) {
dec
$i
;
dec
$i
;
--
connection
locker
--
connection
locker
--
error
0
,
1060
--
error
0
,
ER_DUP_FIELDNAME
ALTER
TABLE
t1
ADD
COLUMN
a
INT
;
ALTER
TABLE
t1
ADD
COLUMN
a
INT
;
UPDATE
t1
SET
a
=
b
;
UPDATE
t1
SET
a
=
b
;
...
@@ -494,11 +571,11 @@ while ($i) {
...
@@ -494,11 +571,11 @@ while ($i) {
--
send
EXECUTE
stmt
--
send
EXECUTE
stmt
--
connection
locker
--
connection
locker
--
error
0
,
1091
--
error
0
,
ER_CANT_DROP_FIELD_OR_KEY
ALTER
TABLE
t1
DROP
COLUMN
a
;
ALTER
TABLE
t1
DROP
COLUMN
a
;
--
connection
writer
--
connection
writer
--
error
0
,
1054
# Unknown column 'a' in 'field list'
--
error
0
,
ER_BAD_FIELD_ERROR
# Unknown column 'a' in 'field list'
--
reap
--
reap
}
}
--
enable_query_log
--
enable_query_log
...
@@ -557,7 +634,7 @@ while ($i) {
...
@@ -557,7 +634,7 @@ while ($i) {
dec
$i
;
dec
$i
;
--
connection
locker
--
connection
locker
--
error
0
,
1060
--
error
0
,
ER_DUP_FIELDNAME
ALTER
TABLE
t1
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
ALTER
TABLE
t1
ADD
COLUMN
a
int
(
11
)
unsigned
default
NULL
;
UPDATE
t1
SET
a
=
b
;
UPDATE
t1
SET
a
=
b
;
...
@@ -565,11 +642,11 @@ while ($i) {
...
@@ -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
;
--
send
UPDATE
t1
,
((
SELECT
1
FROM
t1
t1i
)
UNION
(
SELECT
2
FROM
t1
t1ii
))
e
SET
a
=
0
WHERE
1
=
0
;
--
connection
locker
--
connection
locker
--
error
0
,
1091
--
error
0
,
ER_CANT_DROP_FIELD_OR_KEY
ALTER
TABLE
t1
DROP
COLUMN
a
;
ALTER
TABLE
t1
DROP
COLUMN
a
;
--
connection
writer
--
connection
writer
--
error
0
,
1054
# Unknown column 'a' in 'field list'
--
error
0
,
ER_BAD_FIELD_ERROR
# Unknown column 'a' in 'field list'
--
reap
--
reap
}
}
--
enable_query_log
--
enable_query_log
...
@@ -582,7 +659,7 @@ while ($i) {
...
@@ -582,7 +659,7 @@ while ($i) {
dec
$i
;
dec
$i
;
--
connection
locker
--
connection
locker
--
error
0
,
1060
--
error
0
,
ER_DUP_FIELDNAME
ALTER
TABLE
t1
ADD
COLUMN
a
INT
;
ALTER
TABLE
t1
ADD
COLUMN
a
INT
;
UPDATE
t1
SET
a
=
b
;
UPDATE
t1
SET
a
=
b
;
...
@@ -591,15 +668,25 @@ while ($i) {
...
@@ -591,15 +668,25 @@ while ($i) {
--
send
EXECUTE
stmt
--
send
EXECUTE
stmt
--
connection
locker
--
connection
locker
--
error
0
,
1091
--
error
0
,
ER_CANT_DROP_FIELD_OR_KEY
ALTER
TABLE
t1
DROP
COLUMN
a
;
ALTER
TABLE
t1
DROP
COLUMN
a
;
--
connection
writer
--
connection
writer
--
error
0
,
1054
# Unknown column 'a' in 'field list'
--
error
0
,
ER_BAD_FIELD_ERROR
# Unknown column 'a' in 'field list'
--
reap
--
reap
}
}
--
enable_query_log
--
enable_query_log
--
connection
default
--
connection
default
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# Close connections used in many subtests
--
disconnect
reader
--
disconnect
locker
--
disconnect
writer
# End of 5.0 tests
# End of 5.0 tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/mysqlbinlog.test
View file @
7c4e55cb
...
@@ -103,7 +103,7 @@ select "--- --position --" as "";
...
@@ -103,7 +103,7 @@ select "--- --position --" as "";
--
replace_regex
/
SQL_LOAD_MB
-
[
0
-
9
]
-
[
0
-
9
]
/
SQL_LOAD_MB
-
#-#/
--
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
--
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
--
disable_query_log
select
"--- reading stdin --"
as
""
;
select
"--- reading stdin --"
as
""
;
--
enable_query_log
--
enable_query_log
...
@@ -117,7 +117,7 @@ select "--- reading stdin --" as "";
...
@@ -117,7 +117,7 @@ select "--- reading stdin --" as "";
drop
table
t1
,
t2
;
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
;
flush
logs
;
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
bug14157
.
sql
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
bug14157
.
sql
...
@@ -174,7 +174,6 @@ flush logs;
...
@@ -174,7 +174,6 @@ flush logs;
call
p1
();
call
p1
();
drop
procedure
p1
;
drop
procedure
p1
;
--
error
ER_SP_DOES_NOT_EXIST
--
error
ER_SP_DOES_NOT_EXIST
call
p1
();
call
p1
();
--
replace_regex
/
SQL_LOAD_MB
-
[
0
-
9
]
-
[
0
-
9
]
/
SQL_LOAD_MB
-
#-#/
--
replace_regex
/
SQL_LOAD_MB
-
[
0
-
9
]
-
[
0
-
9
]
/
SQL_LOAD_MB
-
#-#/
--
exec
$MYSQL_BINLOG
--
short
-
form
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000007
--
exec
$MYSQL_BINLOG
--
short
-
form
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000007
...
@@ -222,9 +221,9 @@ flush logs;
...
@@ -222,9 +221,9 @@ flush logs;
CREATE
TABLE
t1
(
c1
CHAR
(
10
));
CREATE
TABLE
t1
(
c1
CHAR
(
10
));
# we need this for getting fixed timestamps inside of this test
# we need this for getting fixed timestamps inside of this test
flush
logs
;
FLUSH
LOGS
;
INSERT
INTO
t1
VALUES
(
'0123456789'
);
INSERT
INTO
t1
VALUES
(
'0123456789'
);
flush
logs
;
FLUSH
LOGS
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# We create a table, patch, and load the output into it
# We create a table, patch, and load the output into it
...
@@ -233,10 +232,10 @@ DROP TABLE t1;
...
@@ -233,10 +232,10 @@ DROP TABLE t1;
# as described in the original bug
# as described in the original bug
--
disable_query_log
--
disable_query_log
CREATE
TABLE
patch
(
a
blob
);
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
--
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'
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
--
remove_file
$MYSQLTEST_VARDIR
/
tmp
/
mysqlbinlog_tmp
.
dat
--
enable_query_log
--
enable_query_log
...
@@ -248,49 +247,51 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
...
@@ -248,49 +247,51 @@ SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP
TABLE
patch
;
DROP
TABLE
patch
;
#
#
# Bug
#29928:
incorrect connection_id() restoring from mysqlbinlog out
# Bug
#29928
incorrect connection_id() restoring from mysqlbinlog out
#
#
flush
logs
;
FLUSH
LOGS
;
create
table
t1
(
a
int
);
CREATE
TABLE
t1
(
a
INT
);
insert
into
t1
values
(
connection_id
());
INSERT
INTO
t1
VALUES
(
connection_id
());
let
$a
=
`
select a from
t1`
;
let
$a
=
`
SELECT a FROM
t1`
;
flush
logs
;
FLUSH
LOGS
;
--
exec
$MYSQL_BINLOG
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000013
>
$MYSQLTEST_VARDIR
/
tmp
/
bug29928
.
sql
--
exec
$MYSQL_BINLOG
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000013
>
$MYSQLTEST_VARDIR
/
tmp
/
bug29928
.
sql
drop
table
t1
;
DROP
TABLE
t1
;
connect
(
con1
,
localhost
,
root
,
,
test
);
connect
(
con1
,
localhost
,
root
,
,
test
);
connection
con1
;
connection
con1
;
--
exec
$MYSQL
test
<
$MYSQLTEST_VARDIR
/
tmp
/
bug29928
.
sql
--
exec
$MYSQL
test
<
$MYSQLTEST_VARDIR
/
tmp
/
bug29928
.
sql
--
remove_file
$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
;
disconnect
con1
;
connection
default
;
connection
default
;
let
$c
=
`
select
$a=$b`
;
let
$c
=
`
SELECT
$a=$b`
;
--
echo
$c
--
echo
$c
drop
table
t1
;
DROP
TABLE
t1
;
echo
shell
>
mysqlbinlog
std_data
/
corrupt
-
relay
-
bin
.
000624
>
var
/
tmp
/
bug31793
.
sql
;
echo
shell
>
mysqlbinlog
std_data
/
corrupt
-
relay
-
bin
.
000624
>
var
/
tmp
/
bug31793
.
sql
;
error
1
;
error
1
;
exec
$MYSQL_BINLOG
$MYSQL_TEST_DIR
/
std_data
/
corrupt
-
relay
-
bin
.
000624
>
$MYSQLTEST_VARDIR
/
tmp
/
bug31793
.
sql
;
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
$binlog_file
=
$MYSQLTEST_VARDIR
/
tmp
/
mysqlbinlog_bug37313
.
binlog
;
let
$s_id_max
=
`select (1 << 32) - 1`
;
let
$save_server_id
=
`SELECT @@global.server_id`
;
eval
set
@@
global
.
server_id
=
$s_id_max
;
let
$s_id_max
=
`SELECT (1 << 32) - 1`
;
eval
SET
@@
global
.
server_id
=
$s_id_max
;
reset
master
;
RESET
MASTER
;
flush
logs
;
FLUSH
LOGS
;
--
exec
$MYSQL_BINLOG
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000001
>
$
MYSQLTEST_VARDIR
/
tmp
/
mysqlbinlog_bug37313
.
binlog
--
exec
$MYSQL_BINLOG
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000001
>
$
binlog_file
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
select
eval
SELECT
(
@
a
:=
load_file
(
"
$MYSQLTEST_VARDIR
/tmp/mysqlbinlog_bug37313.binlog
"
))
(
@
a
:=
LOAD_FILE
(
"
$binlog_file
"
))
is
not
null
;
IS
NOT
NULL
;
let
$s_id_unsigned
=
`
select @a like
"%server id $s_id_max%" /* must return 1 */`
;
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
***
;
echo
***
Unsigned
server_id
$s_id_max
is
found
:
$s_id_unsigned
***
;
eval
set
@@
global
.
server_id
=
$save_server_id
;
eval
SET
@@
global
.
server_id
=
$save_server_id
;
--
remove_file
$
MYSQLTEST_VARDIR
/
tmp
/
mysqlbinlog_bug37313
.
binlog
--
remove_file
$
binlog_file
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
mysql-test/t/mysqltest.test
View file @
7c4e55cb
...
@@ -6,6 +6,9 @@
...
@@ -6,6 +6,9 @@
# This test uses chmod, can't be run with root permissions
# This test uses chmod, can't be run with root permissions
--
source
include
/
not_as_root
.
inc
--
source
include
/
not_as_root
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
# ============================================================================
# ============================================================================
#
#
# Test of mysqltest itself
# Test of mysqltest itself
...
@@ -2154,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
...
@@ -2154,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--
echo
End
of
tests
--
echo
End
of
tests
# Wait till we reached the initial number of concurrent sessions
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/read_only.test
View file @
7c4e55cb
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
# should work with embedded server after mysqltest is fixed
# should work with embedded server after mysqltest is fixed
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
disable_warnings
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
--
enable_warnings
--
enable_warnings
...
@@ -40,24 +43,24 @@ connection con1;
...
@@ -40,24 +43,24 @@ connection con1;
select
@@
global
.
read_only
;
select
@@
global
.
read_only
;
--
error
1290
--
error
ER_OPTION_PREVENTS_STATEMENT
create
table
t3
(
a
int
);
create
table
t3
(
a
int
);
--
error
1290
--
error
ER_OPTION_PREVENTS_STATEMENT
insert
into
t1
values
(
1
);
insert
into
t1
values
(
1
);
# if a statement, after parse stage, looks like it will update a
# 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
# non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated
# have turned out that 0 rows would be updated
--
error
1290
--
error
ER_OPTION_PREVENTS_STATEMENT
update
t1
set
a
=
1
where
1
=
0
;
update
t1
set
a
=
1
where
1
=
0
;
# multi-update is special (see sql_parse.cc) so we test it
# 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
;
update
t1
,
t2
set
t1
.
a
=
t2
.
a
+
1
where
t1
.
a
=
t2
.
a
;
# check multi-delete to be sure
# check multi-delete to be sure
--
error
1290
--
error
ER_OPTION_PREVENTS_STATEMENT
delete
t1
,
t2
from
t1
,
t2
where
t1
.
a
=
t2
.
a
;
delete
t1
,
t2
from
t1
,
t2
where
t1
.
a
=
t2
.
a
;
# With temp tables updates should be accepted:
# With temp tables updates should be accepted:
...
@@ -71,7 +74,7 @@ insert into t3 values(1);
...
@@ -71,7 +74,7 @@ insert into t3 values(1);
insert
into
t4
select
*
from
t3
;
insert
into
t4
select
*
from
t3
;
# a non-temp table updated:
# 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
;
update
t1
,
t3
set
t1
.
a
=
t3
.
a
+
1
where
t1
.
a
=
t3
.
a
;
# no non-temp table updated (just swapped):
# 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;
...
@@ -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
;
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
t1
from
t1
,
t3
where
t1
.
a
=
t3
.
a
;
delete
t3
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;
...
@@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop
table
t1
;
drop
table
t1
;
--
error
1290
--
error
ER_OPTION_PREVENTS_STATEMENT
insert
into
t1
values
(
1
);
insert
into
t1
values
(
1
);
#
#
# B
UG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
# B
ug#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
# check if DROP TEMPORARY on a non-existing temporary table returns the right
# error
# error
...
@@ -114,11 +117,12 @@ drop temporary table ttt;
...
@@ -114,11 +117,12 @@ drop temporary table ttt;
drop
temporary
table
if
exists
ttt
;
drop
temporary
table
if
exists
ttt
;
connection
default
;
connection
default
;
disconnect
con1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
drop
user
test
@
localhost
;
drop
user
test
@
localhost
;
--
echo
#
--
echo
#
--
echo
# Bug
#27440 read_only allows create and drop database
--
echo
# Bug#27440 read_only allows create and drop database
--
echo
#
--
echo
#
--
disable_warnings
--
disable_warnings
drop
database
if
exists
mysqltest_db1
;
drop
database
if
exists
mysqltest_db1
;
...
@@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
...
@@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush
privileges
;
flush
privileges
;
drop
database
mysqltest_db1
;
drop
database
mysqltest_db1
;
set
global
read_only
=
0
;
set
global
read_only
=
0
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/show_check.test
View file @
7c4e55cb
# Uses GRANT commands that usually disabled in embedded server
# Uses GRANT commands that usually disabled in embedded server
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
#
#
# Test of some show commands
# Test of some show commands
#
#
...
@@ -33,7 +36,7 @@ check table t1 medium;
...
@@ -33,7 +36,7 @@ check table t1 medium;
check
table
t1
extended
;
check
table
t1
extended
;
show
index
from
t1
;
show
index
from
t1
;
--
disable_metadata
--
disable_metadata
--
error
1062
--
error
ER_DUP_ENTRY
insert
into
t1
values
(
5
,
5
,
5
);
insert
into
t1
values
(
5
,
5
,
5
);
--
echo
--
Here
we
enable
metadata
just
to
check
that
the
collation
of
the
--
echo
--
Here
we
enable
metadata
just
to
check
that
the
collation
of
the
...
@@ -191,14 +194,14 @@ show columns from t1;
...
@@ -191,14 +194,14 @@ show columns from t1;
drop
table
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_mode
=
@@
sql_mode
,
sql_mode
=
''
;
SET
@
old_sql_quote_show_create
=
@@
sql_quote_show_create
,
sql_quote_show_create
=
OFF
;
SET
@
old_sql_quote_show_create
=
@@
sql_quote_show_create
,
sql_quote_show_create
=
OFF
;
######### hook for WL#1324 #
######### hook for WL#1324 #
--
error
1103
--
error
ER_WRONG_TABLE_NAME
CREATE
TABLE
`a/b`
(
i
INT
);
CREATE
TABLE
`a/b`
(
i
INT
);
# the above test should WORK when WL#1324 is done,
# the above test should WORK when WL#1324 is done,
# it should be removed and
# it should be removed and
...
@@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT);
...
@@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT);
#SHOW CREATE TABLE """a";
#SHOW CREATE TABLE """a";
#DROP 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;
#set names latin1;
#create database ``;
#create database ``;
#create table ``.`` (a int) engine=heap;
#create table ``.`` (a int) engine=heap;
...
@@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
...
@@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET
sql_mode
=
@
old_sql_mode
;
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
;
select
@@
max_heap_table_size
;
...
@@ -313,7 +316,7 @@ show table status;
...
@@ -313,7 +316,7 @@ show table status;
drop
table
t1
,
t2
,
t3
;
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
;
create
database
mysqltest
;
...
@@ -328,30 +331,33 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
...
@@ -328,30 +331,33 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection
con1
;
connection
con1
;
select
*
from
t1
;
select
*
from
t1
;
show
create
database
mysqltest
;
show
create
database
mysqltest
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
drop
table
t1
;
drop
table
t1
;
--
error
1044
--
error
ER_DBACCESS_DENIED_ERROR
drop
database
mysqltest
;
drop
database
mysqltest
;
disconnect
con1
;
connect
(
con2
,
localhost
,
mysqltest_2
,,
test
);
connect
(
con2
,
localhost
,
mysqltest_2
,,
test
);
connection
con2
;
connection
con2
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
select
*
from
mysqltest
.
t1
;
select
*
from
mysqltest
.
t1
;
--
error
1044
--
error
ER_DBACCESS_DENIED_ERROR
show
create
database
mysqltest
;
show
create
database
mysqltest
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
drop
table
mysqltest
.
t1
;
drop
table
mysqltest
.
t1
;
--
error
1044
--
error
ER_DBACCESS_DENIED_ERROR
drop
database
mysqltest
;
drop
database
mysqltest
;
disconnect
con2
;
connect
(
con3
,
localhost
,
mysqltest_3
,,
test
);
connect
(
con3
,
localhost
,
mysqltest_3
,,
test
);
connection
con3
;
connection
con3
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
select
*
from
mysqltest
.
t1
;
select
*
from
mysqltest
.
t1
;
--
error
1044
--
error
ER_DBACCESS_DENIED_ERROR
show
create
database
mysqltest
;
show
create
database
mysqltest
;
drop
table
mysqltest
.
t1
;
drop
table
mysqltest
.
t1
;
drop
database
mysqltest
;
drop
database
mysqltest
;
disconnect
con3
;
connection
default
;
connection
default
;
set
names
binary
;
set
names
binary
;
...
@@ -371,7 +377,7 @@ flush privileges;
...
@@ -371,7 +377,7 @@ flush privileges;
#drop database ``;
#drop database ``;
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
# 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
;
CREATE
TABLE
t1
(
i
int
,
KEY
(
i
))
ENGINE
=
MEMORY
;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
...
@@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
...
@@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# Test for B
UG#9439 "Reporting wrong datatype for sub_part on show index"
# Test for B
ug#9439 Reporting wrong datatype for sub_part on show index
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
field1
text
NOT
NULL
,
field1
text
NOT
NULL
,
PRIMARY
KEY
(
field1
(
1000
))
PRIMARY
KEY
(
field1
(
1000
))
...
@@ -412,7 +418,7 @@ show index from t1;
...
@@ -412,7 +418,7 @@ show index from t1;
--
disable_metadata
--
disable_metadata
drop
table
t1
;
drop
table
t1
;
# Test for B
UG#11635:
mysqldump exports TYPE instead of USING for HASH
# Test for B
ug#11635
mysqldump exports TYPE instead of USING for HASH
create
table
t1
(
create
table
t1
(
c1
int
NOT
NULL
,
c1
int
NOT
NULL
,
c2
int
NOT
NULL
,
c2
int
NOT
NULL
,
...
@@ -422,7 +428,7 @@ create table t1 (
...
@@ -422,7 +428,7 @@ create table t1 (
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# Test for B
UG#93:
4.1 protocl crash on corupted frm and SHOW TABLE STATUS
# Test for B
ug#93
4.1 protocl crash on corupted frm and SHOW TABLE STATUS
flush
tables
;
flush
tables
;
...
@@ -430,7 +436,7 @@ flush tables;
...
@@ -430,7 +436,7 @@ flush tables;
system
echo
"this is a junk file for test"
>>
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
t1
.
frm
;
system
echo
"this is a junk file for test"
>>
$MYSQLTEST_VARDIR
/
master
-
data
/
test
/
t1
.
frm
;
--
replace_column
6
# 7 # 8 # 9 #
--
replace_column
6
# 7 # 8 # 9 #
SHOW
TABLE
STATUS
like
't1'
;
SHOW
TABLE
STATUS
like
't1'
;
--
error
1033
--
error
ER_NOT_FORM_FILE
show
create
table
t1
;
show
create
table
t1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -438,7 +444,7 @@ drop table t1;
...
@@ -438,7 +444,7 @@ drop table t1;
--
echo
End
of
4.1
tests
--
echo
End
of
4.1
tests
#
#
# B
UG 12183 -
SHOW OPEN TABLES behavior doesn't match grammar
# B
ug#12183
SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some.
# First we close all open tables with FLUSH tables and then we open some.
CREATE
TABLE
txt1
(
a
int
);
CREATE
TABLE
txt1
(
a
int
);
CREATE
TABLE
tyt2
(
a
int
);
CREATE
TABLE
tyt2
(
a
int
);
...
@@ -456,14 +462,14 @@ DROP TABLE txt1;
...
@@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP
TABLE
tyt2
;
DROP
TABLE
tyt2
;
DROP
TABLE
urkunde
;
DROP
TABLE
urkunde
;
#
#
# B
UG #12591 (SHOW TABLES FROM dbname produces wrong error message)
# B
ug#12591 SHOW TABLES FROM dbname produces wrong error message
#
#
--
error
1049
--
error
ER_BAD_DB_ERROR
SHOW
TABLES
FROM
non_existing_database
;
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
# statement
#
#
# The problem was that initial user setting was forgotten, and current
# The problem was that initial user setting was forgotten, and current
...
@@ -543,7 +549,7 @@ SHOW COLUMNS FROM no_such_table;
...
@@ -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
;
flush
status
;
show
status
like
'slow_queries'
;
show
status
like
'slow_queries'
;
...
@@ -555,7 +561,7 @@ select 1 from information_schema.tables limit 1;
...
@@ -555,7 +561,7 @@ select 1 from information_schema.tables limit 1;
show
status
like
'slow_queries'
;
show
status
like
'slow_queries'
;
#
#
# BUG#10491
:
Server returns data as charset binary SHOW CREATE TABLE or SELECT
# BUG#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
# FROM I_S.
#
#
...
@@ -827,7 +833,7 @@ DROP DATABASE mysqltest1;
...
@@ -827,7 +833,7 @@ DROP DATABASE mysqltest1;
use
test
;
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
;
flush
status
;
show
variables
like
"log_queries_not_using_indexes"
;
show
variables
like
"log_queries_not_using_indexes"
;
...
@@ -843,7 +849,7 @@ select 1 from information_schema.tables limit 1;
...
@@ -843,7 +849,7 @@ select 1 from information_schema.tables limit 1;
show
status
like
'slow_queries'
;
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'
;
show
variables
like
'myisam_recover_options'
;
...
@@ -868,3 +874,7 @@ show create table t1;
...
@@ -868,3 +874,7 @@ show create table t1;
drop
table
t1
;
drop
table
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/skip_name_resolve.test
View file @
7c4e55cb
# Can't be tested with embedded server
# 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'
;
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'
;
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'
;
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';
...
@@ -9,12 +12,17 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
# 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
# Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname.
# was impossible to obtain peer hostname.
connect
(
con1
,
127.0
.
0.1
,
root
,
,
test
,
$MASTER_MYPORT
,
);
connect
(
con1
,
127.0
.
0.1
,
root
,
,
test
,
$MASTER_MYPORT
,
);
--
replace_column
1
#
--
replace_column
1
#
select
user
();
SELECT
USER
();
--
replace_column
1
<
id
>
3
<
host
>
5
<
command
>
6
<
time
>
7
<
state
>
8
<
info
>
--
replace_column
1
<
id
>
3
<
host
>
5
<
command
>
6
<
time
>
7
<
state
>
8
<
info
>
show
processlist
;
SHOW
PROCESSLIST
;
connection
default
;
connection
default
;
disconnect
con1
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/sp-security.test
View file @
7c4e55cb
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
# Can't test with embedded server that doesn't support grants
# Can't test with embedded server that doesn't support grants
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
connect
(
con1root
,
localhost
,
root
,,);
connect
(
con1root
,
localhost
,
root
,,);
connection
con1root
;
connection
con1root
;
...
@@ -156,7 +159,7 @@ call db1_secret.stamp(6);
...
@@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select
db1_secret
.
db
();
select
db1_secret
.
db
();
#
#
# B
UG#2777
# B
ug#2777 Stored procedure doesn't observe definer's rights
#
#
connection
con1root
;
connection
con1root
;
...
@@ -215,7 +218,7 @@ call q();
...
@@ -215,7 +218,7 @@ call q();
select
*
from
t2
;
select
*
from
t2
;
#
#
# B
UG#6030:
Stored procedure has no appropriate DROP privilege
# B
ug#6030
Stored procedure has no appropriate DROP privilege
# (or ALTER for that matter)
# (or ALTER for that matter)
# still connection con2user1 in db2
# still connection con2user1 in db2
...
@@ -330,7 +333,7 @@ flush privileges;
...
@@ -330,7 +333,7 @@ flush privileges;
drop
table
t1
;
drop
table
t1
;
#
#
# B
UG#9503:
reseting correct parameters of thread after error in SP function
# B
ug#9503
reseting correct parameters of thread after error in SP function
#
#
connect
(
root
,
localhost
,
root
,,
test
);
connect
(
root
,
localhost
,
root
,,
test
);
connection
root
;
connection
root
;
...
@@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
...
@@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop
function
bug_9503
;
drop
function
bug_9503
;
use
test
;
use
test
;
drop
database
mysqltest
;
drop
database
mysqltest
;
connection
default
;
disconnect
root
;
#
#
# correct value from current_user() in function run from "security definer"
# correct value from current_user() in function run from "security definer"
# (B
UG#7291
)
# (B
ug#7291 Stored procedures: wrong CURRENT_USER value
)
#
#
connection
con1root
;
connection
con1root
;
use
test
;
use
test
;
...
@@ -398,7 +403,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
...
@@ -398,7 +403,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop
user
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
# procedure in another database when the current database is
# information_schema.
# information_schema.
#
#
...
@@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
...
@@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop
user
mysqltest_1
@
localhost
;
drop
user
mysqltest_1
@
localhost
;
#
#
# B
UG
#12812 create view calling a function works without execute right
# B
ug
#12812 create view calling a function works without execute right
# on function
# on function
delimiter
|
;
delimiter
|
;
--
disable_warnings
--
disable_warnings
...
@@ -464,7 +469,7 @@ delimiter ;|
...
@@ -464,7 +469,7 @@ delimiter ;|
#
#
# B
UG#14834:
Server denies to execute Stored Procedure
# B
ug#14834
Server denies to execute Stored Procedure
#
#
# The problem here was with '_' in the database name.
# The problem here was with '_' in the database name.
#
#
...
@@ -507,7 +512,7 @@ drop database db_bug14834;
...
@@ -507,7 +512,7 @@ drop database db_bug14834;
#
#
# B
UG#14533:
'desc tbl' in stored procedure causes error
# B
ug#14533
'desc tbl' in stored procedure causes error
# ER_TABLEACCESS_DENIED_ERROR
# ER_TABLEACCESS_DENIED_ERROR
#
#
create
database
db_bug14533
;
create
database
db_bug14533
;
...
@@ -546,13 +551,13 @@ drop database db_bug14533;
...
@@ -546,13 +551,13 @@ drop database db_bug14533;
#
#
# B
UG#7787:
Stored procedures: improper warning for "grant execute" statement
# B
ug#7787
Stored procedures: improper warning for "grant execute" statement
#
#
# Prepare.
# Prepare.
CREATE
DATABASE
db_bug7787
;
CREATE
DATABASE
db_bug7787
;
use
db_bug7787
;
USE
db_bug7787
;
# Test.
# Test.
...
@@ -569,7 +574,7 @@ use test;
...
@@ -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:
# The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines
# 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;
...
@@ -614,7 +619,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--
echo
--->
connection
:
mysqltest_2_con
--
echo
--->
connection
:
mysqltest_2_con
--
connection
mysqltest_2_con
--
connection
mysqltest_2_con
use
mysqltest
;
USE
mysqltest
;
CREATE
PROCEDURE
wl2897_p1
()
SELECT
1
;
CREATE
PROCEDURE
wl2897_p1
()
SELECT
1
;
...
@@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
...
@@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--
echo
--->
connection
:
mysqltest_1_con
--
echo
--->
connection
:
mysqltest_1_con
--
connection
mysqltest_1_con
--
connection
mysqltest_1_con
use
mysqltest
;
USE
mysqltest
;
--
error
ER_SPECIFIC_ACCESS_DENIED_ERROR
--
error
ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE
DEFINER
=
root
@
localhost
PROCEDURE
wl2897_p2
()
SELECT
2
;
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;
...
@@ -652,7 +657,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
--
echo
--->
connection
:
con1root
--
echo
--->
connection
:
con1root
--
connection
con1root
--
connection
con1root
use
mysqltest
;
USE
mysqltest
;
SHOW
CREATE
PROCEDURE
wl2897_p1
;
SHOW
CREATE
PROCEDURE
wl2897_p1
;
SHOW
CREATE
PROCEDURE
wl2897_p3
;
SHOW
CREATE
PROCEDURE
wl2897_p3
;
...
@@ -672,7 +677,7 @@ DROP DATABASE mysqltest;
...
@@ -672,7 +677,7 @@ DROP DATABASE mysqltest;
#
#
# B
UG#13198:
SP executes if definer does not exist
# B
ug#13198
SP executes if definer does not exist
#
#
# Prepare environment.
# Prepare environment.
...
@@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
...
@@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--
echo
--->
connection
:
mysqltest_1_con
--
echo
--->
connection
:
mysqltest_1_con
--
connection
mysqltest_1_con
--
connection
mysqltest_1_con
use
mysqltest
;
USE
mysqltest
;
CREATE
PROCEDURE
bug13198_p1
()
CREATE
PROCEDURE
bug13198_p1
()
SELECT
1
;
SELECT
1
;
...
@@ -720,7 +725,7 @@ SELECT bug13198_f1();
...
@@ -720,7 +725,7 @@ SELECT bug13198_f1();
--
echo
--->
connection
:
mysqltest_2_con
--
echo
--->
connection
:
mysqltest_2_con
--
connection
mysqltest_2_con
--
connection
mysqltest_2_con
use
mysqltest
;
USE
mysqltest
;
CALL
bug13198_p1
();
CALL
bug13198_p1
();
...
@@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
...
@@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
--
echo
--->
connection
:
mysqltest_2_con
--
echo
--->
connection
:
mysqltest_2_con
--
connection
mysqltest_2_con
--
connection
mysqltest_2_con
use
mysqltest
;
USE
mysqltest
;
--
error
ER_NO_SUCH_USER
--
error
ER_NO_SUCH_USER
CALL
bug13198_p1
();
CALL
bug13198_p1
();
...
@@ -764,7 +769,7 @@ DROP DATABASE mysqltest;
...
@@ -764,7 +769,7 @@ DROP DATABASE mysqltest;
#
#
# Bug#19857
-
When a user with CREATE ROUTINE priv creates a routine,
# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
# it results in NULL p/w
#
#
...
@@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
...
@@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--
echo
--->
connection
:
mysqltest_2_con
--
echo
--->
connection
:
mysqltest_2_con
--
connection
mysqltest_2_con
--
connection
mysqltest_2_con
use
test
;
USE
test
;
DELIMITER
//;
DELIMITER
//;
CREATE
PROCEDURE
sp19857
()
DETERMINISTIC
CREATE
PROCEDURE
sp19857
()
DETERMINISTIC
...
@@ -814,8 +819,7 @@ DROP USER user19857@localhost;
...
@@ -814,8 +819,7 @@ DROP USER user19857@localhost;
#
#
# BUG#18630: Arguments of suid routine calculated in wrong security
# Bug#18630 Arguments of suid routine calculated in wrong security context
# context
#
#
# Arguments of suid routines were calculated in definer's security
# Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole.
# context instead of caller's context thus creating security hole.
...
@@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
...
@@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/sp_notembedded.test
View file @
7c4e55cb
# Can't test with embedded server
# Can't test with embedded server
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
--
sleep
2
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
,
t3
;
drop
table
if
exists
t1
,
t3
;
--
enable_warnings
--
enable_warnings
delimiter
|
;
delimiter
|
;
#
#
# B
UG
#4902: Stored procedure with SHOW WARNINGS leads to packet error
# B
ug
#4902: Stored procedure with SHOW WARNINGS leads to packet error
#
#
# Added tests for show grants command
# Added tests for show grants command
--
disable_warnings
--
disable_warnings
...
@@ -47,7 +50,7 @@ drop procedure bug4902_2|
...
@@ -47,7 +50,7 @@ drop procedure bug4902_2|
#
#
# B
UG
#5278: Stored procedure packets out of order if SET PASSWORD.
# B
ug
#5278: Stored procedure packets out of order if SET PASSWORD.
#
#
--
disable_warnings
--
disable_warnings
drop
function
if
exists
bug5278
|
drop
function
if
exists
bug5278
|
...
@@ -58,13 +61,16 @@ begin
...
@@ -58,13 +61,16 @@ begin
return
'okay'
;
return
'okay'
;
end
|
end
|
--
error
1133
--
error
ER_PASSWORD_NO_MATCH
select
bug5278
()
|
select
bug5278
()
|
--
error
1133
--
error
ER_PASSWORD_NO_MATCH
select
bug5278
()
|
select
bug5278
()
|
drop
function
bug5278
|
drop
function
bug5278
|
#
# Bug#3583: query cache doesn't work for stored procedures
#
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
|
drop
table
if
exists
t1
|
--
enable_warnings
--
enable_warnings
...
@@ -72,9 +78,6 @@ create table t1 (
...
@@ -72,9 +78,6 @@ create table t1 (
id
char
(
16
)
not
null
default
''
,
id
char
(
16
)
not
null
default
''
,
data
int
not
null
data
int
not
null
)
|
)
|
#
# BUG#3583: query cache doesn't work for stored procedures
#
--
disable_warnings
--
disable_warnings
drop
procedure
if
exists
bug3583
|
drop
procedure
if
exists
bug3583
|
--
enable_warnings
--
enable_warnings
...
@@ -110,8 +113,9 @@ delete from t1|
...
@@ -110,8 +113,9 @@ delete from t1|
drop
procedure
bug3583
|
drop
procedure
bug3583
|
drop
table
t1
|
drop
table
t1
|
#
#
# B
UG
#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
# B
ug
#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
#
#
--
disable_warnings
--
disable_warnings
drop
procedure
if
exists
bug6807
|
drop
procedure
if
exists
bug6807
|
...
@@ -125,16 +129,16 @@ begin
...
@@ -125,16 +129,16 @@ begin
select
'Not reached'
;
select
'Not reached'
;
end
|
end
|
--
error
1317
--
error
ER_QUERY_INTERRUPTED
call
bug6807
()
|
call
bug6807
()
|
--
error
1317
--
error
ER_QUERY_INTERRUPTED
call
bug6807
()
|
call
bug6807
()
|
drop
procedure
bug6807
|
drop
procedure
bug6807
|
#
#
# B
UG
#10100: function (and stored procedure?) recursivity problem
# B
ug
#10100: function (and stored procedure?) recursivity problem
#
#
--
disable_warnings
--
disable_warnings
drop
function
if
exists
bug10100f
|
drop
function
if
exists
bug10100f
|
...
@@ -233,11 +237,11 @@ begin
...
@@ -233,11 +237,11 @@ begin
close
c
;
close
c
;
end
|
end
|
#end of the stack checking
#
end of the stack checking
set
@@
max_sp_recursion_depth
=
255
|
set
@@
max_sp_recursion_depth
=
255
|
set
@
var
=
1
|
set
@
var
=
1
|
#disable log because error about stack overrun contains numbers which
#
disable log because error about stack overrun contains numbers which
#depend on a system
#
depend on a system
--
disable_result_log
--
disable_result_log
--
error
ER_STACK_OVERRUN_NEED_MORE
--
error
ER_STACK_OVERRUN_NEED_MORE
call
bug10100p
(
255
,
@
var
)
|
call
bug10100p
(
255
,
@
var
)
|
...
@@ -266,6 +270,7 @@ drop table t3|
...
@@ -266,6 +270,7 @@ drop table t3|
delimiter
;
|
delimiter
;
|
#
#
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
#
#
...
@@ -282,6 +287,11 @@ call 15298_1();
...
@@ -282,6 +287,11 @@ call 15298_1();
call
15298_2
();
call
15298_2
();
connection
default
;
connection
default
;
disconnect
con1
;
drop
user
mysqltest_1
@
localhost
;
drop
user
mysqltest_1
@
localhost
;
drop
procedure
15298_1
;
drop
procedure
15298_1
;
drop
procedure
15298_2
;
drop
procedure
15298_2
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/ssl-big.test
View file @
7c4e55cb
...
@@ -4,12 +4,15 @@
...
@@ -4,12 +4,15 @@
--
source
include
/
have_ssl
.
inc
--
source
include
/
have_ssl
.
inc
--
source
include
/
big_test
.
inc
--
source
include
/
big_test
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
disable_warnings
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
--
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
);
connect
(
ssl_con
,
localhost
,
root
,,,,,
SSL
);
...
@@ -53,4 +56,9 @@ while ($count)
...
@@ -53,4 +56,9 @@ while ($count)
connect
(
ssl_con
,
localhost
,
root
,,,,,
SSL
);
connect
(
ssl_con
,
localhost
,
root
,,,,,
SSL
);
drop
table
t1
;
drop
table
t1
;
connection
default
;
disconnect
ssl_con
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/ssl.test
View file @
7c4e55cb
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
--
source
include
/
have_ssl
.
inc
--
source
include
/
have_ssl
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
connect
(
ssl_con
,
localhost
,
root
,,,,,
SSL
);
connect
(
ssl_con
,
localhost
,
root
,,,,,
SSL
);
# Check ssl turned on
# Check ssl turned on
...
@@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
...
@@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on
# Check ssl turned on
SHOW
STATUS
LIKE
'Ssl_cipher'
;
SHOW
STATUS
LIKE
'Ssl_cipher'
;
connection
default
;
disconnect
ssl_con
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/ssl_compress.test
View file @
7c4e55cb
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
--
source
include
/
have_ssl
.
inc
--
source
include
/
have_ssl
.
inc
--
source
include
/
have_compress
.
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
);
connect
(
ssl_compress_con
,
localhost
,
root
,,,,,
SSL
COMPRESS
);
# Check ssl turned on
# Check ssl turned on
...
@@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
...
@@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
# Check compression turned on
SHOW
STATUS
LIKE
'Compression'
;
SHOW
STATUS
LIKE
'Compression'
;
connection
default
;
disconnect
ssl_compress_con
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/status.test
View file @
7c4e55cb
# embedded server causes different stat
# embedded server causes different stat
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
# PS causes different statistics
# PS causes different statistics
--
disable_ps_protocol
--
disable_ps_protocol
...
@@ -208,3 +211,7 @@ DROP PROCEDURE p1;
...
@@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP
FUNCTION
f1
;
DROP
FUNCTION
f1
;
# End of 5.0 tests
# End of 5.0 tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/user_limits.test
View file @
7c4e55cb
...
@@ -3,7 +3,10 @@
...
@@ -3,7 +3,10 @@
#
#
# Requires privileges to be enabled
# Requires privileges to be enabled
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
# Prepare play-ground
# Prepare play-ground
--
disable_warnings
--
disable_warnings
...
@@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
...
@@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
connection
mqph
;
connection
mqph
;
select
*
from
t1
;
select
*
from
t1
;
select
*
from
t1
;
select
*
from
t1
;
--
error
1226
--
error
ER_USER_LIMIT_REACHED
select
*
from
t1
;
select
*
from
t1
;
connect
(
mqph2
,
localhost
,
mysqltest_1
,,);
connect
(
mqph2
,
localhost
,
mysqltest_1
,,);
connection
mqph2
;
connection
mqph2
;
--
error
1226
--
error
ER_USER_LIMIT_REACHED
select
*
from
t1
;
select
*
from
t1
;
# cleanup
# cleanup
connection
default
;
connection
default
;
...
@@ -50,12 +53,12 @@ select * from t1;
...
@@ -50,12 +53,12 @@ select * from t1;
select
*
from
t1
;
select
*
from
t1
;
delete
from
t1
;
delete
from
t1
;
delete
from
t1
;
delete
from
t1
;
--
error
1226
--
error
ER_USER_LIMIT_REACHED
delete
from
t1
;
delete
from
t1
;
select
*
from
t1
;
select
*
from
t1
;
connect
(
muph2
,
localhost
,
mysqltest_1
,,);
connect
(
muph2
,
localhost
,
mysqltest_1
,,);
connection
muph2
;
connection
muph2
;
--
error
1226
--
error
ER_USER_LIMIT_REACHED
delete
from
t1
;
delete
from
t1
;
select
*
from
t1
;
select
*
from
t1
;
# Cleanup
# Cleanup
...
@@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
...
@@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
connection
mcph2
;
connection
mcph2
;
select
*
from
t1
;
select
*
from
t1
;
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
1226
--
error
ER_USER_LIMIT_REACHED
connect
(
mcph3
,
localhost
,
mysqltest_1
,,);
connect
(
mcph3
,
localhost
,
mysqltest_1
,,);
# Old connection is still ok
# Old connection is still ok
select
*
from
t1
;
select
*
from
t1
;
...
@@ -83,7 +86,7 @@ select * from t1;
...
@@ -83,7 +86,7 @@ select * from t1;
disconnect
mcph1
;
disconnect
mcph1
;
disconnect
mcph2
;
disconnect
mcph2
;
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
1226
--
error
ER_USER_LIMIT_REACHED
connect
(
mcph3
,
localhost
,
mysqltest_1
,,);
connect
(
mcph3
,
localhost
,
mysqltest_1
,,);
# Cleanup
# Cleanup
connection
default
;
connection
default
;
...
@@ -101,7 +104,7 @@ connect (muc2, localhost, mysqltest_1,,);
...
@@ -101,7 +104,7 @@ connect (muc2, localhost, mysqltest_1,,);
connection
muc2
;
connection
muc2
;
select
*
from
t1
;
select
*
from
t1
;
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
1226
--
error
ER_USER_LIMIT_REACHED
connect
(
muc3
,
localhost
,
mysqltest_1
,,);
connect
(
muc3
,
localhost
,
mysqltest_1
,,);
# Closing of one of connections should help
# Closing of one of connections should help
disconnect
muc1
;
disconnect
muc1
;
...
@@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
...
@@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
connection
muc4
;
connection
muc4
;
select
*
from
t1
;
select
*
from
t1
;
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
1226
--
error
ER_USER_LIMIT_REACHED
connect
(
muc5
,
localhost
,
mysqltest_1
,,);
connect
(
muc5
,
localhost
,
mysqltest_1
,,);
# Clean up
# Clean up
connection
default
;
connection
default
;
...
@@ -129,7 +132,7 @@ drop user mysqltest_1@localhost;
...
@@ -129,7 +132,7 @@ drop user mysqltest_1@localhost;
select
@@
session
.
max_user_connections
,
@@
global
.
max_user_connections
;
select
@@
session
.
max_user_connections
,
@@
global
.
max_user_connections
;
# Local max_user_connections variable can't be set directly
# Local max_user_connections variable can't be set directly
# since this limit is per-account
# since this limit is per-account
--
error
1229
--
error
ER_GLOBAL_VARIABLE
set
session
max_user_connections
=
2
;
set
session
max_user_connections
=
2
;
# But it is ok to set global max_user_connections
# But it is ok to set global max_user_connections
set
global
max_user_connections
=
2
;
set
global
max_user_connections
=
2
;
...
@@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
...
@@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
connection
muca2
;
connection
muca2
;
select
*
from
t1
;
select
*
from
t1
;
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
1203
--
error
ER_TOO_MANY_USER_CONNECTIONS
connect
(
muca3
,
localhost
,
mysqltest_1
,,);
connect
(
muca3
,
localhost
,
mysqltest_1
,,);
# Now we are testing that per-account limit prevails over gloabl limit
# Now we are testing that per-account limit prevails over gloabl limit
connection
default
;
connection
default
;
...
@@ -154,7 +157,7 @@ connect (muca3, localhost, mysqltest_1,,);
...
@@ -154,7 +157,7 @@ connect (muca3, localhost, mysqltest_1,,);
connection
muca3
;
connection
muca3
;
select
@@
session
.
max_user_connections
,
@@
global
.
max_user_connections
;
select
@@
session
.
max_user_connections
,
@@
global
.
max_user_connections
;
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
1226
--
error
ER_USER_LIMIT_REACHED
connect
(
muca4
,
localhost
,
mysqltest_1
,,);
connect
(
muca4
,
localhost
,
mysqltest_1
,,);
# Cleanup
# Cleanup
connection
default
;
connection
default
;
...
@@ -167,3 +170,7 @@ drop user mysqltest_1@localhost;
...
@@ -167,3 +170,7 @@ drop user mysqltest_1@localhost;
# Final cleanup
# Final cleanup
drop
table
t1
;
drop
table
t1
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/view.test
View file @
7c4e55cb
...
@@ -10,12 +10,12 @@ use test;
...
@@ -10,12 +10,12 @@ use test;
#
#
# create view on nonexistent table
# create view on nonexistent table
--
error
1146
--
error
ER_NO_SUCH_TABLE
create
view
v1
(
c
,
d
)
as
select
a
,
b
from
t1
;
create
view
v1
(
c
,
d
)
as
select
a
,
b
from
t1
;
create
temporary
table
t1
(
a
int
,
b
int
);
create
temporary
table
t1
(
a
int
,
b
int
);
# view on temporary table
# view on temporary table
--
error
1352
--
error
ER_VIEW_SELECT_TMPTABLE
create
view
v1
(
c
)
as
select
b
+
1
from
t1
;
create
view
v1
(
c
)
as
select
b
+
1
from
t1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -42,18 +42,18 @@ select * from t1;
...
@@ -42,18 +42,18 @@ select * from t1;
select
c
from
v1
;
select
c
from
v1
;
show
create
table
v1
;
show
create
table
v1
;
show
create
view
v1
;
show
create
view
v1
;
--
error
1347
--
error
ER_WRONG_OBJECT
show
create
view
t1
;
show
create
view
t1
;
drop
table
t1
;
drop
table
t1
;
# try to use fields from underlying table
# try to use fields from underlying table
--
error
1054
--
error
ER_BAD_FIELD_ERROR
select
a
from
v1
;
select
a
from
v1
;
--
error
1054
--
error
ER_BAD_FIELD_ERROR
select
v1
.
a
from
v1
;
select
v1
.
a
from
v1
;
--
error
1054
--
error
ER_BAD_FIELD_ERROR
select
b
from
v1
;
select
b
from
v1
;
--
error
1054
--
error
ER_BAD_FIELD_ERROR
select
v1
.
b
from
v1
;
select
v1
.
b
from
v1
;
# view with different algorithms (explain output differs)
# view with different algorithms (explain output differs)
...
@@ -64,9 +64,9 @@ select c from v2;
...
@@ -64,9 +64,9 @@ select c from v2;
explain
extended
select
c
from
v2
;
explain
extended
select
c
from
v2
;
# try to use underlying table fields in VIEW creation process
# try to use underlying table fields in VIEW creation process
--
error
1054
--
error
ER_BAD_FIELD_ERROR
create
view
v3
(
c
)
as
select
a
+
1
from
v1
;
create
view
v3
(
c
)
as
select
a
+
1
from
v1
;
--
error
1054
--
error
ER_BAD_FIELD_ERROR
create
view
v3
(
c
)
as
select
b
+
1
from
v1
;
create
view
v3
(
c
)
as
select
b
+
1
from
v1
;
...
@@ -104,7 +104,7 @@ select * from v1;
...
@@ -104,7 +104,7 @@ select * from v1;
select
*
from
v2
;
select
*
from
v2
;
# try to create VIEW with name of existing VIEW
# try to create VIEW with name of existing VIEW
--
error
1050
--
error
ER_TABLE_EXISTS_ERROR
create
view
v1
(
c
,
d
,
e
,
f
)
as
select
a
,
b
,
a
in
(
select
a
+
2
from
t1
),
a
=
all
(
select
a
from
t1
)
from
t1
;
create
view
v1
(
c
,
d
,
e
,
f
)
as
select
a
,
b
,
a
in
(
select
a
+
2
from
t1
),
a
=
all
(
select
a
from
t1
)
from
t1
;
# 'or replace' should work in this case
# 'or replace' should work in this case
...
@@ -112,7 +112,7 @@ create or replace view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a
...
@@ -112,7 +112,7 @@ create or replace view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a
# try to ALTER unexisting VIEW
# try to ALTER unexisting VIEW
drop
view
v2
;
drop
view
v2
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
alter
view
v2
as
select
c
,
d
from
v1
;
alter
view
v2
as
select
c
,
d
from
v1
;
# 'or replace' on unexisting view
# 'or replace' on unexisting view
...
@@ -126,15 +126,15 @@ select * from v1;
...
@@ -126,15 +126,15 @@ select * from v1;
select
*
from
v2
;
select
*
from
v2
;
# try to drop nonexistent VIEW
# try to drop nonexistent VIEW
--
error
1051
--
error
ER_BAD_TABLE_ERROR
drop
view
v100
;
drop
view
v100
;
# try to drop table with DROP VIEW
# try to drop table with DROP VIEW
--
error
1347
--
error
ER_WRONG_OBJECT
drop
view
t1
;
drop
view
t1
;
# try to drop VIEW with DROP TABLE
# try to drop VIEW with DROP TABLE
--
error
1051
--
error
ER_BAD_TABLE_ERROR
drop
table
v1
;
drop
table
v1
;
# try to drop table with DROP VIEW
# try to drop table with DROP VIEW
...
@@ -175,7 +175,7 @@ drop table t1;
...
@@ -175,7 +175,7 @@ drop table t1;
# syntax compatibility
# syntax compatibility
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
--
error
1368
--
error
ER_VIEW_NONUPD_CHECK
create
view
v1
as
select
distinct
a
from
t1
WITH
CHECK
OPTION
;
create
view
v1
as
select
distinct
a
from
t1
WITH
CHECK
OPTION
;
create
view
v1
as
select
a
from
t1
WITH
CHECK
OPTION
;
create
view
v1
as
select
a
from
t1
WITH
CHECK
OPTION
;
create
view
v2
as
select
a
from
t1
WITH
CASCADED
CHECK
OPTION
;
create
view
v2
as
select
a
from
t1
WITH
CASCADED
CHECK
OPTION
;
...
@@ -232,10 +232,10 @@ create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
...
@@ -232,10 +232,10 @@ create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
select
is_updatable
from
information_schema
.
views
where
table_name
=
'v2'
;
select
is_updatable
from
information_schema
.
views
where
table_name
=
'v2'
;
select
is_updatable
from
information_schema
.
views
where
table_name
=
'v1'
;
select
is_updatable
from
information_schema
.
views
where
table_name
=
'v1'
;
# try to update expression
# try to update expression
--
error
1348
--
error
ER_NONUPDATEABLE_COLUMN
update
v1
set
c
=
a
+
c
;
update
v1
set
c
=
a
+
c
;
# try to update VIEW with forced TEMPORARY TABLE algorithm
# try to update VIEW with forced TEMPORARY TABLE algorithm
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
update
v2
set
a
=
a
+
c
;
update
v2
set
a
=
a
+
c
;
# updatable field of updateable view
# updatable field of updateable view
update
v1
set
a
=
a
+
c
;
update
v1
set
a
=
a
+
c
;
...
@@ -254,10 +254,10 @@ insert into t2 values (10), (20);
...
@@ -254,10 +254,10 @@ insert into t2 values (10), (20);
create
view
v1
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
view
v1
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
algorithm
=
temptable
view
v2
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
algorithm
=
temptable
view
v2
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
# try to update expression
# try to update expression
--
error
1348
--
error
ER_NONUPDATEABLE_COLUMN
update
t2
,
v1
set
v1
.
c
=
v1
.
a
+
v1
.
c
where
t2
.
x
=
v1
.
a
;
update
t2
,
v1
set
v1
.
c
=
v1
.
a
+
v1
.
c
where
t2
.
x
=
v1
.
a
;
# try to update VIEW with forced TEMPORARY TABLE algorithm
# try to update VIEW with forced TEMPORARY TABLE algorithm
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
update
t2
,
v2
set
v2
.
a
=
v2
.
v2
.
a
+
c
where
t2
.
x
=
v2
.
a
;
update
t2
,
v2
set
v2
.
a
=
v2
.
v2
.
a
+
c
where
t2
.
x
=
v2
.
a
;
# updatable field of updateable view
# updatable field of updateable view
update
t2
,
v1
set
v1
.
a
=
v1
.
a
+
v1
.
c
where
t2
.
x
=
v1
.
a
;
update
t2
,
v1
set
v1
.
a
=
v1
.
a
+
v1
.
c
where
t2
.
x
=
v1
.
a
;
...
@@ -292,7 +292,7 @@ insert into t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
...
@@ -292,7 +292,7 @@ insert into t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
create
view
v1
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
view
v1
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
algorithm
=
temptable
view
v2
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
algorithm
=
temptable
view
v2
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
# try to update VIEW with forced TEMPORARY TABLE algorithm
# try to update VIEW with forced TEMPORARY TABLE algorithm
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
delete
from
v2
where
c
<
4
;
delete
from
v2
where
c
<
4
;
# updatable field of updateable view
# updatable field of updateable view
delete
from
v1
where
c
<
4
;
delete
from
v1
where
c
<
4
;
...
@@ -311,7 +311,7 @@ insert into t2 values (1), (2), (3), (4);
...
@@ -311,7 +311,7 @@ insert into t2 values (1), (2), (3), (4);
create
view
v1
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
view
v1
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
algorithm
=
temptable
view
v2
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
create
algorithm
=
temptable
view
v2
(
a
,
c
)
as
select
a
,
b
+
1
from
t1
;
# try to update VIEW with forced TEMPORARY TABLE algorithm
# try to update VIEW with forced TEMPORARY TABLE algorithm
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
delete
v2
from
t2
,
v2
where
t2
.
x
=
v2
.
a
;
delete
v2
from
t2
,
v2
where
t2
.
x
=
v2
.
a
;
# updatable field of updateable view
# updatable field of updateable view
delete
v1
from
t2
,
v1
where
t2
.
x
=
v1
.
a
;
delete
v1
from
t2
,
v1
where
t2
.
x
=
v1
.
a
;
...
@@ -331,7 +331,7 @@ set updatable_views_with_limit=NO;
...
@@ -331,7 +331,7 @@ set updatable_views_with_limit=NO;
update
v1
set
x
=
x
+
1
;
update
v1
set
x
=
x
+
1
;
update
v2
set
x
=
x
+
1
;
update
v2
set
x
=
x
+
1
;
update
v1
set
x
=
x
+
1
limit
1
;
update
v1
set
x
=
x
+
1
limit
1
;
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
update
v2
set
x
=
x
+
1
limit
1
;
update
v2
set
x
=
x
+
1
limit
1
;
set
updatable_views_with_limit
=
YES
;
set
updatable_views_with_limit
=
YES
;
update
v1
set
x
=
x
+
1
limit
1
;
update
v1
set
x
=
x
+
1
limit
1
;
...
@@ -353,13 +353,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
...
@@ -353,13 +353,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
create
view
v4
(
x
,
y
,
z
)
as
select
c
+
1
,
b
,
a
from
t1
;
create
view
v4
(
x
,
y
,
z
)
as
select
c
+
1
,
b
,
a
from
t1
;
create
algorithm
=
temptable
view
v5
(
x
,
y
,
z
)
as
select
c
,
b
,
a
from
t1
;
create
algorithm
=
temptable
view
v5
(
x
,
y
,
z
)
as
select
c
,
b
,
a
from
t1
;
# try insert to VIEW with fields duplicate
# try insert to VIEW with fields duplicate
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v3
values
(
-
60
,
4
,
30
);
insert
into
v3
values
(
-
60
,
4
,
30
);
# try insert to VIEW with expression in SELECT list
# try insert to VIEW with expression in SELECT list
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v4
values
(
-
60
,
4
,
30
);
insert
into
v4
values
(
-
60
,
4
,
30
);
# try insert to VIEW using temporary table algorithm
# try insert to VIEW using temporary table algorithm
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v5
values
(
-
60
,
4
,
30
);
insert
into
v5
values
(
-
60
,
4
,
30
);
insert
into
v1
values
(
-
60
,
4
,
30
);
insert
into
v1
values
(
-
60
,
4
,
30
);
insert
into
v1
(
z
,
y
,
x
)
values
(
50
,
6
,
-
100
);
insert
into
v1
(
z
,
y
,
x
)
values
(
50
,
6
,
-
100
);
...
@@ -381,13 +381,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
...
@@ -381,13 +381,13 @@ create view v3 (x,y,z) as select b, a, b from t1;
create
view
v4
(
x
,
y
,
z
)
as
select
c
+
1
,
b
,
a
from
t1
;
create
view
v4
(
x
,
y
,
z
)
as
select
c
+
1
,
b
,
a
from
t1
;
create
algorithm
=
temptable
view
v5
(
x
,
y
,
z
)
as
select
c
,
b
,
a
from
t1
;
create
algorithm
=
temptable
view
v5
(
x
,
y
,
z
)
as
select
c
,
b
,
a
from
t1
;
# try insert to VIEW with fields duplicate
# try insert to VIEW with fields duplicate
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v3
select
c
,
b
,
a
from
t2
;
insert
into
v3
select
c
,
b
,
a
from
t2
;
# try insert to VIEW with expression in SELECT list
# try insert to VIEW with expression in SELECT list
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v4
select
c
,
b
,
a
from
t2
;
insert
into
v4
select
c
,
b
,
a
from
t2
;
# try insert to VIEW using temporary table algorithm
# try insert to VIEW using temporary table algorithm
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v5
select
c
,
b
,
a
from
t2
;
insert
into
v5
select
c
,
b
,
a
from
t2
;
insert
into
v1
select
c
,
b
,
a
from
t2
;
insert
into
v1
select
c
,
b
,
a
from
t2
;
insert
into
v1
(
z
,
y
,
x
)
select
a
+
20
,
b
+
2
,
-
100
from
t2
;
insert
into
v1
(
z
,
y
,
x
)
select
a
+
20
,
b
+
2
,
-
100
from
t2
;
...
@@ -424,7 +424,7 @@ create table t1 (a int, primary key(a));
...
@@ -424,7 +424,7 @@ create table t1 (a int, primary key(a));
insert
into
t1
values
(
1
),
(
2
),
(
3
),
(
200
);
insert
into
t1
values
(
1
),
(
2
),
(
3
),
(
200
);
create
ALGORITHM
=
TEMPTABLE
view
v1
(
x
)
as
select
a
from
t1
;
create
ALGORITHM
=
TEMPTABLE
view
v1
(
x
)
as
select
a
from
t1
;
create
view
v2
(
y
)
as
select
x
from
v1
;
create
view
v2
(
y
)
as
select
x
from
v1
;
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
update
v2
set
y
=
10
where
y
=
2
;
update
v2
set
y
=
10
where
y
=
2
;
drop
table
t1
;
drop
table
t1
;
drop
view
v1
,
v2
;
drop
view
v1
,
v2
;
...
@@ -479,17 +479,17 @@ create table t1 (col1 char(5),col2 char(5));
...
@@ -479,17 +479,17 @@ create table t1 (col1 char(5),col2 char(5));
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
col1
char
(
5
),
newcol2
char
(
5
));
create
table
t1
(
col1
char
(
5
),
newcol2
char
(
5
));
--
error
1356
--
error
ER_VIEW_INVALID
insert
into
v1
values
(
'a'
,
'aa'
);
insert
into
v1
values
(
'a'
,
'aa'
);
drop
table
t1
;
drop
table
t1
;
--
error
1356
--
error
ER_VIEW_INVALID
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
#
#
# check of duplication of column names
# check of duplication of column names
#
#
--
error
1060
--
error
ER_DUP_FIELDNAME
create
view
v1
(
a
,
a
)
as
select
'a'
,
'a'
;
create
view
v1
(
a
,
a
)
as
select
'a'
,
'a'
;
#
#
...
@@ -559,7 +559,7 @@ drop table t1;
...
@@ -559,7 +559,7 @@ drop table t1;
#
#
# error on preparation
# error on preparation
#
#
--
error
1096
--
error
ER_NO_TABLES_USED
CREATE
VIEW
v02
AS
SELECT
*
FROM
DUAL
;
CREATE
VIEW
v02
AS
SELECT
*
FROM
DUAL
;
SHOW
TABLES
;
SHOW
TABLES
;
...
@@ -575,7 +575,7 @@ drop view v1;
...
@@ -575,7 +575,7 @@ drop view v1;
#
#
create
table
t1
(
col1
int
,
col2
char
(
22
));
create
table
t1
(
col1
int
,
col2
char
(
22
));
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
--
error
1347
--
error
ER_WRONG_OBJECT
create
index
i1
on
v1
(
col1
);
create
index
i1
on
v1
(
col1
);
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -735,7 +735,7 @@ create function x1 () returns int return 5;
...
@@ -735,7 +735,7 @@ create function x1 () returns int return 5;
create table t1 (s1 int);
create table t1 (s1 int);
create view v1 as select x1() from t1;
create view v1 as select x1() from t1;
drop function x1;
drop function x1;
-- error
1356
-- error
ER_VIEW_INVALID
select * from v1;
select * from v1;
--replace_column 8 # 12 # 13 #
--replace_column 8 # 12 # 13 #
show table status;
show table status;
...
@@ -786,10 +786,10 @@ create table t1 (a int);
...
@@ -786,10 +786,10 @@ create table t1 (a int);
create view v1 as select a from t1;
create view v1 as select a from t1;
create view v3 as select a from t1;
create view v3 as select a from t1;
create database mysqltest;
create database mysqltest;
-- error
1450
-- error
ER_FORBID_SCHEMA_CHANGE
rename table v1 to mysqltest.v1;
rename table v1 to mysqltest.v1;
rename table v1 to v2;
rename table v1 to v2;
--error
1050
--error
ER_TABLE_EXISTS_ERROR
rename table v3 to v1, v2 to t1;
rename table v3 to v1, v2 to t1;
drop table t1;
drop table t1;
drop view v2,v3;
drop view v2,v3;
...
@@ -802,19 +802,19 @@ create view v1 as select 'a',1;
...
@@ -802,19 +802,19 @@ create view v1 as select 'a',1;
create view v2 as select * from v1 union all select * from v1;
create view v2 as select * from v1 union all select * from v1;
create view v3 as select * from v2 where 1 = (select `
1
`
from
v2
);
create view v3 as select * from v2 where 1 = (select `
1
`
from
v2
);
create
view
v4
as
select
*
from
v3
;
create
view
v4
as
select
*
from
v3
;
--
error
1242
--
error
ER_SUBQUERY_NO_1_ROW
select
*
from
v4
;
select
*
from
v4
;
drop
view
v4
,
v3
,
v2
,
v1
;
drop
view
v4
,
v3
,
v2
,
v1
;
#
#
# VIEW over SELECT with prohibited clauses
# VIEW over SELECT with prohibited clauses
#
#
--
error
1350
--
error
ER_VIEW_SELECT_CLAUSE
create
view
v1
as
select
5
into
@
w
;
create
view
v1
as
select
5
into
@
w
;
--
error
1350
--
error
ER_VIEW_SELECT_CLAUSE
create
view
v1
as
select
5
into
outfile
'ttt'
;
create
view
v1
as
select
5
into
outfile
'ttt'
;
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
--
error
1350
--
error
ER_VIEW_SELECT_CLAUSE
create
view
v1
as
select
a
from
t1
procedure
analyse
();
create
view
v1
as
select
a
from
t1
procedure
analyse
();
--
error
ER_VIEW_SELECT_DERIVED
--
error
ER_VIEW_SELECT_DERIVED
create
view
v1
as
select
1
from
(
select
1
)
as
d1
;
create
view
v1
as
select
1
from
(
select
1
)
as
d1
;
...
@@ -839,109 +839,109 @@ create table t2 (col1 int);
...
@@ -839,109 +839,109 @@ create table t2 (col1 int);
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
create
view
v2
as
select
*
from
v1
;
create
view
v2
as
select
*
from
v1
;
create
view
v3
as
select
v2
.
col1
from
v2
,
t2
where
v2
.
col1
=
t2
.
col1
;
create
view
v3
as
select
v2
.
col1
from
v2
,
t2
where
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v2
set
col1
=
(
select
max
(
col1
)
from
v1
);
update
v2
set
col1
=
(
select
max
(
col1
)
from
v1
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v2
set
col1
=
(
select
max
(
col1
)
from
t1
);
update
v2
set
col1
=
(
select
max
(
col1
)
from
t1
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
v2
set
col1
=
(
select
max
(
col1
)
from
v2
);
update
v2
set
col1
=
(
select
max
(
col1
)
from
v2
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v2
,
t2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v2
.
col1
=
t2
.
col1
;
update
v2
,
t2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
t1
.
col1
=
t2
.
col1
;
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
v1
,
t2
set
v1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v1
.
col1
=
t2
.
col1
;
update
v1
,
t2
set
v1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t2
,
v2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v2
.
col1
=
t2
.
col1
;
update
t2
,
v2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t2
,
t1
set
t1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
t1
.
col1
=
t2
.
col1
;
update
t2
,
t1
set
t1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t2
,
v1
set
v1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v1
.
col1
=
t2
.
col1
;
update
t2
,
v1
set
v1
.
col1
=
(
select
max
(
col1
)
from
v1
)
where
v1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v2
,
t2
set
v2
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v2
.
col1
=
t2
.
col1
;
update
v2
,
t2
set
v2
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v2
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v1
,
t2
set
v1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v1
.
col1
=
t2
.
col1
;
update
v1
,
t2
set
v1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
t2
,
v2
set
v2
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v2
.
col1
=
t2
.
col1
;
update
t2
,
v2
set
v2
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v2
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
t2
,
t1
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
update
t2
,
t1
set
t1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
t2
,
v1
set
v1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v1
.
col1
=
t2
.
col1
;
update
t2
,
v1
set
v1
.
col1
=
(
select
max
(
col1
)
from
t1
)
where
v1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
v2
,
t2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v2
.
col1
=
t2
.
col1
;
update
v2
,
t2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
t1
.
col1
=
t2
.
col1
;
update
t1
,
t2
set
t1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v1
,
t2
set
v1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v1
.
col1
=
t2
.
col1
;
update
v1
,
t2
set
v1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t2
,
v2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v2
.
col1
=
t2
.
col1
;
update
t2
,
v2
set
v2
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t2
,
t1
set
t1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
t1
.
col1
=
t2
.
col1
;
update
t2
,
t1
set
t1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
t1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t2
,
v1
set
v1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v1
.
col1
=
t2
.
col1
;
update
t2
,
v1
set
v1
.
col1
=
(
select
max
(
col1
)
from
v2
)
where
v1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
v1
);
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
v1
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
t1
);
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
t1
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
v2
);
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
v2
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
v3
);
update
v3
set
v3
.
col1
=
(
select
max
(
col1
)
from
v3
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
from
v2
where
col1
=
(
select
max
(
col1
)
from
v1
);
delete
from
v2
where
col1
=
(
select
max
(
col1
)
from
v1
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
from
v2
where
col1
=
(
select
max
(
col1
)
from
t1
);
delete
from
v2
where
col1
=
(
select
max
(
col1
)
from
t1
);
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
from
v2
where
col1
=
(
select
max
(
col1
)
from
v2
);
delete
from
v2
where
col1
=
(
select
max
(
col1
)
from
v2
);
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
v2
from
v2
,
t2
where
(
select
max
(
col1
)
from
v1
)
>
0
and
v2
.
col1
=
t2
.
col1
;
delete
v2
from
v2
,
t2
where
(
select
max
(
col1
)
from
v1
)
>
0
and
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
t1
from
t1
,
t2
where
(
select
max
(
col1
)
from
v1
)
>
0
and
t1
.
col1
=
t2
.
col1
;
delete
t1
from
t1
,
t2
where
(
select
max
(
col1
)
from
v1
)
>
0
and
t1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
v1
from
v1
,
t2
where
(
select
max
(
col1
)
from
v1
)
>
0
and
v1
.
col1
=
t2
.
col1
;
delete
v1
from
v1
,
t2
where
(
select
max
(
col1
)
from
v1
)
>
0
and
v1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
v2
from
v2
,
t2
where
(
select
max
(
col1
)
from
t1
)
>
0
and
v2
.
col1
=
t2
.
col1
;
delete
v2
from
v2
,
t2
where
(
select
max
(
col1
)
from
t1
)
>
0
and
v2
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
t1
from
t1
,
t2
where
(
select
max
(
col1
)
from
t1
)
>
0
and
t1
.
col1
=
t2
.
col1
;
delete
t1
from
t1
,
t2
where
(
select
max
(
col1
)
from
t1
)
>
0
and
t1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
v1
from
v1
,
t2
where
(
select
max
(
col1
)
from
t1
)
>
0
and
v1
.
col1
=
t2
.
col1
;
delete
v1
from
v1
,
t2
where
(
select
max
(
col1
)
from
t1
)
>
0
and
v1
.
col1
=
t2
.
col1
;
--
error
1093
--
error
ER_UPDATE_TABLE_USED
delete
v2
from
v2
,
t2
where
(
select
max
(
col1
)
from
v2
)
>
0
and
v2
.
col1
=
t2
.
col1
;
delete
v2
from
v2
,
t2
where
(
select
max
(
col1
)
from
v2
)
>
0
and
v2
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
t1
from
t1
,
t2
where
(
select
max
(
col1
)
from
v2
)
>
0
and
t1
.
col1
=
t2
.
col1
;
delete
t1
from
t1
,
t2
where
(
select
max
(
col1
)
from
v2
)
>
0
and
t1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
delete
v1
from
v1
,
t2
where
(
select
max
(
col1
)
from
v2
)
>
0
and
v1
.
col1
=
t2
.
col1
;
delete
v1
from
v1
,
t2
where
(
select
max
(
col1
)
from
v2
)
>
0
and
v1
.
col1
=
t2
.
col1
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v2
values
((
select
max
(
col1
)
from
v1
));
insert
into
v2
values
((
select
max
(
col1
)
from
v1
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
t1
values
((
select
max
(
col1
)
from
v1
));
insert
into
t1
values
((
select
max
(
col1
)
from
v1
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v2
values
((
select
max
(
col1
)
from
v1
));
insert
into
v2
values
((
select
max
(
col1
)
from
v1
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v2
values
((
select
max
(
col1
)
from
t1
));
insert
into
v2
values
((
select
max
(
col1
)
from
t1
));
--
error
1093
--
error
ER_UPDATE_TABLE_USED
insert
into
t1
values
((
select
max
(
col1
)
from
t1
));
insert
into
t1
values
((
select
max
(
col1
)
from
t1
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v2
values
((
select
max
(
col1
)
from
t1
));
insert
into
v2
values
((
select
max
(
col1
)
from
t1
));
--
error
1093
--
error
ER_UPDATE_TABLE_USED
insert
into
v2
values
((
select
max
(
col1
)
from
v2
));
insert
into
v2
values
((
select
max
(
col1
)
from
v2
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
t1
values
((
select
max
(
col1
)
from
v2
));
insert
into
t1
values
((
select
max
(
col1
)
from
v2
));
--
error
1093
--
error
ER_UPDATE_TABLE_USED
insert
into
v2
values
((
select
max
(
col1
)
from
v2
));
insert
into
v2
values
((
select
max
(
col1
)
from
v2
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v3
(
col1
)
values
((
select
max
(
col1
)
from
v1
));
insert
into
v3
(
col1
)
values
((
select
max
(
col1
)
from
v1
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v3
(
col1
)
values
((
select
max
(
col1
)
from
t1
));
insert
into
v3
(
col1
)
values
((
select
max
(
col1
)
from
t1
));
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v3
(
col1
)
values
((
select
max
(
col1
)
from
v2
));
insert
into
v3
(
col1
)
values
((
select
max
(
col1
)
from
v2
));
#check with TZ tables in list
#
check with TZ tables in list
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
insert
into
v3
(
col1
)
values
((
select
CONVERT_TZ
(
'20050101000000'
,
'UTC'
,
'MET'
)
from
v2
));
insert
into
v3
(
col1
)
values
((
select
CONVERT_TZ
(
'20050101000000'
,
'UTC'
,
'MET'
)
from
v2
));
insert
into
v3
(
col1
)
values
((
select
CONVERT_TZ
(
'20050101000000'
,
'UTC'
,
'MET'
)
from
t2
));
insert
into
v3
(
col1
)
values
((
select
CONVERT_TZ
(
'20050101000000'
,
'UTC'
,
'MET'
)
from
t2
));
--
error
1048
--
error
ER_BAD_NULL_ERROR
insert
into
mysql
.
time_zone
values
(
''
,
(
select
CONVERT_TZ
(
'20050101000000'
,
'UTC'
,
'MET'
)
from
t2
));
insert
into
mysql
.
time_zone
values
(
''
,
(
select
CONVERT_TZ
(
'20050101000000'
,
'UTC'
,
'MET'
)
from
t2
));
# temporary table algorithm view should be equal to subquery in the from clause
# temporary table algorithm view should be equal to subquery in the from clause
create
algorithm
=
temptable
view
v4
as
select
*
from
t1
;
create
algorithm
=
temptable
view
v4
as
select
*
from
t1
;
...
@@ -957,7 +957,7 @@ drop table t1,t2;
...
@@ -957,7 +957,7 @@ drop table t1,t2;
#
#
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
--
error
1347
--
error
ER_WRONG_OBJECT
handler
v1
open
as
xx
;
handler
v1
open
as
xx
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -1005,7 +1005,7 @@ create table t2 (a int);
...
@@ -1005,7 +1005,7 @@ create table t2 (a int);
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
lock
tables
t1
read
,
v1
read
;
lock
tables
t1
read
,
v1
read
;
select
*
from
v1
;
select
*
from
v1
;
--
error
1100
--
error
ER_TABLE_NOT_LOCKED
select
*
from
t2
;
select
*
from
t2
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
@@ -1017,7 +1017,7 @@ create table t1 (a int);
...
@@ -1017,7 +1017,7 @@ create table t1 (a int);
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
# simple insert
# simple insert
insert
into
v1
values
(
1
);
insert
into
v1
values
(
1
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v1
values
(
3
);
insert
into
v1
values
(
3
);
# simple insert with ignore
# simple insert with ignore
insert
ignore
into
v1
values
(
2
),(
3
),(
0
);
insert
ignore
into
v1
values
(
2
),(
3
),(
0
);
...
@@ -1026,7 +1026,7 @@ select * from t1;
...
@@ -1026,7 +1026,7 @@ select * from t1;
delete
from
t1
;
delete
from
t1
;
# INSERT SELECT test
# INSERT SELECT test
insert
into
v1
SELECT
1
;
insert
into
v1
SELECT
1
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v1
SELECT
3
;
insert
into
v1
SELECT
3
;
# prepare data for next check
# prepare data for next check
create
table
t2
(
a
int
);
create
table
t2
(
a
int
);
...
@@ -1034,9 +1034,9 @@ insert into t2 values (2),(3),(0);
...
@@ -1034,9 +1034,9 @@ insert into t2 values (2),(3),(0);
# INSERT SELECT with ignore test
# INSERT SELECT with ignore test
insert
ignore
into
v1
SELECT
a
from
t2
;
insert
ignore
into
v1
SELECT
a
from
t2
;
select
*
from
t1
;
select
*
from
t1
;
#simple UPDATE test
#
simple UPDATE test
update
v1
set
a
=-
1
where
a
=
0
;
update
v1
set
a
=-
1
where
a
=
0
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
update
v1
set
a
=
2
where
a
=
1
;
update
v1
set
a
=
2
where
a
=
1
;
select
*
from
t1
;
select
*
from
t1
;
# prepare data for next check
# prepare data for next check
...
@@ -1063,12 +1063,12 @@ create view v2 as select * from v1 where a > 0 with local check option;
...
@@ -1063,12 +1063,12 @@ create view v2 as select * from v1 where a > 0 with local check option;
create
view
v3
as
select
*
from
v1
where
a
>
0
with
cascaded
check
option
;
create
view
v3
as
select
*
from
v1
where
a
>
0
with
cascaded
check
option
;
insert
into
v2
values
(
1
);
insert
into
v2
values
(
1
);
insert
into
v3
values
(
1
);
insert
into
v3
values
(
1
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v2
values
(
0
);
insert
into
v2
values
(
0
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v3
values
(
0
);
insert
into
v3
values
(
0
);
insert
into
v2
values
(
2
);
insert
into
v2
values
(
2
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v3
values
(
2
);
insert
into
v3
values
(
2
);
select
*
from
t1
;
select
*
from
t1
;
drop
view
v3
,
v2
,
v1
;
drop
view
v3
,
v2
,
v1
;
...
@@ -1080,7 +1080,7 @@ drop table t1;
...
@@ -1080,7 +1080,7 @@ drop table t1;
create
table
t1
(
a
int
,
primary
key
(
a
));
create
table
t1
(
a
int
,
primary
key
(
a
));
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
create
view
v1
as
select
*
from
t1
where
a
<
2
with
check
option
;
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
ignore
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
insert
ignore
into
v1
values
(
1
)
on
duplicate
key
update
a
=
2
;
select
*
from
t1
;
select
*
from
t1
;
...
@@ -1093,13 +1093,13 @@ drop table t1;
...
@@ -1093,13 +1093,13 @@ drop table t1;
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
create
view
v2
as
select
*
from
v1
;
create
view
v2
as
select
*
from
v1
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
alter
view
v1
as
select
*
from
v2
;
alter
view
v1
as
select
*
from
v2
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
alter
view
v1
as
select
*
from
v1
;
alter
view
v1
as
select
*
from
v1
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
create
or
replace
view
v1
as
select
*
from
v2
;
create
or
replace
view
v1
as
select
*
from
v2
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
create
or
replace
view
v1
as
select
*
from
v1
;
create
or
replace
view
v1
as
select
*
from
v1
;
drop
view
v2
,
v1
;
drop
view
v2
,
v1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -1134,7 +1134,7 @@ select * from t2;
...
@@ -1134,7 +1134,7 @@ select * from t2;
# check it with check option
# check it with check option
alter
view
v2
as
select
*
from
t2
where
s1
in
(
select
s1
from
t1
)
with
check
option
;
alter
view
v2
as
select
*
from
t2
where
s1
in
(
select
s1
from
t1
)
with
check
option
;
insert
into
v2
values
(
5
);
insert
into
v2
values
(
5
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
update
v2
set
s1
=
1
;
update
v2
set
s1
=
1
;
insert
into
t1
values
(
1
);
insert
into
t1
values
(
1
);
update
v2
set
s1
=
1
;
update
v2
set
s1
=
1
;
...
@@ -1166,7 +1166,7 @@ drop table t1;
...
@@ -1166,7 +1166,7 @@ drop table t1;
create
table
t1
(
s1
tinyint
);
create
table
t1
(
s1
tinyint
);
create
view
v1
as
select
*
from
t1
where
s1
<>
0
with
local
check
option
;
create
view
v1
as
select
*
from
t1
where
s1
<>
0
with
local
check
option
;
create
view
v2
as
select
*
from
v1
with
cascaded
check
option
;
create
view
v2
as
select
*
from
v1
with
cascaded
check
option
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v2
values
(
0
);
insert
into
v2
values
(
0
);
drop
view
v2
,
v1
;
drop
view
v2
,
v1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -1177,7 +1177,7 @@ drop table t1;
...
@@ -1177,7 +1177,7 @@ drop table t1;
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
create
view
v1
as
select
*
from
t1
where
s1
<
5
with
check
option
;
create
view
v1
as
select
*
from
t1
where
s1
<
5
with
check
option
;
#single value
#single value
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
ignore
into
v1
values
(
6
);
insert
ignore
into
v1
values
(
6
);
#several values
#several values
insert
ignore
into
v1
values
(
6
),(
3
);
insert
ignore
into
v1
values
(
6
),(
3
);
...
@@ -1191,7 +1191,7 @@ drop table t1;
...
@@ -1191,7 +1191,7 @@ drop table t1;
create
table
t1
(
s1
tinyint
);
create
table
t1
(
s1
tinyint
);
create
trigger
t1_bi
before
insert
on
t1
for
each
row
set
new
.
s1
=
500
;
create
trigger
t1_bi
before
insert
on
t1
for
each
row
set
new
.
s1
=
500
;
create
view
v1
as
select
*
from
t1
where
s1
<>
127
with
check
option
;
create
view
v1
as
select
*
from
t1
where
s1
<>
127
with
check
option
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v1
values
(
0
);
insert
into
v1
values
(
0
);
select
*
from
v1
;
select
*
from
v1
;
select
*
from
t1
;
select
*
from
t1
;
...
@@ -1205,7 +1205,7 @@ drop table t1;
...
@@ -1205,7 +1205,7 @@ drop table t1;
create
table
t1
(
s1
tinyint
);
create
table
t1
(
s1
tinyint
);
create
view
v1
as
select
*
from
t1
where
s1
<>
0
;
create
view
v1
as
select
*
from
t1
where
s1
<>
0
;
create
view
v2
as
select
*
from
v1
where
s1
<>
1
with
cascaded
check
option
;
create
view
v2
as
select
*
from
v1
where
s1
<>
1
with
cascaded
check
option
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
insert
into
v2
values
(
0
);
insert
into
v2
values
(
0
);
select
*
from
v2
;
select
*
from
v2
;
select
*
from
t1
;
select
*
from
t1
;
...
@@ -1218,7 +1218,7 @@ drop table t1;
...
@@ -1218,7 +1218,7 @@ drop table t1;
# fixed length fields
# fixed length fields
create
table
t1
(
a
int
,
b
char
(
10
));
create
table
t1
(
a
int
,
b
char
(
10
));
create
view
v1
as
select
*
from
t1
where
a
!=
0
with
check
option
;
create
view
v1
as
select
*
from
t1
where
a
!=
0
with
check
option
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
load
data
infile
'../std_data_ln/loaddata3.dat'
into
table
v1
fields
terminated
by
''
enclosed
by
''
ignore
1
lines
;
load
data
infile
'../std_data_ln/loaddata3.dat'
into
table
v1
fields
terminated
by
''
enclosed
by
''
ignore
1
lines
;
select
*
from
t1
;
select
*
from
t1
;
select
*
from
v1
;
select
*
from
v1
;
...
@@ -1231,7 +1231,7 @@ drop table t1;
...
@@ -1231,7 +1231,7 @@ drop table t1;
# variable length fields
# variable length fields
create
table
t1
(
a
text
,
b
text
);
create
table
t1
(
a
text
,
b
text
);
create
view
v1
as
select
*
from
t1
where
a
<>
'Field A'
with
check
option
;
create
view
v1
as
select
*
from
t1
where
a
<>
'Field A'
with
check
option
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
load
data
infile
'../std_data_ln/loaddata2.dat'
into
table
v1
fields
terminated
by
','
enclosed
by
''''
;
load
data
infile
'../std_data_ln/loaddata2.dat'
into
table
v1
fields
terminated
by
','
enclosed
by
''''
;
select
concat
(
'|'
,
a
,
'|'
),
concat
(
'|'
,
b
,
'|'
)
from
t1
;
select
concat
(
'|'
,
a
,
'|'
),
concat
(
'|'
,
b
,
'|'
)
from
t1
;
select
concat
(
'|'
,
a
,
'|'
),
concat
(
'|'
,
b
,
'|'
)
from
v1
;
select
concat
(
'|'
,
a
,
'|'
),
concat
(
'|'
,
b
,
'|'
)
from
v1
;
...
@@ -1247,14 +1247,14 @@ drop table t1;
...
@@ -1247,14 +1247,14 @@ drop table t1;
#
#
create
table
t1
(
s1
smallint
);
create
table
t1
(
s1
smallint
);
create
view
v1
as
select
*
from
t1
where
20
<
(
select
(
s1
)
from
t1
);
create
view
v1
as
select
*
from
t1
where
20
<
(
select
(
s1
)
from
t1
);
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v1
values
(
30
);
insert
into
v1
values
(
30
);
create
view
v2
as
select
*
from
t1
;
create
view
v2
as
select
*
from
t1
;
create
view
v3
as
select
*
from
t1
where
20
<
(
select
(
s1
)
from
v2
);
create
view
v3
as
select
*
from
t1
where
20
<
(
select
(
s1
)
from
v2
);
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v3
values
(
30
);
insert
into
v3
values
(
30
);
create
view
v4
as
select
*
from
v2
where
20
<
(
select
(
s1
)
from
t1
);
create
view
v4
as
select
*
from
v2
where
20
<
(
select
(
s1
)
from
t1
);
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v4
values
(
30
);
insert
into
v4
values
(
30
);
drop
view
v4
,
v3
,
v2
,
v1
;
drop
view
v4
,
v3
,
v2
,
v1
;
drop
table
t1
;
drop
table
t1
;
...
@@ -1312,7 +1312,7 @@ select * from t2;
...
@@ -1312,7 +1312,7 @@ select * from t2;
# view without primary key
# view without primary key
create
view
v2
(
a
,
b
)
as
select
t1
.
b
as
a
,
t2
.
a
as
b
from
t1
,
t2
;
create
view
v2
(
a
,
b
)
as
select
t1
.
b
as
a
,
t2
.
a
as
b
from
t1
,
t2
;
set
updatable_views_with_limit
=
NO
;
set
updatable_views_with_limit
=
NO
;
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
update
v2
set
a
=
10
where
a
=
200
limit
1
;
update
v2
set
a
=
10
where
a
=
200
limit
1
;
set
updatable_views_with_limit
=
DEFAULT
;
set
updatable_views_with_limit
=
DEFAULT
;
# just view selects
# just view selects
...
@@ -1340,14 +1340,14 @@ create table t2 (a int, primary key (a), b int);
...
@@ -1340,14 +1340,14 @@ create table t2 (a int, primary key (a), b int);
insert
into
t2
values
(
1000
,
2000
);
insert
into
t2
values
(
1000
,
2000
);
create
view
v3
(
a
,
b
)
as
select
t1
.
a
as
a
,
t2
.
a
as
b
from
t1
,
t2
;
create
view
v3
(
a
,
b
)
as
select
t1
.
a
as
a
,
t2
.
a
as
b
from
t1
,
t2
;
# inserting into join view without field list
# inserting into join view without field list
--
error
1394
--
error
ER_VIEW_NO_INSERT_FIELD_LIST
insert
into
v3
values
(
1
,
2
);
insert
into
v3
values
(
1
,
2
);
--
error
1394
--
error
ER_VIEW_NO_INSERT_FIELD_LIST
insert
into
v3
select
*
from
t2
;
insert
into
v3
select
*
from
t2
;
# inserting in several tables of join view
# inserting in several tables of join view
--
error
1393
--
error
ER_VIEW_MULTIUPDATE
insert
into
v3
(
a
,
b
)
values
(
1
,
2
);
insert
into
v3
(
a
,
b
)
values
(
1
,
2
);
--
error
1393
--
error
ER_VIEW_MULTIUPDATE
insert
into
v3
(
a
,
b
)
select
*
from
t2
;
insert
into
v3
(
a
,
b
)
select
*
from
t2
;
# correct inserts into join view
# correct inserts into join view
insert
into
v3
(
a
)
values
(
1
);
insert
into
v3
(
a
)
values
(
1
);
...
@@ -1358,11 +1358,11 @@ insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a);
...
@@ -1358,11 +1358,11 @@ insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a);
select
*
from
t1
;
select
*
from
t1
;
select
*
from
t2
;
select
*
from
t2
;
# try delete from join view
# try delete from join view
--
error
1395
--
error
ER_VIEW_DELETE_MERGE_VIEW
delete
from
v3
;
delete
from
v3
;
--
error
1395
--
error
ER_VIEW_DELETE_MERGE_VIEW
delete
v3
,
t1
from
v3
,
t1
;
delete
v3
,
t1
from
v3
,
t1
;
--
error
1395
--
error
ER_VIEW_DELETE_MERGE_VIEW
delete
t1
,
v3
from
t1
,
v3
;
delete
t1
,
v3
from
t1
,
v3
;
# delete from t1 just to reduce result set size
# delete from t1 just to reduce result set size
delete
from
t1
;
delete
from
t1
;
...
@@ -1394,7 +1394,7 @@ drop view v1;
...
@@ -1394,7 +1394,7 @@ drop view v1;
drop
table
t1
;
drop
table
t1
;
#
#
# Resolving view fields in subqueries in VIEW (Bug
#6394)
# Resolving view fields in subqueries in VIEW (Bug#6394)
#
#
create
table
t1
(
c1
int
);
create
table
t1
(
c1
int
);
create
table
t2
(
c2
int
);
create
table
t2
(
c2
int
);
...
@@ -1411,7 +1411,7 @@ drop view v2, v1;
...
@@ -1411,7 +1411,7 @@ drop view v2, v1;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
#
# view over other view setup (B
UG
#7433)
# view over other view setup (B
ug
#7433)
#
#
CREATE
TABLE
t1
(
C1
INT
,
C2
INT
);
CREATE
TABLE
t1
(
C1
INT
,
C2
INT
);
CREATE
TABLE
t2
(
C2
INT
);
CREATE
TABLE
t2
(
C2
INT
);
...
@@ -1422,7 +1422,7 @@ drop view v2, v1;
...
@@ -1422,7 +1422,7 @@ drop view v2, v1;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
#
# view and group_concat() (B
UG
#7116)
# view and group_concat() (B
ug
#7116)
#
#
create
table
t1
(
col1
char
(
5
),
col2
int
,
col3
int
);
create
table
t1
(
col1
char
(
5
),
col2
int
,
col3
int
);
insert
into
t1
values
(
'one'
,
10
,
25
),
(
'two'
,
10
,
50
),
(
'two'
,
10
,
50
),
(
'one'
,
20
,
25
),
(
'one'
,
30
,
25
);
insert
into
t1
values
(
'one'
,
10
,
25
),
(
'two'
,
10
,
50
),
(
'two'
,
10
,
50
),
(
'one'
,
20
,
25
),
(
'one'
,
30
,
25
);
...
@@ -1433,18 +1433,18 @@ drop view v1;
...
@@ -1433,18 +1433,18 @@ drop view v1;
drop
table
t1
;
drop
table
t1
;
#
#
# Item_ref resolved as view field (B
UG
#6894)
# Item_ref resolved as view field (B
ug
#6894)
#
#
create
table
t1
(
s1
int
,
s2
char
);
create
table
t1
(
s1
int
,
s2
char
);
create
view
v1
as
select
s1
,
s2
from
t1
;
create
view
v1
as
select
s1
,
s2
from
t1
;
--
error
1054
--
error
ER_BAD_FIELD_ERROR
select
s2
from
v1
vq1
where
2
=
(
select
count
(
*
)
from
v1
vq2
having
vq1
.
s2
=
vq2
.
s2
);
select
s2
from
v1
vq1
where
2
=
(
select
count
(
*
)
from
v1
vq2
having
vq1
.
s2
=
vq2
.
s2
);
select
s2
from
v1
vq1
where
2
=
(
select
count
(
*
)
aa
from
v1
vq2
having
vq1
.
s2
=
aa
);
select
s2
from
v1
vq1
where
2
=
(
select
count
(
*
)
aa
from
v1
vq2
having
vq1
.
s2
=
aa
);
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Test case for
bug
#9398 CREATE TABLE with SELECT from a multi-table view
# Test case for
Bug
#9398 CREATE TABLE with SELECT from a multi-table view
#
#
CREATE
TABLE
t1
(
a1
int
);
CREATE
TABLE
t1
(
a1
int
);
CREATE
TABLE
t2
(
a2
int
);
CREATE
TABLE
t2
(
a2
int
);
...
@@ -1460,7 +1460,7 @@ DROP VIEW v1;
...
@@ -1460,7 +1460,7 @@ DROP VIEW v1;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
#
#
# Test for B
UG#8703 "insert into table select from view crashes"
# Test for B
ug#8703 insert into table select from view crashes
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
create
table
t2
like
t1
;
create
table
t2
like
t1
;
...
@@ -1472,7 +1472,7 @@ drop view v1;
...
@@ -1472,7 +1472,7 @@ drop view v1;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
#
# Test for B
UG #6106:
query over a view using subquery for the underlying table
# Test for B
ug#6106
query over a view using subquery for the underlying table
#
#
CREATE
TABLE
t1
(
col1
int
PRIMARY
KEY
,
col2
varchar
(
10
));
CREATE
TABLE
t1
(
col1
int
PRIMARY
KEY
,
col2
varchar
(
10
));
...
@@ -1515,7 +1515,7 @@ SELECT a.col1,a.col2,b.col2,b.col3
...
@@ -1515,7 +1515,7 @@ SELECT a.col1,a.col2,b.col2,b.col3
WHERE
b
.
col2
IS
NULL
OR
WHERE
b
.
col2
IS
NULL
OR
b
.
col2
=
(
SELECT
MAX
(
col2
)
FROM
v2
b
WHERE
b
.
col1
=
a
.
col1
);
b
.
col2
=
(
SELECT
MAX
(
col2
)
FROM
v2
b
WHERE
b
.
col1
=
a
.
col1
);
# Tests from the report for
bug
#6107
# Tests from the report for
Bug
#6107
SELECT
a
.
col1
,
a
.
col2
,
b
.
col2
,
b
.
col3
SELECT
a
.
col1
,
a
.
col2
,
b
.
col2
,
b
.
col3
FROM
v2
b
RIGHT
JOIN
v1
a
ON
a
.
col1
=
b
.
col1
FROM
v2
b
RIGHT
JOIN
v1
a
ON
a
.
col1
=
b
.
col1
...
@@ -1534,7 +1534,7 @@ DROP VIEW v1,v2,v3;
...
@@ -1534,7 +1534,7 @@ DROP VIEW v1,v2,v3;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# B
UG#8490 Select from views containing subqueries causes server to hang
# B
ug#8490 Select from views containing subqueries causes server to hang
# forever.
# forever.
#
#
create
table
t1
as
select
1
A
union
select
2
union
select
3
;
create
table
t1
as
select
1
A
union
select
2
union
select
3
;
...
@@ -1549,7 +1549,7 @@ drop view v1, v2;
...
@@ -1549,7 +1549,7 @@ drop view v1, v2;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
#
# Test case for
bug #8528:
select from view over multi-table view
# Test case for
Bug#8528
select from view over multi-table view
#
#
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t2
(
b
int
);
CREATE
TABLE
t2
(
b
int
);
...
@@ -1565,7 +1565,7 @@ DROP VIEW v2,v1;
...
@@ -1565,7 +1565,7 @@ DROP VIEW v2,v1;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Correct restoring view name in SP table locking B
UG
#9758
# Correct restoring view name in SP table locking B
ug
#9758
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
create
view
v1
as
select
sum
(
a
)
from
t1
group
by
a
;
create
view
v1
as
select
sum
(
a
)
from
t1
group
by
a
;
...
@@ -1594,7 +1594,7 @@ SELECT d, c FROM v1 ORDER BY d,c;
...
@@ -1594,7 +1594,7 @@ SELECT d, c FROM v1 ORDER BY d,c;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# using sum(distinct ) & avg(distinct ) in views (B
UG
#7015)
# using sum(distinct ) & avg(distinct ) in views (B
ug
#7015)
#
#
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
create
view
v1
as
select
sum
(
distinct
s1
)
from
t1
;
create
view
v1
as
select
sum
(
distinct
s1
)
from
t1
;
...
@@ -1606,7 +1606,7 @@ drop view v1;
...
@@ -1606,7 +1606,7 @@ drop view v1;
drop
table
t1
;
drop
table
t1
;
#
#
# using cast(... as decimal) in views (B
UG
#11387);
# using cast(... as decimal) in views (B
ug
#11387);
#
#
create
view
v1
as
select
cast
(
1
as
decimal
);
create
view
v1
as
select
cast
(
1
as
decimal
);
select
*
from
v1
;
select
*
from
v1
;
...
@@ -1627,7 +1627,7 @@ drop view v1;
...
@@ -1627,7 +1627,7 @@ drop view v1;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
#
# Generation unique names for columns, and correct names check (B
UG
#7448)
# Generation unique names for columns, and correct names check (B
ug
#7448)
#
#
# names with ' and \
# names with ' and \
create
view
v1
as
select
'\\'
,
'\\shazam'
;
create
view
v1
as
select
'\\'
,
'\\shazam'
;
...
@@ -1670,24 +1670,24 @@ create view v1 as select 's1', 's1', s1 from t1;
...
@@ -1670,24 +1670,24 @@ create view v1 as select 's1', 's1', s1 from t1;
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
# underlying field name conflict with set name
# underlying field name conflict with set name
--
error
1060
--
error
ER_DUP_FIELDNAME
create
view
v1
as
select
1
as
s1
,
's1'
,
s1
from
t1
;
create
view
v1
as
select
1
as
s1
,
's1'
,
s1
from
t1
;
--
error
1060
--
error
ER_DUP_FIELDNAME
create
view
v1
as
select
's1'
,
s1
,
1
as
s1
from
t1
;
create
view
v1
as
select
's1'
,
s1
,
1
as
s1
from
t1
;
drop
table
t1
;
drop
table
t1
;
# set names differ by case only
# set names differ by case only
--
error
1060
--
error
ER_DUP_FIELDNAME
create
view
v1
(
k
,
K
)
as
select
1
,
2
;
create
view
v1
(
k
,
K
)
as
select
1
,
2
;
#
#
# using time_format in view (B
UG
#7521)
# using time_format in view (B
ug
#7521)
#
#
create
view
v1
as
SELECT
TIME_FORMAT
(
SEC_TO_TIME
(
3600
),
'%H:%i'
)
as
t
;
create
view
v1
as
SELECT
TIME_FORMAT
(
SEC_TO_TIME
(
3600
),
'%H:%i'
)
as
t
;
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
#
#
# evaluation constant functions in WHERE (B
UG
#4663)
# evaluation constant functions in WHERE (B
ug
#4663)
#
#
create
table
t1
(
a
timestamp
default
now
());
create
table
t1
(
a
timestamp
default
now
());
create
table
t2
(
b
timestamp
default
now
());
create
table
t2
(
b
timestamp
default
now
());
...
@@ -1708,7 +1708,7 @@ DROP VIEW v1;
...
@@ -1708,7 +1708,7 @@ DROP VIEW v1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# checking views after some view with error (B
UG
#11337)
# checking views after some view with error (B
ug
#11337)
#
#
CREATE
TABLE
t1
(
col1
time
);
CREATE
TABLE
t1
(
col1
time
);
CREATE
TABLE
t2
(
col1
time
);
CREATE
TABLE
t2
(
col1
time
);
...
@@ -1749,7 +1749,7 @@ drop view v1, v2, v3, v4, v5, v6;
...
@@ -1749,7 +1749,7 @@ drop view v1, v2, v3, v4, v5, v6;
drop
table
t2
,
t3
;
drop
table
t2
,
t3
;
#
#
#
bug
#11325 Wrong date comparison in views
#
Bug
#11325 Wrong date comparison in views
#
#
create
table
t1
(
f1
date
);
create
table
t1
(
f1
date
);
insert
into
t1
values
(
'2005-01-01'
),(
'2005-02-02'
);
insert
into
t1
values
(
'2005-01-01'
),(
'2005-02-02'
);
...
@@ -1760,7 +1760,7 @@ drop view v1;
...
@@ -1760,7 +1760,7 @@ drop view v1;
drop
table
t1
;
drop
table
t1
;
#
#
# using encrypt & substring_index in view (B
UG
#7024)
# using encrypt & substring_index in view (B
ug
#7024)
#
#
CREATE
VIEW
v1
AS
SELECT
ENCRYPT
(
"dhgdhgd"
);
CREATE
VIEW
v1
AS
SELECT
ENCRYPT
(
"dhgdhgd"
);
disable_result_log
;
disable_result_log
;
...
@@ -1772,21 +1772,21 @@ SELECT * FROM v1;
...
@@ -1772,21 +1772,21 @@ SELECT * FROM v1;
drop
view
v1
;
drop
view
v1
;
#
#
# hide underlying tables names in case of imposibility to update (B
UG
#10773)
# hide underlying tables names in case of imposibility to update (B
ug
#10773)
#
#
create
table
t1
(
f59
int
,
f60
int
,
f61
int
);
create
table
t1
(
f59
int
,
f60
int
,
f61
int
);
insert
into
t1
values
(
19
,
41
,
32
);
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
);
(
select
f59
from
t1
);
--
error
1288
--
error
ER_NON_UPDATABLE_TABLE
update
v1
set
f60
=
2345
;
update
v1
set
f60
=
2345
;
--
error
1443
--
error
ER_VIEW_PREVENT_UPDATE
update
t1
set
f60
=
(
select
max
(
f60
)
from
v1
);
update
t1
set
f60
=
(
select
max
(
f60
)
from
v1
);
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Using var_samp with view (B
UG
#10651)
# Using var_samp with view (B
ug
#10651)
#
#
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
create
view
v1
as
select
var_samp
(
s1
)
from
t1
;
create
view
v1
as
select
var_samp
(
s1
)
from
t1
;
...
@@ -1794,24 +1794,26 @@ show create view v1;
...
@@ -1794,24 +1794,26 @@ show create view v1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Correct inserting data check (absence of default value) for view
# Correct inserting data check (absence of default value) for view
# underlying tables (B
UG
#6443)
# underlying tables (B
ug
#6443)
#
#
set
sql_mode
=
'strict_all_tables'
;
set
sql_mode
=
'strict_all_tables'
;
CREATE
TABLE
t1
(
col1
INT
NOT
NULL
,
col2
INT
NOT
NULL
);
CREATE
TABLE
t1
(
col1
INT
NOT
NULL
,
col2
INT
NOT
NULL
);
CREATE
VIEW
v1
(
vcol1
)
AS
SELECT
col1
FROM
t1
;
CREATE
VIEW
v1
(
vcol1
)
AS
SELECT
col1
FROM
t1
;
CREATE
VIEW
v2
(
vcol1
)
AS
SELECT
col1
FROM
t1
WHERE
col2
>
2
;
CREATE
VIEW
v2
(
vcol1
)
AS
SELECT
col1
FROM
t1
WHERE
col2
>
2
;
--
error
1364
--
error
ER_NO_DEFAULT_FOR_FIELD
INSERT
INTO
t1
(
col1
)
VALUES
(
12
);
INSERT
INTO
t1
(
col1
)
VALUES
(
12
);
--
error
1423
--
error
ER_NO_DEFAULT_FOR_VIEW_FIELD
INSERT
INTO
v1
(
vcol1
)
VALUES
(
12
);
INSERT
INTO
v1
(
vcol1
)
VALUES
(
12
);
--
error
1423
--
error
ER_NO_DEFAULT_FOR_VIEW_FIELD
INSERT
INTO
v2
(
vcol1
)
VALUES
(
12
);
INSERT
INTO
v2
(
vcol1
)
VALUES
(
12
);
set
sql_mode
=
default
;
set
sql_mode
=
default
;
drop
view
v2
,
v1
;
drop
view
v2
,
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug#11399 Use an alias in a select statement on a view
# Bug#11399 Use an alias in a select statement on a view
#
#
...
@@ -1822,8 +1824,9 @@ select f1 as alias from v1;
...
@@ -1822,8 +1824,9 @@ select f1 as alias from v1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Test for
bug #6120:
SP cache to be invalidated when altering a view
# Test for
Bug#6120
SP cache to be invalidated when altering a view
#
#
CREATE
TABLE
t1
(
s1
int
,
s2
int
);
CREATE
TABLE
t1
(
s1
int
,
s2
int
);
...
@@ -1842,8 +1845,9 @@ DROP PROCEDURE p1;
...
@@ -1842,8 +1845,9 @@ DROP PROCEDURE p1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Test for
bug
#11709 View was ordered by wrong column
# Test for
Bug
#11709 View was ordered by wrong column
#
#
create
table
t1
(
f1
int
,
f2
int
);
create
table
t1
(
f1
int
,
f2
int
);
create
view
v1
as
select
f1
as
f3
,
f2
as
f1
from
t1
;
create
view
v1
as
select
f1
as
f3
,
f2
as
f1
from
t1
;
...
@@ -1852,8 +1856,9 @@ select * from v1 order by f1;
...
@@ -1852,8 +1856,9 @@ select * from v1 order by f1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Test for
bug #11771:
wrong query_id in SELECT * FROM <view>
# Test for
Bug#11771
wrong query_id in SELECT * FROM <view>
#
#
CREATE
TABLE
t1
(
f1
char
);
CREATE
TABLE
t1
(
f1
char
);
INSERT
INTO
t1
VALUES
(
'A'
);
INSERT
INTO
t1
VALUES
(
'A'
);
...
@@ -1866,8 +1871,9 @@ SELECT * FROM t1;
...
@@ -1866,8 +1871,9 @@ SELECT * FROM t1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# opening table in correct locking mode (B
UG
#9597)
# opening table in correct locking mode (B
ug
#9597)
#
#
CREATE
TABLE
t1
(
bug_table_seq
INTEGER
NOT
NULL
);
CREATE
TABLE
t1
(
bug_table_seq
INTEGER
NOT
NULL
);
CREATE
OR
REPLACE
VIEW
v1
AS
SELECT
*
from
t1
;
CREATE
OR
REPLACE
VIEW
v1
AS
SELECT
*
from
t1
;
...
@@ -1884,8 +1890,9 @@ DROP PROCEDURE p1;
...
@@ -1884,8 +1890,9 @@ DROP PROCEDURE p1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#11335 View redefines column types
# Bug#11335 View redefines column types
#
#
create
table
t1
(
f1
tinyint
(
1
),
f2
char
(
1
),
f3
varchar
(
1
),
f4
geometry
,
f5
datetime
);
create
table
t1
(
f1
tinyint
(
1
),
f2
char
(
1
),
f3
varchar
(
1
),
f4
geometry
,
f5
datetime
);
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
...
@@ -1893,8 +1900,9 @@ desc v1;
...
@@ -1893,8 +1900,9 @@ desc v1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#11760 Typo in Item_func_add_time::print() results in NULLs returned
# Bug#11760 Typo in Item_func_add_time::print() results in NULLs returned
# subtime() in view
# subtime() in view
create
table
t1
(
f1
datetime
);
create
table
t1
(
f1
datetime
);
insert
into
t1
values
(
'2005.01.01 12:0:0'
);
insert
into
t1
values
(
'2005.01.01 12:0:0'
);
...
@@ -1903,8 +1911,9 @@ select * from v1;
...
@@ -1903,8 +1911,9 @@ select * from v1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Test for
bug #11412:
query over a multitable view with GROUP_CONCAT
# Test for
Bug#11412
query over a multitable view with GROUP_CONCAT
#
#
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
aid
int
PRIMARY
KEY
,
aid
int
PRIMARY
KEY
,
...
@@ -1927,8 +1936,9 @@ SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
...
@@ -1927,8 +1936,9 @@ SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Test for
bug #12382:
SELECT * FROM view after INSERT command
# Test for
Bug#12382
SELECT * FROM view after INSERT command
#
#
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
,
f
varchar
(
255
));
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
,
f
varchar
(
255
));
...
@@ -1942,8 +1952,9 @@ SELECT * FROM v1;
...
@@ -1942,8 +1952,9 @@ SELECT * FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Test for
bug #12470:
crash for a simple select from a view defined
# Test for
Bug#12470
crash for a simple select from a view defined
# as a join over 5 tables
# as a join over 5 tables
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
,
b
int
);
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
,
b
int
);
...
@@ -1961,27 +1972,29 @@ SELECT a FROM v1;
...
@@ -1961,27 +1972,29 @@ SELECT a FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
,
t5
;
#
#
# Bug
#12298 Typo in
function name results in erroneous view being created.
# Bug
#12298 Typo in
function name results in erroneous view being created.
#
#
create
view
v1
as
select
timestampdiff
(
day
,
'1997-01-01 00:00:00'
,
'1997-01-02 00:00:00'
)
as
f1
;
create
view
v1
as
select
timestampdiff
(
day
,
'1997-01-01 00:00:00'
,
'1997-01-02 00:00:00'
)
as
f1
;
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
#
#
# repeatable CREATE VIEW statement B
UG
#12468
# repeatable CREATE VIEW statement B
ug
#12468
#
#
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
create
procedure
p1
()
create
view
v1
as
select
*
from
t1
;
create
procedure
p1
()
create
view
v1
as
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
--
error
1146
--
error
ER_NO_SUCH_TABLE
call
p1
();
call
p1
();
--
error
1146
--
error
ER_NO_SUCH_TABLE
call
p1
();
call
p1
();
drop
procedure
p1
;
drop
procedure
p1
;
#
#
# Bug
#10624 Views with multiple UNION and UNION ALL produce incorrect results
# Bug#10624 Views with multiple UNION and UNION ALL produce incorrect results
#
#
create
table
t1
(
f1
int
);
create
table
t1
(
f1
int
);
create
table
t2
(
f1
int
);
create
table
t2
(
f1
int
);
...
@@ -1991,20 +2004,23 @@ create view v1 as select * from t1 union select * from t2 union all select * fro
...
@@ -1991,20 +2004,23 @@ create view v1 as select * from t1 union select * from t2 union all select * fro
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
#
# Test for
bug #10970:
view referring a temporary table indirectly
# Test for
Bug#10970
view referring a temporary table indirectly
#
#
CREATE
TEMPORARY
TABLE
t1
(
a
int
);
CREATE
TEMPORARY
TABLE
t1
(
a
int
);
CREATE
FUNCTION
f1
()
RETURNS
int
RETURN
(
SELECT
COUNT
(
*
)
FROM
t1
);
CREATE
FUNCTION
f1
()
RETURNS
int
RETURN
(
SELECT
COUNT
(
*
)
FROM
t1
);
--
error
1352
--
error
ER_VIEW_SELECT_TMPTABLE
CREATE
VIEW
v1
AS
SELECT
f1
();
CREATE
VIEW
v1
AS
SELECT
f1
();
DROP
FUNCTION
f1
;
DROP
FUNCTION
f1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# B
UG
#12533 (crash on DESCRIBE <view> after renaming base table column)
# B
ug
#12533 (crash on DESCRIBE <view> after renaming base table column)
#
#
--
disable_warnings
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
;
DROP
TABLE
IF
EXISTS
t1
;
...
@@ -2016,13 +2032,14 @@ CREATE VIEW v1 AS SELECT * FROM t1;
...
@@ -2016,13 +2032,14 @@ CREATE VIEW v1 AS SELECT * FROM t1;
DESCRIBE
v1
;
DESCRIBE
v1
;
ALTER
TABLE
t1
CHANGE
COLUMN
f4
f4x
CHAR
(
5
);
ALTER
TABLE
t1
CHANGE
COLUMN
f4
f4x
CHAR
(
5
);
--
error
1356
--
error
ER_VIEW_INVALID
DESCRIBE
v1
;
DESCRIBE
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
#
#
# Bug
#12489 wrongly printed strcmp() function results in creation of broken
# Bug#12489 wrongly printed strcmp() function results in creation of broken
# view
# view
create
table
t1
(
f1
char
);
create
table
t1
(
f1
char
);
create
view
v1
as
select
strcmp
(
f1
,
'a'
)
from
t1
;
create
view
v1
as
select
strcmp
(
f1
,
'a'
)
from
t1
;
...
@@ -2030,8 +2047,9 @@ select * from v1;
...
@@ -2030,8 +2047,9 @@ select * from v1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#12922 if(sum(),...) with group from view returns wrong results
# Bug
#12922 if(sum(),...) with group from view returns wrong results
#
#
create
table
t1
(
f1
int
,
f2
int
,
f3
int
);
create
table
t1
(
f1
int
,
f2
int
,
f3
int
);
insert
into
t1
values
(
1
,
10
,
20
),(
2
,
0
,
0
);
insert
into
t1
values
(
1
,
10
,
20
),(
2
,
0
,
0
);
...
@@ -2039,7 +2057,9 @@ create view v1 as select * from t1;
...
@@ -2039,7 +2057,9 @@ create view v1 as select * from t1;
select
if
(
sum
(
f1
)
>
1
,
f2
,
f3
)
from
v1
group
by
f1
;
select
if
(
sum
(
f1
)
>
1
,
f2
,
f3
)
from
v1
group
by
f1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
# BUG#12941
# Bug#12941
#
#
--
disable_warnings
--
disable_warnings
create
table
t1
(
create
table
t1
(
...
@@ -2073,7 +2093,8 @@ order by users_names;
...
@@ -2073,7 +2093,8 @@ order by users_names;
drop
view
v1
,
v2
;
drop
view
v1
,
v2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
# Bug #6808 - Views: CREATE VIEW v ... FROM t AS v fails
# Bug#6808 Views: CREATE VIEW v ... FROM t AS v fails
#
#
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
...
@@ -2081,8 +2102,9 @@ create view abc as select * from t1 as abc;
...
@@ -2081,8 +2102,9 @@ create view abc as select * from t1 as abc;
drop
table
t1
;
drop
table
t1
;
drop
view
abc
;
drop
view
abc
;
#
#
# Bug
#12993 View column rename broken in subselect
# Bug#12993 View column rename broken in subselect
#
#
create
table
t1
(
f1
char
(
1
));
create
table
t1
(
f1
char
(
1
));
create
view
v1
as
select
*
from
t1
;
create
view
v1
as
select
*
from
t1
;
...
@@ -2090,15 +2112,17 @@ select * from (select f1 as f2 from v1) v where v.f2='a';
...
@@ -2090,15 +2112,17 @@ select * from (select f1 as f2 from v1) v where v.f2='a';
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#11416 Server crash if using a view that uses function convert_tz
# Bug#11416 Server crash if using a view that uses function convert_tz
#
#
create
view
v1
as
SELECT
CONVERT_TZ
(
'2004-01-01 12:00:00'
,
'GMT'
,
'MET'
);
create
view
v1
as
SELECT
CONVERT_TZ
(
'2004-01-01 12:00:00'
,
'GMT'
,
'MET'
);
select
*
from
v1
;
select
*
from
v1
;
drop
view
v1
;
drop
view
v1
;
#
#
# Bugs
#12963, #13000:
wrong creation of VIEW with DAYNAME, DAYOFWEEK, and WEEKDAY
# Bugs
#12963, #13000
wrong creation of VIEW with DAYNAME, DAYOFWEEK, and WEEKDAY
#
#
CREATE
TABLE
t1
(
date
DATE
NOT
NULL
);
CREATE
TABLE
t1
(
date
DATE
NOT
NULL
);
...
@@ -2128,8 +2152,9 @@ SELECT * FROM v3;
...
@@ -2128,8 +2152,9 @@ SELECT * FROM v3;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
DROP
VIEW
v1
,
v2
,
v3
;
DROP
VIEW
v1
,
v2
,
v3
;
#
#
# Bug
#13411: crash when using non-qualified view column in HAVING clause
# Bug
#13411 crash when using non-qualified view column in HAVING clause
#
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
CREATE
TABLE
t1
(
a
int
,
b
int
);
...
@@ -2141,8 +2166,9 @@ SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
...
@@ -2141,8 +2166,9 @@ SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#13410: failed name resolution for qualified view column in HAVING
# Bug
#13410 failed name resolution for qualified view column in HAVING
#
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
CREATE
TABLE
t1
(
a
int
,
b
int
);
...
@@ -2156,8 +2182,9 @@ SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3);
...
@@ -2156,8 +2182,9 @@ SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3);
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#13327 view wasn't using index for const condition
# Bug#13327 view wasn't using index for const condition
#
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
INDEX
(
a
,
b
));
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
INDEX
(
a
,
b
));
...
@@ -2174,8 +2201,9 @@ EXPLAIN SELECT * FROM v2 WHERE a=1;
...
@@ -2174,8 +2201,9 @@ EXPLAIN SELECT * FROM v2 WHERE a=1;
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
#
#
# Bug
#13622 Wrong view .frm created if some field's alias contain \n
# Bug#13622 Wrong view .frm created if some field's alias contain \n
#
#
create
table
t1
(
f1
int
);
create
table
t1
(
f1
int
);
create
view
v1
as
select
t1
.
f1
as
'123
create
view
v1
as
select
t1
.
f1
as
'123
...
@@ -2184,7 +2212,8 @@ select * from v1;
...
@@ -2184,7 +2212,8 @@ select * from v1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
# Bug #14466 lost sort order in GROUP_CONCAT() in a view
# Bug#14466 lost sort order in GROUP_CONCAT() in a view
#
#
create
table
t1
(
f1
int
,
f2
int
);
create
table
t1
(
f1
int
,
f2
int
);
insert
into
t1
values
(
1
,
1
),(
1
,
2
),(
1
,
3
);
insert
into
t1
values
(
1
,
1
),(
1
,
2
),(
1
,
3
);
...
@@ -2195,8 +2224,9 @@ select * from v2;
...
@@ -2195,8 +2224,9 @@ select * from v2;
drop
view
v1
,
v2
;
drop
view
v1
,
v2
;
drop
table
t1
;
drop
table
t1
;
#
#
# B
UG
#14026 Crash on second PS execution when using views
# B
ug
#14026 Crash on second PS execution when using views
#
#
create
table
t1
(
x
int
,
y
int
);
create
table
t1
(
x
int
,
y
int
);
create
table
t2
(
x
int
,
y
int
,
z
int
);
create
table
t2
(
x
int
,
y
int
,
z
int
);
...
@@ -2219,8 +2249,9 @@ execute stmt1 using @parm1;
...
@@ -2219,8 +2249,9 @@ execute stmt1 using @parm1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
,
t2
,
t3
,
t4
;
drop
table
t1
,
t2
,
t3
,
t4
;
#
#
# Bug
#14540:
OPTIMIZE, ANALYZE, REPAIR applied to not a view
# Bug
#14540
OPTIMIZE, ANALYZE, REPAIR applied to not a view
#
#
CREATE
TABLE
t1
(
id
INT
);
CREATE
TABLE
t1
(
id
INT
);
...
@@ -2239,7 +2270,7 @@ DROP VIEW v1;
...
@@ -2239,7 +2270,7 @@ DROP VIEW v1;
#
#
# B
UG#14719:
Views DEFINER grammar is incorrect
# B
ug#14719
Views DEFINER grammar is incorrect
#
#
create
definer
=
current_user
()
sql
security
invoker
view
v1
as
select
1
;
create
definer
=
current_user
()
sql
security
invoker
view
v1
as
select
1
;
...
@@ -2250,8 +2281,9 @@ create definer = current_user sql security invoker view v1 as select 1;
...
@@ -2250,8 +2281,9 @@ create definer = current_user sql security invoker view v1 as select 1;
show
create
view
v1
;
show
create
view
v1
;
drop
view
v1
;
drop
view
v1
;
#
#
# Bug
#14816 test_if_order_by_key() expected only Item_fields.
# Bug#14816 test_if_order_by_key() expected only Item_fields.
#
#
create
table
t1
(
id
INT
,
primary
key
(
id
));
create
table
t1
(
id
INT
,
primary
key
(
id
));
insert
into
t1
values
(
1
),(
2
);
insert
into
t1
values
(
1
),(
2
);
...
@@ -2260,8 +2292,9 @@ explain select id from v1 order by id;
...
@@ -2260,8 +2292,9 @@ explain select id from v1 order by id;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#14850 Item_ref's values wasn't updated
# Bug#14850 Item_ref's values wasn't updated
#
#
create
table
t1
(
f1
int
,
f2
int
);
create
table
t1
(
f1
int
,
f2
int
);
insert
into
t1
values
(
null
,
10
),
(
null
,
2
);
insert
into
t1
values
(
null
,
10
),
(
null
,
2
);
...
@@ -2271,8 +2304,9 @@ select f1, sum(f2) from v1 group by f1;
...
@@ -2271,8 +2304,9 @@ select f1, sum(f2) from v1 group by f1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# B
UG#14885:
incorrect SOURCE in view created in a procedure
# B
ug#14885
incorrect SOURCE in view created in a procedure
# TODO: here SOURCE string must be shown when it will be possible
# TODO: here SOURCE string must be shown when it will be possible
#
#
--
disable_warnings
--
disable_warnings
...
@@ -2290,8 +2324,9 @@ show create view v1;
...
@@ -2290,8 +2324,9 @@ show create view v1;
drop
view
v1
;
drop
view
v1
;
drop
procedure
p1
;
drop
procedure
p1
;
#
#
# B
UG#15096:
using function with view for view creation
# B
ug#15096
using function with view for view creation
#
#
CREATE
VIEW
v1
AS
SELECT
42
AS
Meaning
;
CREATE
VIEW
v1
AS
SELECT
42
AS
Meaning
;
--
disable_warnings
--
disable_warnings
...
@@ -2311,8 +2346,9 @@ select * from v2;
...
@@ -2311,8 +2346,9 @@ select * from v2;
drop
view
v2
,
v1
;
drop
view
v2
,
v1
;
drop
function
f1
;
drop
function
f1
;
#
#
# Bug#14861
:
aliased column names are not preserved.
# Bug#14861 aliased column names are not preserved.
#
#
create
table
t1
(
id
numeric
,
warehouse_id
numeric
);
create
table
t1
(
id
numeric
,
warehouse_id
numeric
);
create
view
v1
as
select
id
from
t1
;
create
view
v1
as
select
id
from
t1
;
...
@@ -2330,8 +2366,9 @@ order by v2.receipt_id;
...
@@ -2330,8 +2366,9 @@ order by v2.receipt_id;
drop
view
v2
,
v1
;
drop
view
v2
,
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug#16016
:
MIN/MAX optimization for views
# Bug#16016 MIN/MAX optimization for views
#
#
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
,
b
int
);
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
,
b
int
);
...
@@ -2354,8 +2391,9 @@ EXPLAIN SELECT MIN(a) FROM v1;
...
@@ -2354,8 +2391,9 @@ EXPLAIN SELECT MIN(a) FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug#16382
:
grouping name is resolved against a view column name
# Bug#16382 grouping name is resolved against a view column name
# which coincides with a select column name
# which coincides with a select column name
CREATE
TABLE
t1
(
x
varchar
(
10
));
CREATE
TABLE
t1
(
x
varchar
(
10
));
...
@@ -2371,8 +2409,9 @@ SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
...
@@ -2371,8 +2409,9 @@ SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# B
UG#15943:
mysql_next_result hangs on invalid SHOW CREATE VIEW
# B
ug#15943
mysql_next_result hangs on invalid SHOW CREATE VIEW
#
#
delimiter
//;
delimiter
//;
...
@@ -2386,6 +2425,7 @@ drop view v1;
...
@@ -2386,6 +2425,7 @@ drop view v1;
//
//
delimiter
;
//
delimiter
;
//
#
#
# Bug#17726 Not checked empty list caused endless loop
# Bug#17726 Not checked empty list caused endless loop
#
#
...
@@ -2400,8 +2440,9 @@ select * from v2;
...
@@ -2400,8 +2440,9 @@ select * from v2;
drop
view
v2
,
v1
;
drop
view
v2
,
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#18386: select from view over a table with ORDER BY view_col clause
# Bug
#18386 select from view over a table with ORDER BY view_col clause
# given view_col is not an image of any column from the base table
# given view_col is not an image of any column from the base table
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t1
(
a
int
);
...
@@ -2414,8 +2455,9 @@ SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
...
@@ -2414,8 +2455,9 @@ SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#18237: invalid count optimization applied to an outer join with a view
# Bug
#18237 invalid count optimization applied to an outer join with a view
#
#
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
);
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
);
...
@@ -2435,8 +2477,9 @@ DROP VIEW v2;
...
@@ -2435,8 +2477,9 @@ DROP VIEW v2;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug
#16069:
VIEW does return the same results as underlying SELECT
# Bug
#16069
VIEW does return the same results as underlying SELECT
# with WHERE condition containing BETWEEN over dates
# with WHERE condition containing BETWEEN over dates
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
...
@@ -2455,8 +2498,9 @@ SELECT * FROM v1 WHERE td BETWEEN CAST('2005.01.02' AS DATE) AND CAST('2005.01.0
...
@@ -2455,8 +2498,9 @@ SELECT * FROM v1 WHERE td BETWEEN CAST('2005.01.02' AS DATE) AND CAST('2005.01.0
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# B
UG#14308:
Recursive view definitions
# B
ug#14308
Recursive view definitions
#
#
# using view only
# using view only
create
table
t1
(
a
int
);
create
table
t1
(
a
int
);
...
@@ -2486,8 +2530,9 @@ select * from v1;
...
@@ -2486,8 +2530,9 @@ select * from v1;
drop
function
f1
;
drop
function
f1
;
drop
view
t1
,
v1
;
drop
view
t1
,
v1
;
#
#
# Bug
#15153:
CONVERT_TZ() is not allowed in all places in VIEWs
# Bug
#15153
CONVERT_TZ() is not allowed in all places in VIEWs
#
#
# Error was reported when one tried to use CONVERT_TZ() function
# Error was reported when one tried to use CONVERT_TZ() function
# select list of view which was processed using MERGE algorithm.
# select list of view which was processed using MERGE algorithm.
...
@@ -2513,8 +2558,9 @@ select * from v2;
...
@@ -2513,8 +2558,9 @@ select * from v2;
drop
view
v1
,
v2
;
drop
view
v1
,
v2
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#19490:
usage of view specified by a query with GROUP BY
# Bug
#19490
usage of view specified by a query with GROUP BY
# an expression containing non-constant interval
# an expression containing non-constant interval
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
d
datetime
);
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
d
datetime
);
...
@@ -2529,8 +2575,9 @@ SELECT * FROM v1;
...
@@ -2529,8 +2575,9 @@ SELECT * FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug#19077
:
A nested materialized view is used before being populated.
# Bug#19077 A nested materialized view is used before being populated.
#
#
CREATE
TABLE
t1
(
i
INT
,
j
BIGINT
);
CREATE
TABLE
t1
(
i
INT
,
j
BIGINT
);
INSERT
INTO
t1
VALUES
(
1
,
2
),
(
2
,
2
),
(
3
,
2
);
INSERT
INTO
t1
VALUES
(
1
,
2
),
(
2
,
2
),
(
3
,
2
);
...
@@ -2540,8 +2587,9 @@ SELECT * FROM v2;
...
@@ -2540,8 +2587,9 @@ SELECT * FROM v2;
DROP
VIEW
v2
,
v1
;
DROP
VIEW
v2
,
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#19573:
VIEW with HAVING that refers an alias name
# Bug
#19573
VIEW with HAVING that refers an alias name
#
#
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
...
@@ -2567,8 +2615,9 @@ SELECT * FROM v1;
...
@@ -2567,8 +2615,9 @@ SELECT * FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#19089:
wrong inherited dafault values in temp table views
# Bug
#19089
wrong inherited dafault values in temp table views
#
#
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
a
char
(
6
)
DEFAULT
'xxx'
);
CREATE
TABLE
t1
(
id
int
NOT
NULL
PRIMARY
KEY
,
a
char
(
6
)
DEFAULT
'xxx'
);
...
@@ -2600,7 +2649,7 @@ DROP TABLE t1,t2;
...
@@ -2600,7 +2649,7 @@ DROP TABLE t1,t2;
#
#
# Bug#16110
:
insert permitted into view col w/o default value
# Bug#16110 insert permitted into view col w/o default value
#
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NULL
DEFAULT
NULL
);
CREATE
TABLE
t1
(
a
INT
NOT
NULL
,
b
INT
NULL
DEFAULT
NULL
);
CREATE
VIEW
v1
AS
SELECT
a
,
b
FROM
t1
;
CREATE
VIEW
v1
AS
SELECT
a
,
b
FROM
t1
;
...
@@ -2608,7 +2657,7 @@ CREATE VIEW v1 AS SELECT a, b FROM t1;
...
@@ -2608,7 +2657,7 @@ CREATE VIEW v1 AS SELECT a, b FROM t1;
INSERT
INTO
v1
(
b
)
VALUES
(
2
);
INSERT
INTO
v1
(
b
)
VALUES
(
2
);
SET
SQL_MODE
=
STRICT_ALL_TABLES
;
SET
SQL_MODE
=
STRICT_ALL_TABLES
;
--
error
1423
--
error
ER_NO_DEFAULT_FOR_VIEW_FIELD
INSERT
INTO
v1
(
b
)
VALUES
(
4
);
INSERT
INTO
v1
(
b
)
VALUES
(
4
);
SET
SQL_MODE
=
''
;
SET
SQL_MODE
=
''
;
...
@@ -2617,8 +2666,9 @@ SELECT * FROM t1;
...
@@ -2617,8 +2666,9 @@ SELECT * FROM t1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#18243:
expression over a view column that with the REVERSE function
# Bug
#18243
expression over a view column that with the REVERSE function
#
#
CREATE
TABLE
t1
(
firstname
text
,
surname
text
);
CREATE
TABLE
t1
(
firstname
text
,
surname
text
);
...
@@ -2633,8 +2683,9 @@ SELECT CONCAT(LEFT(name,LENGTH(name)-INSTR(REVERSE(name)," ")),
...
@@ -2633,8 +2683,9 @@ SELECT CONCAT(LEFT(name,LENGTH(name)-INSTR(REVERSE(name)," ")),
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#19714:
wrong type of a view column specified by an expressions over ints
# Bug
#19714
wrong type of a view column specified by an expressions over ints
#
#
CREATE
TABLE
t1
(
i
int
,
j
int
);
CREATE
TABLE
t1
(
i
int
,
j
int
);
...
@@ -2646,8 +2697,9 @@ DESCRIBE t2;
...
@@ -2646,8 +2697,9 @@ DESCRIBE t2;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug
#17526:
views with TRIM functions
# Bug
#17526
views with TRIM functions
#
#
CREATE
TABLE
t1
(
s
varchar
(
10
));
CREATE
TABLE
t1
(
s
varchar
(
10
));
...
@@ -2670,8 +2722,9 @@ DROP VIEW v1;
...
@@ -2670,8 +2722,9 @@ DROP VIEW v1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
#
Bug #21080:
ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
#
Bug#21080
ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
#
#
CREATE
TABLE
t1
(
x
INT
,
y
INT
);
CREATE
TABLE
t1
(
x
INT
,
y
INT
);
CREATE
ALGORITHM
=
TEMPTABLE
SQL
SECURITY
INVOKER
VIEW
v1
AS
SELECT
x
FROM
t1
;
CREATE
ALGORITHM
=
TEMPTABLE
SQL
SECURITY
INVOKER
VIEW
v1
AS
SELECT
x
FROM
t1
;
...
@@ -2682,7 +2735,9 @@ SHOW CREATE VIEW v1;
...
@@ -2682,7 +2735,9 @@ SHOW CREATE VIEW v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE
# Bug#21086 server crashes when VIEW defined with a SELECT with COLLATE
# clause is called
# clause is called
#
#
CREATE
TABLE
t1
(
s1
char
);
CREATE
TABLE
t1
(
s1
char
);
...
@@ -2700,19 +2755,20 @@ SELECT s1 FROM t1;
...
@@ -2700,19 +2755,20 @@ SELECT s1 FROM t1;
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#11551:
Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
# Bug
#11551
Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
#
#
CREATE
TABLE
t1
(
id
INT
);
CREATE
TABLE
t1
(
id
INT
);
CREATE
VIEW
v1
AS
SELECT
id
FROM
t1
;
CREATE
VIEW
v1
AS
SELECT
id
FROM
t1
;
SHOW
TABLES
;
SHOW
TABLES
;
--
error
1051
--
error
ER_BAD_TABLE_ERROR
DROP
VIEW
v2
,
v1
;
DROP
VIEW
v2
,
v1
;
SHOW
TABLES
;
SHOW
TABLES
;
CREATE
VIEW
v1
AS
SELECT
id
FROM
t1
;
CREATE
VIEW
v1
AS
SELECT
id
FROM
t1
;
--
error
1347
--
error
ER_WRONG_OBJECT
DROP
VIEW
t1
,
v1
;
DROP
VIEW
t1
,
v1
;
SHOW
TABLES
;
SHOW
TABLES
;
...
@@ -2721,13 +2777,14 @@ DROP TABLE t1;
...
@@ -2721,13 +2777,14 @@ DROP TABLE t1;
DROP
VIEW
IF
EXISTS
v1
;
DROP
VIEW
IF
EXISTS
v1
;
--
enable_warnings
--
enable_warnings
#
#
# Bug
#21261:
Wrong access rights was required for an insert to a view
# Bug
#21261
Wrong access rights was required for an insert to a view
#
#
CREATE
DATABASE
bug21261DB
;
CREATE
DATABASE
bug21261DB
;
USE
bug21261DB
;
USE
bug21261DB
;
CONNECT
(
root
,
localhost
,
root
,,
bug21261DB
);
connect
(
root
,
localhost
,
root
,,
bug21261DB
);
CONNECTION
root
;
connection
root
;
CREATE
TABLE
t1
(
x
INT
);
CREATE
TABLE
t1
(
x
INT
);
CREATE
SQL
SECURITY
INVOKER
VIEW
v1
AS
SELECT
x
FROM
t1
;
CREATE
SQL
SECURITY
INVOKER
VIEW
v1
AS
SELECT
x
FROM
t1
;
...
@@ -2736,34 +2793,41 @@ GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
...
@@ -2736,34 +2793,41 @@ GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
CREATE
TABLE
t2
(
y
INT
);
CREATE
TABLE
t2
(
y
INT
);
GRANT
SELECT
ON
t2
TO
'user21261'
@
'localhost'
;
GRANT
SELECT
ON
t2
TO
'user21261'
@
'localhost'
;
CONNECT
(
user21261
,
localhost
,
user21261
,,
bug21261DB
);
connect
(
user21261
,
localhost
,
user21261
,,
bug21261DB
);
CONNECTION
user21261
;
connection
user21261
;
INSERT
INTO
v1
(
x
)
VALUES
(
5
);
INSERT
INTO
v1
(
x
)
VALUES
(
5
);
UPDATE
v1
SET
x
=
1
;
UPDATE
v1
SET
x
=
1
;
CONNECTION
root
;
connection
root
;
GRANT
SELECT
ON
v1
TO
'user21261'
@
'localhost'
;
GRANT
SELECT
ON
v1
TO
'user21261'
@
'localhost'
;
GRANT
SELECT
ON
t1
TO
'user21261'
@
'localhost'
;
GRANT
SELECT
ON
t1
TO
'user21261'
@
'localhost'
;
CONNECTION
user21261
;
connection
user21261
;
UPDATE
v1
,
t2
SET
x
=
1
WHERE
x
=
y
;
UPDATE
v1
,
t2
SET
x
=
1
WHERE
x
=
y
;
CONNECTION
root
;
connection
root
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
'user21261'
@
'localhost'
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
'user21261'
@
'localhost'
;
DROP
USER
'user21261'
@
'localhost'
;
DROP
USER
'user21261'
@
'localhost'
;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
DROP
DATABASE
bug21261DB
;
DROP
DATABASE
bug21261DB
;
connection
default
;
USE
test
;
USE
test
;
disconnect
root
;
disconnect
user21261
;
#
#
# Bug
#15950:
NOW() optimized away in VIEWs
# Bug
#15950
NOW() optimized away in VIEWs
#
#
create
table
t1
(
f1
datetime
);
create
table
t1
(
f1
datetime
);
create
view
v1
as
select
*
from
t1
where
f1
between
now
()
and
now
()
+
interval
1
minute
;
create
view
v1
as
select
*
from
t1
where
f1
between
now
()
and
now
()
+
interval
1
minute
;
show
create
view
v1
;
show
create
view
v1
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Test for B
UG#16899:
Possible buffer overflow in handling of DEFINER-clause.
# Test for B
ug#16899
Possible buffer overflow in handling of DEFINER-clause.
#
#
# Prepare.
# Prepare.
...
@@ -2790,8 +2854,7 @@ DROP TABLE t1;
...
@@ -2790,8 +2854,7 @@ DROP TABLE t1;
#
#
# BUG#17591: Updatable view not possible with trigger or stored
# Bug#17591 Updatable view not possible with trigger or stored function
# function
#
#
# During prelocking phase we didn't update lock type of view tables,
# During prelocking phase we didn't update lock type of view tables,
# hence READ lock was always requested.
# hence READ lock was always requested.
...
@@ -2835,8 +2898,9 @@ DROP FUNCTION f2;
...
@@ -2835,8 +2898,9 @@ DROP FUNCTION f2;
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#5500:
wrong select_type in EXPLAIN output for queries over views
# Bug
#5500
wrong select_type in EXPLAIN output for queries over views
#
#
CREATE
TABLE
t1
(
s1
int
);
CREATE
TABLE
t1
(
s1
int
);
...
@@ -2853,19 +2917,21 @@ EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
...
@@ -2853,19 +2917,21 @@ EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#5505:
Wrong error message on INSERT into a view
# Bug
#5505
Wrong error message on INSERT into a view
#
#
create
table
t1
(
s1
int
);
create
table
t1
(
s1
int
);
create
view
v1
as
select
s1
as
a
,
s1
as
b
from
t1
;
create
view
v1
as
select
s1
as
a
,
s1
as
b
from
t1
;
--
error
1471
--
error
ER_NON_INSERTABLE_TABLE
insert
into
v1
values
(
1
,
1
);
insert
into
v1
values
(
1
,
1
);
update
v1
set
a
=
5
;
update
v1
set
a
=
5
;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#21646: view qith a subquery in ON expression
# Bug
#21646 view qith a subquery in ON expression
#
#
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
);
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
);
...
@@ -2884,8 +2950,7 @@ DROP TABLE t1, t2;
...
@@ -2884,8 +2950,7 @@ DROP TABLE t1, t2;
#
#
# Bug#19111: TRIGGERs selecting from a VIEW on the firing base table
# Bug#19111 TRIGGERs selecting from a VIEW on the firing base table fail
# fail
#
#
# Allow to select from a view on a table being modified in a trigger
# Allow to select from a view on a table being modified in a trigger
# and stored function, since plain select is allowed there.
# and stored function, since plain select is allowed there.
...
@@ -2916,23 +2981,24 @@ DROP FUNCTION f1;
...
@@ -2916,23 +2981,24 @@ DROP FUNCTION f1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#16813 (WITH CHECK OPTION doesn't work with UPDATE)
# Bug#16813 (WITH CHECK OPTION doesn't work with UPDATE)
#
#
CREATE
TABLE
t1
(
id
INT
UNSIGNED
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
val
INT
UNSIGNED
NOT
NULL
);
CREATE
TABLE
t1
(
id
INT
UNSIGNED
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
,
val
INT
UNSIGNED
NOT
NULL
);
CREATE
VIEW
v1
AS
SELECT
id
,
val
FROM
t1
WHERE
val
>=
1
AND
val
<=
5
WITH
CHECK
OPTION
;
CREATE
VIEW
v1
AS
SELECT
id
,
val
FROM
t1
WHERE
val
>=
1
AND
val
<=
5
WITH
CHECK
OPTION
;
INSERT
INTO
v1
(
val
)
VALUES
(
2
);
INSERT
INTO
v1
(
val
)
VALUES
(
2
);
INSERT
INTO
v1
(
val
)
VALUES
(
4
);
INSERT
INTO
v1
(
val
)
VALUES
(
4
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
INSERT
INTO
v1
(
val
)
VALUES
(
6
);
INSERT
INTO
v1
(
val
)
VALUES
(
6
);
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
UPDATE
v1
SET
val
=
6
WHERE
id
=
2
;
UPDATE
v1
SET
val
=
6
WHERE
id
=
2
;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# B
UG#22584:
last_insert_id not updated after inserting a record
# B
ug#22584
last_insert_id not updated after inserting a record
# through a updatable view
# through a updatable view
#
#
# We still do not update LAST_INSERT_ID if AUTO_INCREMENT column is
# We still do not update LAST_INSERT_ID if AUTO_INCREMENT column is
...
@@ -2968,8 +3034,9 @@ SELECT * FROM t1;
...
@@ -2968,8 +3034,9 @@ SELECT * FROM t1;
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#25580:
!0 as an operand in a select expression of a view
# Bug
#25580
!0 as an operand in a select expression of a view
#
#
CREATE
VIEW
v
AS
SELECT
!
0
*
5
AS
x
FROM
DUAL
;
CREATE
VIEW
v
AS
SELECT
!
0
*
5
AS
x
FROM
DUAL
;
...
@@ -2980,8 +3047,9 @@ SELECT * FROM v;
...
@@ -2980,8 +3047,9 @@ SELECT * FROM v;
DROP
VIEW
v
;
DROP
VIEW
v
;
#
#
# B
UG#24293:
'\Z' token is not handled correctly in views
# B
ug#24293
'\Z' token is not handled correctly in views
#
#
--
disable_warnings
--
disable_warnings
...
@@ -2995,8 +3063,9 @@ SHOW CREATE VIEW v1;
...
@@ -2995,8 +3063,9 @@ SHOW CREATE VIEW v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
#
#
# Bug
#26124:
BETWEEN over a view column of the DATETIME type
# Bug
#26124
BETWEEN over a view column of the DATETIME type
#
#
CREATE
TABLE
t1
(
mydate
DATETIME
);
CREATE
TABLE
t1
(
mydate
DATETIME
);
...
@@ -3011,8 +3080,9 @@ SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
...
@@ -3011,8 +3080,9 @@ SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#25931:
update of a multi-table view with check option
# Bug
#25931
update of a multi-table view with check option
#
#
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t1
(
a
int
);
...
@@ -3024,7 +3094,7 @@ CREATE VIEW v1 AS
...
@@ -3024,7 +3094,7 @@ CREATE VIEW v1 AS
SELECT
t2
.
b
FROM
t1
,
t2
WHERE
t1
.
a
=
t2
.
b
WITH
CHECK
OPTION
;
SELECT
t2
.
b
FROM
t1
,
t2
WHERE
t1
.
a
=
t2
.
b
WITH
CHECK
OPTION
;
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
UPDATE
v1
SET
b
=
3
;
UPDATE
v1
SET
b
=
3
;
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
...
@@ -3033,8 +3103,9 @@ SELECT * FROM t2;
...
@@ -3033,8 +3103,9 @@ SELECT * FROM t2;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug#12122
:
Views with ORDER BY can't be resolved using MERGE algorithm.
# Bug#12122 Views with ORDER BY can't be resolved using MERGE algorithm.
#
#
create
table
t1
(
f1
int
,
f2
int
);
create
table
t1
(
f1
int
,
f2
int
);
insert
into
t1
values
(
1
,
2
),(
1
,
3
),(
1
,
1
),(
2
,
3
),(
2
,
1
),(
2
,
2
);
insert
into
t1
values
(
1
,
2
),(
1
,
3
),(
1
,
1
),(
2
,
3
),(
2
,
1
),(
2
,
2
);
...
@@ -3048,7 +3119,7 @@ drop view v1;
...
@@ -3048,7 +3119,7 @@ drop view v1;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug#26209
:
queries with GROUP BY and ORDER BY using views
# Bug#26209 queries with GROUP BY and ORDER BY using views
#
#
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
...
@@ -3067,9 +3138,9 @@ SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
...
@@ -3067,9 +3138,9 @@ SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# BUG#25897: Some queries are no longer possible after a CREATE VIEW
# Bug#25897 Some queries are no longer possible after a CREATE VIEW fails
# fails
#
#
--
disable_warnings
--
disable_warnings
DROP
VIEW
IF
EXISTS
v1
;
DROP
VIEW
IF
EXISTS
v1
;
...
@@ -3083,9 +3154,9 @@ eval CREATE VIEW v1 AS $query;
...
@@ -3083,9 +3154,9 @@ eval CREATE VIEW v1 AS $query;
--
echo
# Previously the following would fail.
--
echo
# Previously the following would fail.
eval
$query
;
eval
$query
;
#
#
# Bug#24532: The return data type of IS TRUE is different from similar
# Bug#24532 The return data type of IS TRUE is different from similar operations
# operations
#
#
--
disable_warnings
--
disable_warnings
...
@@ -3170,8 +3241,9 @@ drop view view_24532_a;
...
@@ -3170,8 +3241,9 @@ drop view view_24532_a;
drop
view
view_24532_b
;
drop
view
view_24532_b
;
drop
table
table_24532
;
drop
table
table_24532
;
#
#
# Bug#26560
: view using subquery with a reference to an outer alias
# Bug#26560
view using subquery with a reference to an outer alias
#
#
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
...
@@ -3210,8 +3282,9 @@ SELECT * FROM v1;
...
@@ -3210,8 +3282,9 @@ SELECT * FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
table
t1
,
t2
;
DROP
table
t1
,
t2
;
#
#
# Bug#27786
: Inconsistent Operation Performing UNION On View With ORDER BY
# Bug#27786
Inconsistent Operation Performing UNION On View With ORDER BY
#
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
);
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
);
CREATE
VIEW
v1
AS
SELECT
a
FROM
t1
ORDER
BY
a
;
CREATE
VIEW
v1
AS
SELECT
a
FROM
t1
ORDER
BY
a
;
...
@@ -3226,8 +3299,9 @@ EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
...
@@ -3226,8 +3299,9 @@ EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#27921 View ignores precision for CAST()
# Bug#27921 View ignores precision for CAST()
#
#
CREATE
VIEW
v1
AS
SELECT
CAST
(
1.23456789
AS
DECIMAL
(
7
,
5
)
)
AS
col
;
CREATE
VIEW
v1
AS
SELECT
CAST
(
1.23456789
AS
DECIMAL
(
7
,
5
)
)
AS
col
;
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
...
@@ -3238,8 +3312,9 @@ CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
...
@@ -3238,8 +3312,9 @@ CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
SHOW
CREATE
VIEW
v1
;
SHOW
CREATE
VIEW
v1
;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
#
#
# Bug
#28716:
CHECK OPTION expression is evaluated over expired record buffers
# Bug
#28716
CHECK OPTION expression is evaluated over expired record buffers
# when VIEW is updated via temporary tables
# when VIEW is updated via temporary tables
#
#
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t1
(
a
INT
);
...
@@ -3254,9 +3329,10 @@ SELECT * FROM v1;
...
@@ -3254,9 +3329,10 @@ SELECT * FROM v1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug
#28561: update on multi-table view with CHECK OPTION and
# Bug
#28561 update on multi-table view with CHECK OPTION and a subquery
#
a subquery
in WHERE condition
# in WHERE condition
#
#
CREATE
TABLE
t1
(
id
int
);
CREATE
TABLE
t1
(
id
int
);
...
@@ -3273,8 +3349,9 @@ UPDATE v1 SET c=1;
...
@@ -3273,8 +3349,9 @@ UPDATE v1 SET c=1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug
#27827:
CHECK OPTION ignores ON conditions when updating
# Bug
#27827
CHECK OPTION ignores ON conditions when updating
# a multi-table view with CHECK OPTION.
# a multi-table view with CHECK OPTION.
#
#
...
@@ -3291,14 +3368,14 @@ CREATE VIEW v1 AS
...
@@ -3291,14 +3368,14 @@ CREATE VIEW v1 AS
SELECT
t1
.
a1
,
t1
.
c
FROM
t1
JOIN
t2
ON
t1
.
a1
=
t2
.
a2
AND
t1
.
c
<
3
SELECT
t1
.
a1
,
t1
.
c
FROM
t1
JOIN
t2
ON
t1
.
a1
=
t2
.
a2
AND
t1
.
c
<
3
WITH
CHECK
OPTION
;
WITH
CHECK
OPTION
;
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
UPDATE
v1
SET
c
=
3
;
UPDATE
v1
SET
c
=
3
;
PREPARE
t
FROM
'UPDATE v1 SET c=3'
;
PREPARE
t
FROM
'UPDATE v1 SET c=3'
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
EXECUTE
t
;
EXECUTE
t
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
EXECUTE
t
;
EXECUTE
t
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
INSERT
INTO
v1
(
a1
,
c
)
VALUES
(
3
,
3
);
INSERT
INTO
v1
(
a1
,
c
)
VALUES
(
3
,
3
);
UPDATE
v1
SET
c
=
1
WHERE
a1
=
1
;
UPDATE
v1
SET
c
=
1
WHERE
a1
=
1
;
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
...
@@ -3309,14 +3386,14 @@ CREATE VIEW v2 AS SELECT t1.a1, t1.c
...
@@ -3309,14 +3386,14 @@ CREATE VIEW v2 AS SELECT t1.a1, t1.c
JOIN
(
t3
JOIN
t4
ON
t3
.
a3
=
t4
.
a4
)
JOIN
(
t3
JOIN
t4
ON
t3
.
a3
=
t4
.
a4
)
ON
t2
.
a2
=
t3
.
a3
WITH
CHECK
OPTION
;
ON
t2
.
a2
=
t3
.
a3
WITH
CHECK
OPTION
;
SELECT
*
FROM
v2
;
SELECT
*
FROM
v2
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
UPDATE
v2
SET
c
=
3
;
UPDATE
v2
SET
c
=
3
;
PREPARE
t
FROM
'UPDATE v2 SET c=3'
;
PREPARE
t
FROM
'UPDATE v2 SET c=3'
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
EXECUTE
t
;
EXECUTE
t
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
EXECUTE
t
;
EXECUTE
t
;
--
error
1369
--
error
ER_VIEW_CHECK_FAILED
INSERT
INTO
v2
(
a1
,
c
)
VALUES
(
3
,
3
);
INSERT
INTO
v2
(
a1
,
c
)
VALUES
(
3
,
3
);
UPDATE
v2
SET
c
=
2
WHERE
a1
=
1
;
UPDATE
v2
SET
c
=
2
WHERE
a1
=
1
;
SELECT
*
FROM
v2
;
SELECT
*
FROM
v2
;
...
@@ -3325,8 +3402,9 @@ SELECT * FROM t1;
...
@@ -3325,8 +3402,9 @@ SELECT * FROM t1;
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
#
# Bug
#29104:
assertion abort for a query with a view column reference
# Bug
#29104
assertion abort for a query with a view column reference
# in the GROUP BY list and a condition requiring the value
# in the GROUP BY list and a condition requiring the value
# of another view column to be equal to a constant
# of another view column to be equal to a constant
#
#
...
@@ -3349,8 +3427,9 @@ EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
...
@@ -3349,8 +3427,9 @@ EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug
#29392: SELECT over a multi-table view with ORDER BY
# Bug
#29392 SELECT over a multi-table view with ORDER BY
# selecting the same view column with two different aliases
# selecting the same view column with two different aliases
#
#
...
@@ -3403,8 +3482,9 @@ SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
...
@@ -3403,8 +3482,9 @@ SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
#
#
# Bug#30020
:
Insufficient check led to a wrong info provided by the
# Bug#30020 Insufficient check led to a wrong info provided by the
# information schema table.
# information schema table.
#
#
create
table
t1
(
i
int
);
create
table
t1
(
i
int
);
...
@@ -3416,8 +3496,9 @@ select table_name, is_updatable from information_schema.views
...
@@ -3416,8 +3496,9 @@ select table_name, is_updatable from information_schema.views
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#28701:
SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
# Bug
#28701
SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
# invalid statements
# invalid statements
#
#
...
@@ -3436,7 +3517,7 @@ DROP TABLE t1;
...
@@ -3436,7 +3517,7 @@ DROP TABLE t1;
#
#
# Bug
#28702:
VIEWs defined with USE/FORCE KEY ignore that request
# Bug
#28702
VIEWs defined with USE/FORCE KEY ignore that request
#
#
CREATE
TABLE
t1
(
a
INT
NOT
NULL
AUTO_INCREMENT
,
b
INT
NOT
NULL
DEFAULT
0
,
CREATE
TABLE
t1
(
a
INT
NOT
NULL
AUTO_INCREMENT
,
b
INT
NOT
NULL
DEFAULT
0
,
PRIMARY
KEY
(
a
),
KEY
(
b
));
PRIMARY
KEY
(
a
),
KEY
(
b
));
...
@@ -3456,8 +3537,9 @@ DROP VIEW v2;
...
@@ -3456,8 +3537,9 @@ DROP VIEW v2;
DROP
VIEW
v3
;
DROP
VIEW
v3
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
#
--
echo
# Bug#29477
:
Not all fields of the target table were checked to have
--
echo
# Bug#29477 Not all fields of the target table were checked to have
--
echo
# a default value when inserting into a view.
--
echo
# a default value when inserting into a view.
--
echo
#
--
echo
#
create
table
t1
(
f1
int
,
f2
int
not
null
);
create
table
t1
(
f1
int
,
f2
int
not
null
);
...
@@ -3471,8 +3553,9 @@ set @@sql_mode=@old_mode;
...
@@ -3471,8 +3553,9 @@ set @@sql_mode=@old_mode;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
;
drop
table
t1
;
#
#
# Bug
#33389: Selecting from a view into a table from within SP or trigger
# Bug
#33389 Selecting from a view into a table from within SP or trigger
# crashes server
# crashes server
#
#
...
@@ -3492,8 +3575,9 @@ execute stmt;
...
@@ -3492,8 +3575,9 @@ execute stmt;
drop
view
v1
,
v2
;
drop
view
v1
,
v2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
#
# Bug
#33049:
Assert while running test-as3ap test(mysql-bench suite)
# Bug
#33049
Assert while running test-as3ap test(mysql-bench suite)
#
#
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t1
(
a
INT
);
...
@@ -3508,7 +3592,7 @@ DROP TABLE t1;
...
@@ -3508,7 +3592,7 @@ DROP TABLE t1;
###########################################################################
###########################################################################
--
echo
# -----------------------------------------------------------------
--
echo
# -----------------------------------------------------------------
--
echo
# -- Bug#34337
:
Server crash when Altering a view using a table name.
--
echo
# -- Bug#34337 Server crash when Altering a view using a table name.
--
echo
# -----------------------------------------------------------------
--
echo
# -----------------------------------------------------------------
--
echo
--
echo
...
@@ -3538,7 +3622,7 @@ DROP TABLE t1;
...
@@ -3538,7 +3622,7 @@ DROP TABLE t1;
###########################################################################
###########################################################################
--
echo
# -----------------------------------------------------------------
--
echo
# -----------------------------------------------------------------
--
echo
# -- Bug#35193
:
VIEW query is rewritten without "FROM DUAL",
--
echo
# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
--
echo
# -- causing syntax error
--
echo
# -- causing syntax error
--
echo
# -----------------------------------------------------------------
--
echo
# -----------------------------------------------------------------
--
echo
--
echo
...
@@ -3561,15 +3645,16 @@ DROP VIEW v1;
...
@@ -3561,15 +3645,16 @@ DROP VIEW v1;
###########################################################################
###########################################################################
#
#
# Bug#39040
: valgrind errors/crash when creating views with binlog logging
# Bug#39040
valgrind errors/crash when creating views with binlog logging
# enabled
# enabled
#
#
# Bug is visible only when running in valgrind with binary logging.
# Bug is visible only when running in valgrind with binary logging.
CREATE
VIEW
v1
AS
SELECT
1
;
CREATE
VIEW
v1
AS
SELECT
1
;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
#
#
# Bug
#33461:
SELECT ... FROM <view> USE INDEX (...) throws an error
# Bug
#33461
SELECT ... FROM <view> USE INDEX (...) throws an error
#
#
CREATE
TABLE
t1
(
c1
INT
PRIMARY
KEY
,
c2
INT
,
INDEX
(
c2
));
CREATE
TABLE
t1
(
c1
INT
PRIMARY
KEY
,
c2
INT
,
INDEX
(
c2
));
...
...
mysql-test/t/view_grant.test
View file @
7c4e55cb
# Can't test with embedded server
# Can't test with embedded server
--
source
include
/
not_embedded
.
inc
--
source
include
/
not_embedded
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
# simple test of grants
# simple test of grants
grant
create
view
on
test
.*
to
test
@
localhost
;
grant
create
view
on
test
.*
to
test
@
localhost
;
show
grants
for
test
@
localhost
;
show
grants
for
test
@
localhost
;
...
@@ -26,19 +29,19 @@ grant create view,select on test.* to mysqltest_1@localhost;
...
@@ -26,19 +29,19 @@ grant create view,select on test.* to mysqltest_1@localhost;
connect
(
user1
,
localhost
,
mysqltest_1
,,
test
);
connect
(
user1
,
localhost
,
mysqltest_1
,,
test
);
connection
user1
;
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
definer
=
root
@
localhost
view
v1
as
select
*
from
mysqltest
.
t1
;
create
view
v1
as
select
*
from
mysqltest
.
t1
;
create
view
v1
as
select
*
from
mysqltest
.
t1
;
# try to modify view without DROP privilege on it
# try to modify view without DROP privilege on it
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
alter
view
v1
as
select
*
from
mysqltest
.
t1
;
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
;
create
or
replace
view
v1
as
select
*
from
mysqltest
.
t1
;
# no CRETE VIEW privilege
# no CRETE VIEW privilege
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
create
view
mysqltest
.
v2
as
select
*
from
mysqltest
.
t1
;
create
view
mysqltest
.
v2
as
select
*
from
mysqltest
.
t1
;
# no SELECT privilege
# no SELECT privilege
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
create
view
v2
as
select
*
from
mysqltest
.
t2
;
create
view
v2
as
select
*
from
mysqltest
.
t2
;
connection
root
;
connection
root
;
...
@@ -48,7 +51,7 @@ show create view v1;
...
@@ -48,7 +51,7 @@ show create view v1;
grant
create
view
,
drop
,
select
on
test
.*
to
mysqltest_1
@
localhost
;
grant
create
view
,
drop
,
select
on
test
.*
to
mysqltest_1
@
localhost
;
connection
user1
;
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
# when that bug will be fixed
use
test
;
use
test
;
alter
view
v1
as
select
*
from
mysqltest
.
t1
;
alter
view
v1
as
select
*
from
mysqltest
.
t1
;
...
@@ -76,7 +79,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
...
@@ -76,7 +79,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection
user1
;
connection
user1
;
select
c
from
mysqltest
.
v1
;
select
c
from
mysqltest
.
v1
;
# there are no privileges on column 'd'
# there are no privileges on column 'd'
--
error
1143
--
error
ER_COLUMNACCESS_DENIED_ERROR
select
d
from
mysqltest
.
v1
;
select
d
from
mysqltest
.
v1
;
connection
root
;
connection
root
;
...
@@ -96,7 +99,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
...
@@ -96,7 +99,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection
user1
;
connection
user1
;
select
c
from
mysqltest
.
v1
;
select
c
from
mysqltest
.
v1
;
# there are no privileges on column 'd'
# there are no privileges on column 'd'
--
error
1143
--
error
ER_COLUMNACCESS_DENIED_ERROR
select
d
from
mysqltest
.
v1
;
select
d
from
mysqltest
.
v1
;
connection
root
;
connection
root
;
...
@@ -111,7 +114,7 @@ connection root;
...
@@ -111,7 +114,7 @@ connection root;
--
disable_warnings
--
disable_warnings
create
database
mysqltest
;
create
database
mysqltest
;
--
enable_warnings
--
enable_warnings
#prepare views and tables
#
prepare views and tables
create
table
mysqltest
.
t1
(
a
int
,
b
int
);
create
table
mysqltest
.
t1
(
a
int
,
b
int
);
create
table
mysqltest
.
t2
(
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
;
create
view
mysqltest
.
v1
(
c
,
d
)
as
select
a
+
1
,
b
+
1
from
mysqltest
.
t1
;
...
@@ -133,21 +136,21 @@ select c from mysqltest.v4;
...
@@ -133,21 +136,21 @@ select c from mysqltest.v4;
show
columns
from
mysqltest
.
v1
;
show
columns
from
mysqltest
.
v1
;
show
columns
from
mysqltest
.
v2
;
show
columns
from
mysqltest
.
v2
;
# but explain/show do not
# but explain/show do not
--
error
1345
--
error
ER_VIEW_NO_EXPLAIN
explain
select
c
from
mysqltest
.
v1
;
explain
select
c
from
mysqltest
.
v1
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v1
;
show
create
view
mysqltest
.
v1
;
--
error
1345
--
error
ER_VIEW_NO_EXPLAIN
explain
select
c
from
mysqltest
.
v2
;
explain
select
c
from
mysqltest
.
v2
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v2
;
show
create
view
mysqltest
.
v2
;
--
error
1345
--
error
ER_VIEW_NO_EXPLAIN
explain
select
c
from
mysqltest
.
v3
;
explain
select
c
from
mysqltest
.
v3
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v3
;
show
create
view
mysqltest
.
v3
;
--
error
1345
--
error
ER_VIEW_NO_EXPLAIN
explain
select
c
from
mysqltest
.
v4
;
explain
select
c
from
mysqltest
.
v4
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v4
;
show
create
view
mysqltest
.
v4
;
# allow to see one of underlying table
# allow to see one of underlying table
...
@@ -156,19 +159,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
...
@@ -156,19 +159,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
connection
user1
;
connection
user1
;
# EXPLAIN of view on above table works
# EXPLAIN of view on above table works
explain
select
c
from
mysqltest
.
v1
;
explain
select
c
from
mysqltest
.
v1
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v1
;
show
create
view
mysqltest
.
v1
;
explain
select
c
from
mysqltest
.
v2
;
explain
select
c
from
mysqltest
.
v2
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v2
;
show
create
view
mysqltest
.
v2
;
# but other EXPLAINs do not
# but other EXPLAINs do not
--
error
1345
--
error
ER_VIEW_NO_EXPLAIN
explain
select
c
from
mysqltest
.
v3
;
explain
select
c
from
mysqltest
.
v3
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v3
;
show
create
view
mysqltest
.
v3
;
--
error
1345
--
error
ER_VIEW_NO_EXPLAIN
explain
select
c
from
mysqltest
.
v4
;
explain
select
c
from
mysqltest
.
v4
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
show
create
view
mysqltest
.
v4
;
show
create
view
mysqltest
.
v4
;
# allow to see any view in mysqltest database
# allow to see any view in mysqltest database
...
@@ -222,14 +225,14 @@ select * from t1;
...
@@ -222,14 +225,14 @@ select * from t1;
update
v2
set
a
=
a
+
c
;
update
v2
set
a
=
a
+
c
;
select
*
from
t1
;
select
*
from
t1
;
# no rights on column
# 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
;
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
;
update
v2
set
c
=
a
+
c
;
# no rights for view
# 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
;
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
;
update
v3
set
a
=
a
+
c
;
use
test
;
use
test
;
...
@@ -263,9 +266,9 @@ select * from t1;
...
@@ -263,9 +266,9 @@ select * from t1;
delete
v1
from
t2
,
v1
where
t2
.
x
=
v1
.
c
;
delete
v1
from
t2
,
v1
where
t2
.
x
=
v1
.
c
;
select
*
from
t1
;
select
*
from
t1
;
# no rights for view
# no rights for view
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
delete
v2
from
t2
,
v2
where
t2
.
x
=
v2
.
c
;
delete
v2
from
t2
,
v2
where
t2
.
x
=
v2
.
c
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
delete
from
v2
where
c
<
4
;
delete
from
v2
where
c
<
4
;
use
test
;
use
test
;
...
@@ -299,9 +302,9 @@ select * from t1;
...
@@ -299,9 +302,9 @@ select * from t1;
insert
into
v1
select
x
,
y
from
t2
;
insert
into
v1
select
x
,
y
from
t2
;
select
*
from
t1
;
select
*
from
t1
;
# no rights for view
# no rights for view
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
insert
into
v2
values
(
5
,
6
);
insert
into
v2
values
(
5
,
6
);
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
insert
into
v2
select
x
,
y
from
t2
;
insert
into
v2
select
x
,
y
from
t2
;
use
test
;
use
test
;
...
@@ -329,10 +332,10 @@ connection user1;
...
@@ -329,10 +332,10 @@ connection user1;
create
view
v1
as
select
*
from
mysqltest
.
t1
;
create
view
v1
as
select
*
from
mysqltest
.
t1
;
create
view
v2
as
select
b
from
mysqltest
.
t2
;
create
view
v2
as
select
b
from
mysqltest
.
t2
;
# There are not rights on mysqltest.v1
# There are not rights on mysqltest.v1
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
create
view
mysqltest
.
v1
as
select
*
from
mysqltest
.
t1
;
create
view
mysqltest
.
v1
as
select
*
from
mysqltest
.
t1
;
# There are not any rights on mysqltest.t2.a
# 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
;
create
view
v3
as
select
a
from
mysqltest
.
t2
;
# give CREATE VIEW privileges (without any privileges for result column)
# give CREATE VIEW privileges (without any privileges for result column)
...
@@ -352,13 +355,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
...
@@ -352,13 +355,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges
# Expression need select privileges
--
error
1143
--
error
ER_COLUMNACCESS_DENIED_ERROR
create
view
v4
as
select
b
+
1
from
mysqltest
.
t2
;
create
view
v4
as
select
b
+
1
from
mysqltest
.
t2
;
connection
root
;
connection
root
;
grant
create
view
,
update
,
select
on
test
.*
to
mysqltest_1
@
localhost
;
grant
create
view
,
update
,
select
on
test
.*
to
mysqltest_1
@
localhost
;
connection
user1
;
connection
user1
;
--
error
1143
--
error
ER_COLUMNACCESS_DENIED_ERROR
create
view
v4
as
select
b
+
1
from
mysqltest
.
t2
;
create
view
v4
as
select
b
+
1
from
mysqltest
.
t2
;
connection
root
;
connection
root
;
...
@@ -411,7 +414,7 @@ connection root;
...
@@ -411,7 +414,7 @@ connection root;
# check view definer information
# check view definer information
show
create
view
v1
;
show
create
view
v1
;
revoke
select
on
mysqltest
.
t1
from
mysqltest_1
@
localhost
;
revoke
select
on
mysqltest
.
t1
from
mysqltest_1
@
localhost
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v1
;
select
*
from
v1
;
grant
select
on
mysqltest
.
t1
to
mysqltest_1
@
localhost
;
grant
select
on
mysqltest
.
t1
to
mysqltest_1
@
localhost
;
select
*
from
v1
;
select
*
from
v1
;
...
@@ -420,7 +423,7 @@ drop view v1;
...
@@ -420,7 +423,7 @@ drop view v1;
drop
database
mysqltest
;
drop
database
mysqltest
;
#
#
# rights on execution of view underlying functiond (B
UG
#9505)
# rights on execution of view underlying functiond (B
ug
#9505)
#
#
connection
root
;
connection
root
;
--
disable_warnings
--
disable_warnings
...
@@ -453,11 +456,11 @@ connection user1;
...
@@ -453,11 +456,11 @@ connection user1;
use
mysqltest
;
use
mysqltest
;
select
*
from
v1
;
select
*
from
v1
;
select
*
from
v2
;
select
*
from
v2
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v3
;
select
*
from
v3
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v4
;
select
*
from
v4
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v5
;
select
*
from
v5
;
use
test
;
use
test
;
...
@@ -505,13 +508,13 @@ use test;
...
@@ -505,13 +508,13 @@ use test;
connection
root
;
connection
root
;
create
view
v5
as
select
*
from
v1
;
create
view
v5
as
select
*
from
v1
;
revoke
execute
on
function
f2
from
mysqltest_1
@
localhost
;
revoke
execute
on
function
f2
from
mysqltest_1
@
localhost
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v1
;
select
*
from
v1
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v2
;
select
*
from
v2
;
select
*
from
v3
;
select
*
from
v3
;
select
*
from
v4
;
select
*
from
v4
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v5
;
select
*
from
v5
;
drop
view
v1
,
v2
,
v3
,
v4
,
v5
;
drop
view
v1
,
v2
,
v3
,
v4
,
v5
;
...
@@ -549,13 +552,13 @@ use test;
...
@@ -549,13 +552,13 @@ use test;
connection
root
;
connection
root
;
revoke
select
on
t1
from
mysqltest_1
@
localhost
;
revoke
select
on
t1
from
mysqltest_1
@
localhost
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v1
;
select
*
from
v1
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v2
;
select
*
from
v2
;
select
*
from
v3
;
select
*
from
v3
;
select
*
from
v4
;
select
*
from
v4
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v5
;
select
*
from
v5
;
#drop view v1, v2, v3, v4, v5;
#drop view v1, v2, v3, v4, v5;
...
@@ -588,11 +591,11 @@ connection user1;
...
@@ -588,11 +591,11 @@ connection user1;
use
mysqltest
;
use
mysqltest
;
select
*
from
v1
;
select
*
from
v1
;
select
*
from
v2
;
select
*
from
v2
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v3
;
select
*
from
v3
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v4
;
select
*
from
v4
;
--
error
ER_VIEW_INVALID
--
error
ER_VIEW_INVALID
select
*
from
v5
;
select
*
from
v5
;
use
test
;
use
test
;
...
@@ -604,7 +607,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
...
@@ -604,7 +607,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop
database
mysqltest
;
drop
database
mysqltest
;
#
#
# B
UG#14256:
definer in view definition is not fully qualified
# B
ug#14256
definer in view definition is not fully qualified
#
#
--
disable_warnings
--
disable_warnings
drop
view
if
exists
v1
;
drop
view
if
exists
v1
;
...
@@ -641,6 +644,7 @@ drop view v1;
...
@@ -641,6 +644,7 @@ drop view v1;
select
@
v1def1
,
@
v1def2
,
@
v1def1
=@
v1def2
;
select
@
v1def1
,
@
v1def2
,
@
v1def1
=@
v1def2
;
connection
root
;
connection
root
;
disconnect
test14256
;
drop
user
test14256
;
drop
user
test14256
;
# Restore the anonymous users.
# Restore the anonymous users.
...
@@ -650,8 +654,8 @@ flush privileges;
...
@@ -650,8 +654,8 @@ flush privileges;
drop
table
t1
;
drop
table
t1
;
#
#
# B
UG#14726: freeing stack variable in case of an error of opening
# B
ug#14726 freeing stack variable in case of an error of opening a view when
#
a view when
we have locked tables with LOCK TABLES statement.
#
we have locked tables with LOCK TABLES statement.
#
#
connection
root
;
connection
root
;
--
disable_warnings
--
disable_warnings
...
@@ -668,7 +672,7 @@ connection user1;
...
@@ -668,7 +672,7 @@ connection user1;
use
mysqltest
;
use
mysqltest
;
LOCK
TABLES
v1
READ
;
LOCK
TABLES
v1
READ
;
--
error
ER_TABLEACCESS_DENIED_ERROR
--
error
ER_TABLEACCESS_DENIED_ERROR
SHOW
CREATE
TABLE
v1
;
SHOW
CREATE
TABLE
v1
;
UNLOCK
TABLES
;
UNLOCK
TABLES
;
use
test
;
use
test
;
...
@@ -679,7 +683,7 @@ drop user mysqltest_1@localhost;
...
@@ -679,7 +683,7 @@ drop user mysqltest_1@localhost;
drop
database
mysqltest
;
drop
database
mysqltest
;
#
#
# switch to default conn
a
ction
# switch to default conn
e
ction
#
#
disconnect
user1
;
disconnect
user1
;
disconnect
root
;
disconnect
root
;
...
@@ -696,7 +700,7 @@ drop view v1;
...
@@ -696,7 +700,7 @@ drop view v1;
drop
view
v2
;
drop
view
v2
;
#
#
# Bug#18681
:
View privileges are broken
# Bug#18681 View privileges are broken
#
#
CREATE
DATABASE
mysqltest1
;
CREATE
DATABASE
mysqltest1
;
CREATE
USER
readonly
@
localhost
;
CREATE
USER
readonly
@
localhost
;
...
@@ -717,54 +721,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO 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
ON
mysqltest1
.
v_td
TO
readonly
@
localhost
;
GRANT
DELETE
,
SELECT
ON
mysqltest1
.
v_tds
TO
readonly
@
localhost
;
GRANT
DELETE
,
SELECT
ON
mysqltest1
.
v_tds
TO
readonly
@
localhost
;
CONNECT
(
n1
,
localhost
,
readonly
,,);
connect
(
n1
,
localhost
,
readonly
,,);
CONNECTION
n1
;
connection
n1
;
--
error
1356
--
error
ER_VIEW_INVALID
SELECT
*
FROM
mysqltest1
.
v_t1
;
SELECT
*
FROM
mysqltest1
.
v_t1
;
--
error
1356
--
error
ER_VIEW_INVALID
INSERT
INTO
mysqltest1
.
v_t1
VALUES
(
4
);
INSERT
INTO
mysqltest1
.
v_t1
VALUES
(
4
);
--
error
1356
--
error
ER_VIEW_INVALID
DELETE
FROM
mysqltest1
.
v_t1
WHERE
x
=
1
;
DELETE
FROM
mysqltest1
.
v_t1
WHERE
x
=
1
;
--
error
1356
--
error
ER_VIEW_INVALID
UPDATE
mysqltest1
.
v_t1
SET
x
=
3
WHERE
x
=
2
;
UPDATE
mysqltest1
.
v_t1
SET
x
=
3
WHERE
x
=
2
;
--
error
1356
--
error
ER_VIEW_INVALID
UPDATE
mysqltest1
.
v_t1
SET
x
=
3
;
UPDATE
mysqltest1
.
v_t1
SET
x
=
3
;
--
error
1356
--
error
ER_VIEW_INVALID
DELETE
FROM
mysqltest1
.
v_t1
;
DELETE
FROM
mysqltest1
.
v_t1
;
--
error
1356
--
error
ER_VIEW_INVALID
SELECT
1
FROM
mysqltest1
.
v_t1
;
SELECT
1
FROM
mysqltest1
.
v_t1
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
SELECT
*
FROM
mysqltest1
.
t1
;
SELECT
*
FROM
mysqltest1
.
t1
;
SELECT
*
FROM
mysqltest1
.
v_ts
;
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
;
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
;
SELECT
*
FROM
mysqltest1
.
v_ti
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
INSERT
INTO
mysqltest1
.
v_ts
VALUES
(
100
);
INSERT
INTO
mysqltest1
.
v_ts
VALUES
(
100
);
INSERT
INTO
mysqltest1
.
v_ti
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
;
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_ts
SET
x
=
200
;
UPDATE
mysqltest1
.
v_tu
SET
x
=
200
WHERE
x
=
100
;
UPDATE
mysqltest1
.
v_tu
SET
x
=
200
WHERE
x
=
100
;
UPDATE
mysqltest1
.
v_tus
SET
x
=
200
WHERE
x
=
100
;
UPDATE
mysqltest1
.
v_tus
SET
x
=
200
WHERE
x
=
100
;
UPDATE
mysqltest1
.
v_tu
SET
x
=
200
;
UPDATE
mysqltest1
.
v_tu
SET
x
=
200
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
DELETE
FROM
mysqltest1
.
v_ts
WHERE
x
=
200
;
DELETE
FROM
mysqltest1
.
v_ts
WHERE
x
=
200
;
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
DELETE
FROM
mysqltest1
.
v_ts
;
DELETE
FROM
mysqltest1
.
v_ts
;
--
error
1143
--
error
ER_COLUMNACCESS_DENIED_ERROR
DELETE
FROM
mysqltest1
.
v_td
WHERE
x
=
200
;
DELETE
FROM
mysqltest1
.
v_td
WHERE
x
=
200
;
DELETE
FROM
mysqltest1
.
v_tds
WHERE
x
=
200
;
DELETE
FROM
mysqltest1
.
v_tds
WHERE
x
=
200
;
DELETE
FROM
mysqltest1
.
v_td
;
DELETE
FROM
mysqltest1
.
v_td
;
CONNECTION
default
;
connection
default
;
disconnect
n1
;
DROP
VIEW
mysqltest1
.
v_tds
;
DROP
VIEW
mysqltest1
.
v_tds
;
DROP
VIEW
mysqltest1
.
v_td
;
DROP
VIEW
mysqltest1
.
v_td
;
DROP
VIEW
mysqltest1
.
v_tus
;
DROP
VIEW
mysqltest1
.
v_tus
;
...
@@ -777,21 +782,21 @@ DROP USER readonly@localhost;
...
@@ -777,21 +782,21 @@ DROP USER readonly@localhost;
DROP
DATABASE
mysqltest1
;
DROP
DATABASE
mysqltest1
;
#
#
# B
UG#14875:
Bad view DEFINER makes SHOW CREATE VIEW fail
# B
ug#14875
Bad view DEFINER makes SHOW CREATE VIEW fail
#
#
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
);
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
);
CREATE
DEFINER
=
'no-such-user'
@
localhost
VIEW
v
AS
SELECT
a
from
t1
;
CREATE
DEFINER
=
'no-such-user'
@
localhost
VIEW
v
AS
SELECT
a
from
t1
;
#--warning
1448
#--warning
ER_VIEW_OTHER_USER
SHOW
CREATE
VIEW
v
;
SHOW
CREATE
VIEW
v
;
--
error
1449
--
error
ER_NO_SUCH_USER
SELECT
*
FROM
v
;
SELECT
*
FROM
v
;
DROP
VIEW
v
;
DROP
VIEW
v
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
USE
test
;
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
CREATE
USER
mysqltest_db1
@
localhost
identified
by
'PWD'
;
eval
GRANT
ALL
ON
mysqltest_db1
.*
TO
mysqltest_db1
@
localhost
WITH
GRANT
OPTION
;
eval
GRANT
ALL
ON
mysqltest_db1
.*
TO
mysqltest_db1
@
localhost
WITH
GRANT
OPTION
;
...
@@ -822,6 +827,7 @@ SELECT * FROM view2;
...
@@ -822,6 +827,7 @@ SELECT * FROM view2;
SELECT
*
from
view3
;
SELECT
*
from
view3
;
connection
default
;
connection
default
;
disconnect
session1
;
DROP
VIEW
mysqltest_db1
.
view3
;
DROP
VIEW
mysqltest_db1
.
view3
;
DROP
VIEW
mysqltest_db1
.
view2
;
DROP
VIEW
mysqltest_db1
.
view2
;
DROP
VIEW
mysqltest_db1
.
view1
;
DROP
VIEW
mysqltest_db1
.
view1
;
...
@@ -829,7 +835,7 @@ DROP TABLE mysqltest_db1.t1;
...
@@ -829,7 +835,7 @@ DROP TABLE mysqltest_db1.t1;
DROP
SCHEMA
mysqltest_db1
;
DROP
SCHEMA
mysqltest_db1
;
DROP
USER
mysqltest_db1
@
localhost
;
DROP
USER
mysqltest_db1
@
localhost
;
#
#
# B
UG#20482: failure on Create join view with sources views/tables
# B
ug#20482 failure on Create join view with sources views/tables
# in different schemas
# in different schemas
#
#
--
disable_warnings
--
disable_warnings
...
@@ -851,8 +857,8 @@ DROP DATABASE test1;
...
@@ -851,8 +857,8 @@ DROP DATABASE test1;
#
#
# B
UG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER
# B
ug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
#
returns
invoker name
#
invoker name
#
#
--
disable_warnings
--
disable_warnings
DROP
VIEW
IF
EXISTS
v1
;
DROP
VIEW
IF
EXISTS
v1
;
...
@@ -911,7 +917,7 @@ DROP USER mysqltest_u1@localhost;
...
@@ -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
,,);
connect
(
root
,
localhost
,
root
,,);
connection
root
;
connection
root
;
...
@@ -935,12 +941,12 @@ DROP USER def_17254@localhost;
...
@@ -935,12 +941,12 @@ DROP USER def_17254@localhost;
connect
(
inv
,
localhost
,
inv_17254
,,
db17254
);
connect
(
inv
,
localhost
,
inv_17254
,,
db17254
);
connection
inv
;
connection
inv
;
--
echo
for
a
user
--
echo
for
a
user
--
error
1142
--
error
ER_TABLEACCESS_DENIED_ERROR
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
connection
root
;
connection
root
;
--
echo
for
a
superuser
--
echo
for
a
superuser
--
error
1449
--
error
ER_NO_SUCH_USER
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
DROP
USER
inv_17254
@
localhost
;
DROP
USER
inv_17254
@
localhost
;
DROP
DATABASE
db17254
;
DROP
DATABASE
db17254
;
...
@@ -949,7 +955,7 @@ disconnect inv;
...
@@ -949,7 +955,7 @@ disconnect inv;
#
#
# B
UG#24404:
strange bug with view+permission+prepared statement
# B
ug#24404
strange bug with view+permission+prepared statement
#
#
--
disable_warnings
--
disable_warnings
DROP
DATABASE
IF
EXISTS
mysqltest_db1
;
DROP
DATABASE
IF
EXISTS
mysqltest_db1
;
...
@@ -1017,7 +1023,7 @@ DROP USER mysqltest_u1@localhost;
...
@@ -1017,7 +1023,7 @@ DROP USER mysqltest_u1@localhost;
DROP
USER
mysqltest_u2
@
localhost
;
DROP
USER
mysqltest_u2
@
localhost
;
#
#
# Bug#26813
:
The SUPER privilege is wrongly required to alter a view created
# Bug#26813 The SUPER privilege is wrongly required to alter a view created
# by another user.
# by another user.
#
#
connection
root
;
connection
root
;
...
@@ -1050,7 +1056,7 @@ DROP DATABASE db26813;
...
@@ -1050,7 +1056,7 @@ DROP DATABASE db26813;
disconnect
u1
;
disconnect
u1
;
--
echo
#
--
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
#
--
echo
#
connection
root
;
connection
root
;
CREATE
DATABASE
mysqltest_29908
;
CREATE
DATABASE
mysqltest_29908
;
...
@@ -1095,7 +1101,7 @@ disconnect u2;
...
@@ -1095,7 +1101,7 @@ disconnect u2;
--
echo
#######################################################################
--
echo
#######################################################################
#
#
# B
UG#24040:
Create View don't succed with "all privileges" on a database.
# B
ug#24040
Create View don't succed with "all privileges" on a database.
#
#
# Prepare.
# Prepare.
...
@@ -1179,7 +1185,7 @@ SELECT * FROM mysqltest1.t4;
...
@@ -1179,7 +1185,7 @@ SELECT * FROM mysqltest1.t4;
# Cleanup.
# Cleanup.
--
disconnect
bug24040_con
disconnect
bug24040_con
;
DROP
DATABASE
mysqltest1
;
DROP
DATABASE
mysqltest1
;
DROP
DATABASE
mysqltest2
;
DROP
DATABASE
mysqltest2
;
...
@@ -1187,7 +1193,7 @@ DROP USER mysqltest_u1@localhost;
...
@@ -1187,7 +1193,7 @@ DROP USER mysqltest_u1@localhost;
#
#
# Bug
#41354: Access control is bypassed when all columns of a view are
# Bug
#41354 Access control is bypassed when all columns of a view are
# selected by * wildcard
# selected by * wildcard
CREATE
DATABASE
db1
;
CREATE
DATABASE
db1
;
...
@@ -1202,7 +1208,6 @@ connect (addconfoo, localhost, foo,,);
...
@@ -1202,7 +1208,6 @@ connect (addconfoo, localhost, foo,,);
connection
addconfoo
;
connection
addconfoo
;
USE
db1
;
USE
db1
;
SELECT
f1
FROM
t1
;
SELECT
f1
FROM
t1
;
--
error
ER_COLUMNACCESS_DENIED_ERROR
--
error
ER_COLUMNACCESS_DENIED_ERROR
SELECT
f2
FROM
t1
;
SELECT
f2
FROM
t1
;
...
@@ -1216,8 +1221,9 @@ SELECT f2 FROM v1;
...
@@ -1216,8 +1221,9 @@ SELECT f2 FROM v1;
SELECT
*
FROM
v1
;
SELECT
*
FROM
v1
;
connection
default
;
connection
default
;
USE
tes
t
;
disconnect
roo
t
;
disconnect
addconfoo
;
disconnect
addconfoo
;
USE
test
;
REVOKE
SELECT
(
f1
)
ON
db1
.
t1
FROM
foo
;
REVOKE
SELECT
(
f1
)
ON
db1
.
t1
FROM
foo
;
REVOKE
SELECT
(
f1
)
ON
db1
.
v1
FROM
foo
;
REVOKE
SELECT
(
f1
)
ON
db1
.
v1
FROM
foo
;
DROP
USER
foo
;
DROP
USER
foo
;
...
@@ -1225,4 +1231,8 @@ DROP VIEW db1.v1;
...
@@ -1225,4 +1231,8 @@ DROP VIEW db1.v1;
DROP
TABLE
db1
.
t1
;
DROP
TABLE
db1
.
t1
;
DROP
DATABASE
db1
;
DROP
DATABASE
db1
;
connection
default
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
# Wait till we reached the initial number of concurrent sessions
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/t/wait_timeout.test
View file @
7c4e55cb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
--
source
include
/
not_embedded
.
inc
--
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`)
...
@@ -87,6 +87,7 @@ while (!`select @aborted_clients`)
}
}
}
}
--
enable_query_log
--
enable_query_log
disconnect
wait_con
;
connection
con1
;
connection
con1
;
# When the connection is closed in this way, the error code should
# When the connection is closed in this way, the error code should
...
@@ -97,3 +98,5 @@ select 2;
...
@@ -97,3 +98,5 @@ select 2;
--
enable_reconnect
--
enable_reconnect
select
3
;
select
3
;
disconnect
con1
;
disconnect
con1
;
# The last connect is to keep tools checking the current test happy.
connect
(
default
,
localhost
,
root
,,
test
,,);
mysql-test/t/xa.test
View file @
7c4e55cb
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
# WL#1756
# WL#1756
#
#
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
# Save the initial number of concurrent sessions
--
source
include
/
count_sessions
.
inc
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
enable_warnings
...
@@ -14,10 +18,10 @@ xa rollback 'test1';
...
@@ -14,10 +18,10 @@ xa rollback 'test1';
select
*
from
t1
;
select
*
from
t1
;
xa
start
'test2'
;
xa
start
'test2'
;
--
error
1399
--
error
ER_XAER_RMFAIL
xa
start
'test-bad'
;
xa
start
'test-bad'
;
insert
t1
values
(
20
);
insert
t1
values
(
20
);
--
error
1399
--
error
ER_XAER_RMFAIL
xa
prepare
'test2'
;
xa
prepare
'test2'
;
xa
end
'test2'
;
xa
end
'test2'
;
xa
prepare
'test2'
;
xa
prepare
'test2'
;
...
@@ -27,22 +31,22 @@ select * from t1;
...
@@ -27,22 +31,22 @@ select * from t1;
xa
start
'testa'
,
'testb'
;
xa
start
'testa'
,
'testb'
;
insert
t1
values
(
30
);
insert
t1
values
(
30
);
--
error
1399
--
error
ER_XAER_RMFAIL
commit
;
commit
;
xa
end
'testa'
,
'testb'
;
xa
end
'testa'
,
'testb'
;
--
error
1399
--
error
ER_XAER_RMFAIL
begin
;
begin
;
--
error
1399
--
error
ER_XAER_RMFAIL
create
table
t2
(
a
int
);
create
table
t2
(
a
int
);
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
connection
con1
;
connection
con1
;
--
error
1440
--
error
ER_XAER_DUPID
xa
start
'testa'
,
'testb'
;
xa
start
'testa'
,
'testb'
;
--
error
1440
--
error
ER_XAER_DUPID
xa
start
'testa'
,
'testb'
,
123
;
xa
start
'testa'
,
'testb'
,
123
;
# gtrid [ , bqual [ , formatID ] ]
# gtrid [ , bqual [ , formatID ] ]
...
@@ -51,7 +55,7 @@ insert t1 values (40);
...
@@ -51,7 +55,7 @@ insert t1 values (40);
xa
end
'testb'
,
' 0@P`'
,
11
;
xa
end
'testb'
,
' 0@P`'
,
11
;
xa
prepare
'testb'
,
0x2030405060
,
11
;
xa
prepare
'testb'
,
0x2030405060
,
11
;
--
error
1399
--
error
ER_XAER_RMFAIL
start
transaction
;
start
transaction
;
xa
recover
;
xa
recover
;
...
@@ -64,11 +68,11 @@ xa prepare 'testa','testb';
...
@@ -64,11 +68,11 @@ xa prepare 'testa','testb';
xa
recover
;
xa
recover
;
--
error
1397
--
error
ER_XAER_NOTA
xa
commit
'testb'
,
0x2030405060
,
11
;
xa
commit
'testb'
,
0x2030405060
,
11
;
xa
rollback
'testa'
,
'testb'
;
xa
rollback
'testa'
,
'testb'
;
--
error
1064
--
error
ER_PARSE_ERROR
xa
start
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
;
xa
start
'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
;
select
*
from
t1
;
select
*
from
t1
;
...
@@ -119,3 +123,7 @@ xa start 'a','c';
...
@@ -119,3 +123,7 @@ xa start 'a','c';
drop
table
t1
;
drop
table
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment