mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge embedded-server testing changes.
mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/ps_1general.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/type_blob.result: Auto merged mysql-test/r/type_float.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged mysql-test/t/grant2.test: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/select.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/type_float.test: Auto merged mysql-test/t/user_var.test: Auto merged mysql-test/t/variables.test: Auto merged sql/sql_select.cc: Auto merged mysql-test/mysql-test-run.sh: Merge changes mysql-test/t/ps_1general.test: Merge changes
This commit is contained in:
@ -41,6 +41,7 @@ PRIMARY KEY (GROUP_ID,LANG_ID),
|
||||
KEY NAME (NAME));
|
||||
#show table status like "t1";
|
||||
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
|
||||
--replace_column 8 #
|
||||
SHOW FULL COLUMNS FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
@ -107,25 +108,6 @@ select * from mysqltest.t1;
|
||||
drop table t1;
|
||||
drop database mysqltest;
|
||||
|
||||
#
|
||||
# Rights for renaming test (Bug #3270)
|
||||
#
|
||||
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection root;
|
||||
--disable_warnings
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
create table mysqltest.t1 (a int,b int,c int);
|
||||
grant all on mysqltest.t1 to mysqltest_1@localhost;
|
||||
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user1;
|
||||
-- error 1142
|
||||
alter table t1 rename t2;
|
||||
connection root;
|
||||
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
|
||||
delete from mysql.user where user=_binary'mysqltest_1';
|
||||
drop database mysqltest;
|
||||
|
||||
#
|
||||
# ALTER TABLE ... ENABLE/DISABLE KEYS
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
# connection in a separate thread.
|
||||
#
|
||||
|
||||
#-- source include/not_embedded.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_bdb.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
@ -3,6 +3,9 @@
|
||||
# Unfortunately the check is incomplete as we can't handle errors on connect
|
||||
# Also we can't connect without database
|
||||
|
||||
# This test makes no sense with the embedded server
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#connect (con1,localhost,root,,"");
|
||||
#show tables;
|
||||
connect (con1,localhost,root,,mysql);
|
||||
|
@ -328,23 +328,6 @@ set @str2 = convert(@str1 using ucs2);
|
||||
prepare stmt1 from @str2;
|
||||
execute stmt1 using @ivar;
|
||||
|
||||
#
|
||||
# Check correct binlogging of UCS2 user variables (BUG#3875)
|
||||
#
|
||||
SET TIMESTAMP=10000;
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 79;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t2;
|
||||
|
||||
|
||||
#
|
||||
# Check that ucs2 works with ENUM and SET type
|
||||
#
|
||||
|
19
mysql-test/t/ctype_ucs_binlog.test
Normal file
19
mysql-test/t/ctype_ucs_binlog.test
Normal file
@ -0,0 +1,19 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Check correct binlogging of UCS2 user variables (BUG#3875)
|
||||
#
|
||||
SET TIMESTAMP=10000;
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 79;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t2;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Embedded server doesn't support binlog
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
connection con1;
|
||||
|
@ -3,6 +3,10 @@
|
||||
# We verify that we did not introduce a deadlock.
|
||||
# This is intended to mimick how mysqldump and innobackup work.
|
||||
|
||||
# This test doesn't work with the embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# And it requires InnoDB
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
@ -1,5 +1,8 @@
|
||||
# Test of GRANT commands
|
||||
|
||||
# Grant tests not performed with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# Cleanup
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
@ -369,3 +372,23 @@ delete from mysql.columns_priv where user="mysqltest_3";
|
||||
flush privileges;
|
||||
drop database mysqltest_1;
|
||||
drop database mysqltest_2;
|
||||
|
||||
#
|
||||
# Rights for renaming test (Bug #3270)
|
||||
#
|
||||
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection root;
|
||||
--disable_warnings
|
||||
create database mysqltest;
|
||||
--enable_warnings
|
||||
create table mysqltest.t1 (a int,b int,c int);
|
||||
grant all on mysqltest.t1 to mysqltest_1@localhost;
|
||||
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user1;
|
||||
-- error 1142
|
||||
alter table t1 rename t2;
|
||||
connection root;
|
||||
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
|
||||
delete from mysql.user where user=_binary'mysqltest_1';
|
||||
drop database mysqltest;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Grant tests not performed with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
SET NAMES binary;
|
||||
|
||||
#
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Grant tests not performed with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_query_cache.inc
|
||||
|
||||
#
|
||||
|
@ -1,4 +1,6 @@
|
||||
-- source include/have_innodb.inc
|
||||
# Can't test this with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
|
@ -1,4 +1,6 @@
|
||||
-- source include/have_innodb.inc
|
||||
# Can't test this with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Check and select innodb lock type
|
||||
|
17
mysql-test/t/innodb-replace.test
Normal file
17
mysql-test/t/innodb-replace.test
Normal file
@ -0,0 +1,17 @@
|
||||
-- source include/have_innodb.inc
|
||||
# embedded server ignores 'delayed', so skip this
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Bug #1078
|
||||
#
|
||||
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
|
||||
select * from t1;
|
||||
--error 1031
|
||||
replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
|
||||
select * from t1;
|
||||
--error 1031
|
||||
replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -1021,19 +1021,6 @@ SELECT t2.id, t1.label FROM t2 INNER JOIN
|
||||
ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #1078
|
||||
#
|
||||
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
|
||||
select * from t1;
|
||||
--error 1031
|
||||
replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
|
||||
select * from t1;
|
||||
--error 1031
|
||||
replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
|
||||
create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
|
||||
create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
|
||||
@ -1110,7 +1097,7 @@ show create table t2;
|
||||
drop table t2;
|
||||
|
||||
# Test error handling
|
||||
--replace_result \\ /
|
||||
--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ /
|
||||
--error 1005
|
||||
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
|
||||
|
||||
|
34
mysql-test/t/insert_select-binlog.test
Normal file
34
mysql-test/t/insert_select-binlog.test
Normal file
@ -0,0 +1,34 @@
|
||||
# Embedded server doesn't support binlog
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# Check if a partly-completed INSERT SELECT in a MyISAM table goes into the
|
||||
# binlog
|
||||
|
||||
create table t1(a int, unique(a));
|
||||
insert into t1 values(2);
|
||||
create table t2(a int);
|
||||
insert into t2 values(1),(2);
|
||||
reset master;
|
||||
--error 1062
|
||||
insert into t1 select * from t2;
|
||||
# The above should produce an error, but still be in the binlog;
|
||||
# verify the binlog :
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
select * from t1;
|
||||
drop table t1, t2;
|
||||
|
||||
# Verify that a partly-completed CREATE TABLE .. SELECT does not
|
||||
# get into the binlog (Bug #6682)
|
||||
create table t1(a int);
|
||||
insert into t1 values(1),(1);
|
||||
reset master;
|
||||
--error 1062
|
||||
create table t2(unique(a)) select a from t1;
|
||||
# The above should produce an error, *and* not appear in the binlog
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
drop table t1;
|
||||
|
@ -71,37 +71,6 @@ WHERE numeropost=9 ORDER BY numreponse ASC;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
# Check if a partly-completed INSERT SELECT in a MyISAM table goes
|
||||
# into the binlog
|
||||
|
||||
create table t1(a int, unique(a));
|
||||
insert into t1 values(2);
|
||||
create table t2(a int);
|
||||
insert into t2 values(1),(2);
|
||||
reset master;
|
||||
--error 1062
|
||||
insert into t1 select * from t2;
|
||||
# The above should produce an error, but still be in the binlog;
|
||||
# verify the binlog :
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
select * from t1;
|
||||
drop table t1, t2;
|
||||
|
||||
# Verify that a partly-completed CREATE TABLE .. SELECT does not
|
||||
# get into the binlog (Bug #6682)
|
||||
create table t1(a int);
|
||||
insert into t1 values(1),(1);
|
||||
reset master;
|
||||
--error 1062
|
||||
create table t2(unique(a)) select a from t1;
|
||||
# The above should produce an error, *and* not appear in the binlog
|
||||
let $VERSION=`select version()`;
|
||||
--replace_result $VERSION VERSION
|
||||
show binlog events;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of insert ... select from same table
|
||||
#
|
||||
|
@ -5,6 +5,9 @@
|
||||
# did some tests manually on a slave; tables are replicated fine and
|
||||
# Exec_Master_Log_Pos advances as expected.
|
||||
|
||||
# Embedded server doesn't support binlogging
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# test for Bug #4998 "--protocol doesn't reject bad values"
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
# We are using .opt file since we need small binlog size
|
||||
|
||||
# Embedded server doesn't support binlogging
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# we need this for getting fixed timestamps inside of this test
|
||||
set timestamp=1000000000;
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Test for the new options --start-datetime, stop-datetime,
|
||||
# and a few others.
|
||||
|
||||
# Embedded server doesn't support binlogging
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, `"t"1`;
|
||||
--enable_warnings
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Check protocol handling
|
||||
|
@ -317,9 +317,6 @@ prepare stmt4 from ' show engine bdb logs ';
|
||||
--disable_result_log
|
||||
execute stmt4;
|
||||
--enable_result_log
|
||||
prepare stmt4 from ' show full processlist ';
|
||||
--replace_column 1 number 6 time 3 localhost
|
||||
execute stmt4;
|
||||
prepare stmt4 from ' show grants for user ';
|
||||
--error 1295
|
||||
prepare stmt4 from ' show create table t2 ';
|
||||
@ -600,7 +597,8 @@ drop table t2;
|
||||
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
|
||||
create table t5 (a int) ;
|
||||
# rename must fail, t7 does not exist
|
||||
--replace_result \\ /
|
||||
# Clean up the filename here because embedded server reports whole path
|
||||
--replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ /
|
||||
--error 1017
|
||||
execute stmt1 ;
|
||||
create table t7 (a int) ;
|
||||
@ -843,117 +841,6 @@ execute stmt1 ;
|
||||
|
||||
drop table t5 ;
|
||||
|
||||
|
||||
################ GRANT/REVOKE/DROP affecting a parallel session ################
|
||||
--disable_query_log
|
||||
select '------ grant/revoke/drop affects a parallel session test ------'
|
||||
as test_sequence ;
|
||||
--enable_query_log
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# Here we test that:
|
||||
# 1. A new GRANT will be visible within another sessions. #
|
||||
# #
|
||||
# Let's assume there is a parallel session with an already prepared #
|
||||
# statement for a table. #
|
||||
# A DROP TABLE will affect the EXECUTE properties. #
|
||||
# A REVOKE will affect the EXECUTE properties. #
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
# Who am I ?
|
||||
# this is different across different systems:
|
||||
# select current_user(), user() ;
|
||||
|
||||
#### create a new user account ####
|
||||
## There should be no grants for that non existing user
|
||||
--error 1141
|
||||
show grants for second_user@localhost ;
|
||||
## create a new user account by using GRANT statements on t9
|
||||
create database mysqltest;
|
||||
# create the tables (t1 and t9) used in many tests
|
||||
use mysqltest;
|
||||
--disable_query_log
|
||||
--source include/ps_create.inc
|
||||
--source include/ps_renew.inc
|
||||
--enable_query_log
|
||||
eval use $DB;
|
||||
grant usage on mysqltest.* to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
grant select on mysqltest.t9 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
#### establish a second session to the new user account
|
||||
connect (con3,localhost,second_user,looser,mysqltest);
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
# Who am I ?
|
||||
select current_user();
|
||||
## check the access rights
|
||||
show grants for current_user();
|
||||
prepare s_t9 from 'select c1 as my_col
|
||||
from t9 where c1= 1' ;
|
||||
execute s_t9 ;
|
||||
# check that we cannot do a SELECT on the table t1;
|
||||
--error 1142
|
||||
select a as my_col from t1;
|
||||
|
||||
|
||||
#### give access rights to t1 and drop table t9
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
grant select on mysqltest.t1 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
drop table mysqltest.t9 ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
#### check the access as new user
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
######## Question 1: The table t1 should be now accessible. ########
|
||||
show grants for second_user@localhost ;
|
||||
prepare s_t1 from 'select a as my_col from t1' ;
|
||||
execute s_t1 ;
|
||||
######## Question 2: The table t9 does not exist. ########
|
||||
--error 1146
|
||||
execute s_t9 ;
|
||||
|
||||
|
||||
#### revoke the access rights to t1
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
revoke all privileges on mysqltest.t1 from second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
#### check the access as new user
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
show grants for second_user@localhost ;
|
||||
######## Question 2: The table t1 should be now not accessible. ########
|
||||
--error 1142
|
||||
execute s_t1 ;
|
||||
|
||||
## cleanup
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
## disconnect the second session
|
||||
disconnect con3 ;
|
||||
## remove all rights of second_user@localhost
|
||||
revoke all privileges, grant option from second_user@localhost ;
|
||||
show grants for second_user@localhost ;
|
||||
drop user second_user@localhost ;
|
||||
commit ;
|
||||
--error 1141
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
drop table t1,t9 ;
|
||||
drop database mysqltest;
|
||||
|
||||
|
||||
##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
|
||||
#
|
||||
# 0. You don't have the time to
|
||||
|
119
mysql-test/t/ps_grant.test
Normal file
119
mysql-test/t/ps_grant.test
Normal file
@ -0,0 +1,119 @@
|
||||
# Can't test grants with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
# Tested here simply so it is not tested with embedded server
|
||||
prepare stmt4 from ' show full processlist ';
|
||||
--replace_column 1 number 6 time 3 localhost
|
||||
execute stmt4;
|
||||
|
||||
let $type= 'MYISAM' ;
|
||||
|
||||
################ GRANT/REVOKE/DROP affecting a parallel session ################
|
||||
--disable_query_log
|
||||
select '------ grant/revoke/drop affects a parallel session test ------'
|
||||
as test_sequence ;
|
||||
--enable_query_log
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# Here we test that:
|
||||
# 1. A new GRANT will be visible within another sessions. #
|
||||
# #
|
||||
# Let's assume there is a parallel session with an already prepared #
|
||||
# statement for a table. #
|
||||
# A DROP TABLE will affect the EXECUTE properties. #
|
||||
# A REVOKE will affect the EXECUTE properties. #
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
# Who am I ?
|
||||
# this is different across different systems:
|
||||
# select current_user(), user() ;
|
||||
|
||||
#### create a new user account ####
|
||||
## There should be no grants for that non existing user
|
||||
--error 1141
|
||||
show grants for second_user@localhost ;
|
||||
## create a new user account by using GRANT statements on t9
|
||||
create database mysqltest;
|
||||
# create the tables (t1 and t9) used in many tests
|
||||
use mysqltest;
|
||||
--disable_query_log
|
||||
--source include/ps_create.inc
|
||||
--source include/ps_renew.inc
|
||||
--enable_query_log
|
||||
eval use $DB;
|
||||
grant usage on mysqltest.* to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
grant select on mysqltest.t9 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
#### establish a second session to the new user account
|
||||
connect (con3,localhost,second_user,looser,mysqltest);
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
# Who am I ?
|
||||
select current_user();
|
||||
## check the access rights
|
||||
show grants for current_user();
|
||||
prepare s_t9 from 'select c1 as my_col
|
||||
from t9 where c1= 1' ;
|
||||
execute s_t9 ;
|
||||
# check that we cannot do a SELECT on the table t1;
|
||||
--error 1142
|
||||
select a as my_col from t1;
|
||||
|
||||
|
||||
#### give access rights to t1 and drop table t9
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
grant select on mysqltest.t1 to second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
drop table mysqltest.t9 ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
|
||||
#### check the access as new user
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
######## Question 1: The table t1 should be now accessible. ########
|
||||
show grants for second_user@localhost ;
|
||||
prepare s_t1 from 'select a as my_col from t1' ;
|
||||
execute s_t1 ;
|
||||
######## Question 2: The table t9 does not exist. ########
|
||||
--error 1146
|
||||
execute s_t9 ;
|
||||
|
||||
|
||||
#### revoke the access rights to t1
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
revoke all privileges on mysqltest.t1 from second_user@localhost
|
||||
identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
#### check the access as new user
|
||||
## switch to the second session
|
||||
connection con3;
|
||||
show grants for second_user@localhost ;
|
||||
######## Question 2: The table t1 should be now not accessible. ########
|
||||
--error 1142
|
||||
execute s_t1 ;
|
||||
|
||||
## cleanup
|
||||
## switch back to the first session
|
||||
connection default;
|
||||
## disconnect the second session
|
||||
disconnect con3 ;
|
||||
## remove all rights of second_user@localhost
|
||||
revoke all privileges, grant option from second_user@localhost ;
|
||||
show grants for second_user@localhost ;
|
||||
drop user second_user@localhost ;
|
||||
commit ;
|
||||
--error 1141
|
||||
show grants for second_user@localhost ;
|
||||
|
||||
drop database mysqltest;
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
# Test of rename table
|
||||
#
|
||||
|
||||
# Test requires concurrent connections, which can't be tested on embedded
|
||||
# server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t0,t1,t2,t3,t4;
|
||||
# Clear up from other tests (to ensure that SHOW TABLES below is right)
|
||||
|
4
mysql-test/t/rpl_variables.test
Normal file
4
mysql-test/t/rpl_variables.test
Normal file
@ -0,0 +1,4 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
set global slave_net_timeout=100;
|
||||
set global sql_slave_skip_counter=100;
|
@ -1742,8 +1742,12 @@ select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
|
||||
show tables;
|
||||
show tables from test like "s%";
|
||||
show tables from test like "t?";
|
||||
# We mask out the Privileges column because it differs with embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t2;
|
||||
--replace_column 8 #
|
||||
show full columns from t2 from test like 'f%';
|
||||
--replace_column 8 #
|
||||
show full columns from t2 from test like 's%';
|
||||
show keys from t2;
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
# Requires use of multiple simultaneous connections, not supported with
|
||||
# embedded server testing
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Test of some show commands
|
||||
#
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Embedded server doesn't support external clients
|
||||
--source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# This is the test for mysql_fix_privilege_tables
|
||||
#
|
||||
|
@ -199,74 +199,6 @@ insert into t1 (ts) values (now());
|
||||
select convert_tz(ts, @@time_zone, 'Japan') from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
|
||||
# tables". We should allow implicit access to time zone description tables
|
||||
# even for unprivileged users.
|
||||
#
|
||||
|
||||
# Let us prepare playground
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
create table t1 (a int, b datetime);
|
||||
create table t2 (c int, d datetime);
|
||||
|
||||
grant all privileges on test.* to mysqltest_1@localhost;
|
||||
connect (tzuser, localhost, mysqltest_1,,);
|
||||
connection tzuser;
|
||||
show grants for current_user();
|
||||
set time_zone= '+00:00';
|
||||
set time_zone= 'Europe/Moscow';
|
||||
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
|
||||
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
|
||||
# Let us also check whenever multi-update works ok
|
||||
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
|
||||
where t1.a = t2.c and t2.d = (select max(d) from t2);
|
||||
# But still these two statements should not work:
|
||||
--error 1044
|
||||
select * from mysql.time_zone_name;
|
||||
--error 1044
|
||||
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
|
||||
|
||||
#
|
||||
# Test for bug #6765 "Implicit access to time zone description tables
|
||||
# requires privileges for them if some table or column level grants
|
||||
# present"
|
||||
#
|
||||
connection default;
|
||||
# Let use some table-level grants instead of db-level
|
||||
# to make life more interesting
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
grant all privileges on test.t1 to mysqltest_1@localhost;
|
||||
grant all privileges on test.t2 to mysqltest_1@localhost;
|
||||
# The test itself is almost the same as previous one
|
||||
connect (tzuser2, localhost, mysqltest_1,,);
|
||||
connection tzuser2;
|
||||
show grants for current_user();
|
||||
set time_zone= '+00:00';
|
||||
set time_zone= 'Europe/Moscow';
|
||||
select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
|
||||
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
|
||||
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
|
||||
where t1.a = t2.c and t2.d = (select max(d) from t2);
|
||||
# Again these two statements should not work (but with different errors):
|
||||
--error 1142
|
||||
select * from mysql.time_zone_name;
|
||||
--error 1142
|
||||
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
|
||||
|
||||
# Clean-up
|
||||
connection default;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Test for bug #7705 "CONVERT_TZ() crashes with subquery/WHERE on index
|
||||
# column". Queries in which one of time zone arguments of CONVERT_TZ() is
|
||||
|
71
mysql-test/t/timezone_grant.test
Normal file
71
mysql-test/t/timezone_grant.test
Normal file
@ -0,0 +1,71 @@
|
||||
# Embedded server testing does not support grants
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
#
|
||||
# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
|
||||
# tables". We should allow implicit access to time zone description tables
|
||||
# even for unprivileged users.
|
||||
#
|
||||
|
||||
# Let us prepare playground
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
create table t1 (a int, b datetime);
|
||||
create table t2 (c int, d datetime);
|
||||
|
||||
grant all privileges on test.* to mysqltest_1@localhost;
|
||||
connect (tzuser, localhost, mysqltest_1,,);
|
||||
connection tzuser;
|
||||
show grants for current_user();
|
||||
set time_zone= '+00:00';
|
||||
set time_zone= 'Europe/Moscow';
|
||||
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
|
||||
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
|
||||
# Let us also check whenever multi-update works ok
|
||||
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
|
||||
where t1.a = t2.c and t2.d = (select max(d) from t2);
|
||||
# But still these two statements should not work:
|
||||
--error 1044
|
||||
select * from mysql.time_zone_name;
|
||||
--error 1044
|
||||
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
|
||||
|
||||
#
|
||||
# Test for bug #6765 "Implicit access to time zone description tables
|
||||
# requires privileges for them if some table or column level grants
|
||||
# present"
|
||||
#
|
||||
connection default;
|
||||
# Let use some table-level grants instead of db-level
|
||||
# to make life more interesting
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
grant all privileges on test.t1 to mysqltest_1@localhost;
|
||||
grant all privileges on test.t2 to mysqltest_1@localhost;
|
||||
# The test itself is almost the same as previous one
|
||||
connect (tzuser2, localhost, mysqltest_1,,);
|
||||
connection tzuser2;
|
||||
show grants for current_user();
|
||||
set time_zone= '+00:00';
|
||||
set time_zone= 'Europe/Moscow';
|
||||
select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
|
||||
select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
|
||||
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
|
||||
where t1.a = t2.c and t2.d = (select max(d) from t2);
|
||||
# Again these two statements should not work (but with different errors):
|
||||
--error 1142
|
||||
select * from mysql.time_zone_name;
|
||||
--error 1142
|
||||
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
|
||||
|
||||
# Clean-up
|
||||
connection default;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
drop table t1, t2;
|
||||
|
@ -77,8 +77,11 @@ insert into t1 values (NULL,NULL,NULL,NULL);
|
||||
update t1 set c="",b=null where c="1";
|
||||
|
||||
lock tables t1 READ;
|
||||
# We mask out the Privileges column because it differs for embedded server
|
||||
--replace_column 8 #
|
||||
show full fields from t1;
|
||||
lock tables t1 WRITE;
|
||||
--replace_column 8 #
|
||||
show full fields from t1;
|
||||
unlock tables;
|
||||
|
||||
@ -299,18 +302,25 @@ drop table t1;
|
||||
|
||||
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null);
|
||||
insert into t1 (id) values (1);
|
||||
select
|
||||
charset(load_file('../../std_data/words.dat')),
|
||||
collation(load_file('../../std_data/words.dat')),
|
||||
coercibility(load_file('../../std_data/words.dat'));
|
||||
explain extended select
|
||||
charset(load_file('../../std_data/words.dat')),
|
||||
collation(load_file('../../std_data/words.dat')),
|
||||
coercibility(load_file('../../std_data/words.dat'));
|
||||
update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
|
||||
# We have to clean up the path in the results for safe comparison
|
||||
--replace_result $MYSQL_TEST_DIR ../..
|
||||
eval select
|
||||
charset(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
|
||||
collation(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
|
||||
coercibility(load_file('$MYSQL_TEST_DIR/std_data/words.dat'));
|
||||
--replace_result $MYSQL_TEST_DIR ../..
|
||||
eval explain extended select
|
||||
charset(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
|
||||
collation(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
|
||||
coercibility(load_file('$MYSQL_TEST_DIR/std_data/words.dat'));
|
||||
--replace_result $MYSQL_TEST_DIR ../..
|
||||
eval update t1 set imagem=load_file('$MYSQL_TEST_DIR/std_data/words.dat') where id=1;
|
||||
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
|
||||
drop table t1;
|
||||
create table t1 select load_file('../../std_data/words.dat');
|
||||
--replace_result $MYSQL_TEST_DIR ../..
|
||||
eval create table t1 select load_file('$MYSQL_TEST_DIR/std_data/words.dat') l;
|
||||
# We mask out the Privileges column because it differs for embedded server
|
||||
--replace_column 8 #
|
||||
show full fields from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -16,6 +16,8 @@ SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
|
||||
SELECT 2147483647E+02,21474836.47E+06;
|
||||
|
||||
create table t1 (f1 float(24),f2 float(52));
|
||||
# We mask out Privileges column because it differs for embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t1;
|
||||
insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
|
||||
insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
|
||||
@ -66,6 +68,8 @@ drop table t1;
|
||||
#
|
||||
|
||||
create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6));
|
||||
# We mask out Privileges column because it differs for embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -46,6 +46,8 @@ CREATE TABLE t1 (
|
||||
KEY (options,flags)
|
||||
);
|
||||
|
||||
# We mask out the Privileges column because it differs with embedded server
|
||||
--replace_column 8 #
|
||||
show full fields from t1;
|
||||
show keys from t1;
|
||||
|
||||
@ -120,7 +122,10 @@ drop table t2;
|
||||
|
||||
create table t2 select * from t1;
|
||||
update t2 set string="changed" where auto=16;
|
||||
# We mask out the Privileges column because it differs with embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t1;
|
||||
--replace_column 8 #
|
||||
show full columns from t2;
|
||||
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
|
||||
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
|
||||
@ -128,6 +133,8 @@ select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.
|
||||
drop table t2;
|
||||
|
||||
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
|
||||
# We mask out the Privileges column because it differs with embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t2;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
@ -138,6 +145,8 @@ create table t2 select * from t1;
|
||||
--error 1060
|
||||
create table t3 select * from t1, t2; # Should give an error
|
||||
create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
|
||||
# We mask out the Privileges column because it differs with embedded server
|
||||
--replace_column 8 #
|
||||
show full columns from t3;
|
||||
drop table t1,t2,t3;
|
||||
|
||||
|
19
mysql-test/t/user_var-binlog.test
Normal file
19
mysql-test/t/user_var-binlog.test
Normal file
@ -0,0 +1,19 @@
|
||||
# Embedded server does not support binlogging
|
||||
--source include/not_embedded.inc
|
||||
|
||||
# Check that user variables are binlogged correctly (BUG#3875)
|
||||
create table t1 (a varchar(50));
|
||||
reset master;
|
||||
SET TIMESTAMP=10000;
|
||||
SET @`a b`='hello';
|
||||
INSERT INTO t1 VALUES(@`a b`);
|
||||
set @var1= "';aaa";
|
||||
SET @var2=char(ascii('a'));
|
||||
insert into t1 values (@var1),(@var2);
|
||||
show binlog events from 79;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t1;
|
@ -98,24 +98,6 @@ select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
|
||||
|
||||
# Check that user variables are binlogged correctly (BUG#3875)
|
||||
create table t1 (a varchar(50));
|
||||
reset master;
|
||||
SET TIMESTAMP=10000;
|
||||
SET @`a b`='hello';
|
||||
INSERT INTO t1 VALUES(@`a b`);
|
||||
set @var1= "';aaa";
|
||||
SET @var2=char(ascii('a'));
|
||||
insert into t1 values (@var1),(@var2);
|
||||
show binlog events from 79;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #6321 strange error:
|
||||
# string function FIELD(<uservariable content NULL>, ...)
|
||||
|
@ -218,7 +218,6 @@ set read_buffer_size=100;
|
||||
set read_rnd_buffer_size=100;
|
||||
set global rpl_recovery_rank=100;
|
||||
set global server_id=100;
|
||||
set global slave_net_timeout=100;
|
||||
set global slow_launch_time=100;
|
||||
set sort_buffer_size=100;
|
||||
set sql_auto_is_null=1;
|
||||
@ -237,7 +236,6 @@ select @@sql_max_join_size,@@max_join_size;
|
||||
set sql_quote_show_create=1;
|
||||
set sql_safe_updates=1;
|
||||
set sql_select_limit=1;
|
||||
set global sql_slave_skip_counter=100;
|
||||
set sql_warnings=1;
|
||||
set global table_cache=100;
|
||||
set storage_engine=myisam;
|
||||
|
Reference in New Issue
Block a user