polardbxengine/mysql-test/t/lowercase_fs_off.test

169 lines
4.6 KiB
Plaintext

#
# Specific tests for case sensitive file systems
# i.e. lower_case_filesystem=OFF
#
-- source include/have_case_sensitive_file_system.inc
-- source include/have_lowercase0.inc
set @orig_sql_mode_session= @@SESSION.sql_mode;
set @orig_sql_mode_global= @@GLOBAL.sql_mode;
connect (master,localhost,root,,);
connection master;
create database d1;
create user 'sample'@'localhost' identified by 'password';
grant all on d1.* to 'sample'@'localhost';
flush privileges;
connect (sample,localhost,sample,password,d1);
connection sample;
select database();
--error ER_DBACCESS_DENIED_ERROR
create database d2;
--error ER_DBACCESS_DENIED_ERROR
create database D1;
disconnect sample;
--source include/wait_until_disconnected.inc
connection master;
drop user 'sample'@'localhost';
drop database if exists d1;
disconnect master;
--source include/wait_until_disconnected.inc
connection default;
# End of 4.1 tests
#
# Bug#41049 does syntax "grant" case insensitive?
#
CREATE DATABASE d1;
USE d1;
CREATE USER user_1@localhost;
CREATE TABLE T1(f1 INT);
CREATE TABLE t1(f1 INT);
GRANT SELECT ON T1 to user_1@localhost;
connect (con1,localhost,user_1,,d1);
--error ER_TABLEACCESS_DENIED_ERROR
select * from t1;
select * from T1;
connection default;
GRANT SELECT ON t1 to user_1@localhost;
connection con1;
--sorted_result
select * from information_schema.table_privileges;
connection default;
disconnect con1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
DROP USER user_1@localhost;
DROP DATABASE d1;
USE test;
CREATE DATABASE db1;
USE db1;
CREATE PROCEDURE p1() BEGIN END;
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
CREATE USER user_1@localhost, USER_1@localhost;
GRANT USAGE ON db1.* to user_1@localhost;
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
GRANT UPDATE ON db1.* to USER_1@localhost;
connect (con1,localhost,user_1,,db1);
call p1();
call P1();
select f1(1);
connect (con2,localhost,USER_1,,db1);
--error ER_PROCACCESS_DENIED_ERROR
call p1();
--error ER_PROCACCESS_DENIED_ERROR
call P1();
--error ER_PROCACCESS_DENIED_ERROR
select f1(1);
connection default;
disconnect con1;
disconnect con2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;
set GLOBAL sql_mode= @orig_sql_mode_global;
set SESSION sql_mode= @orig_sql_mode_session;
# End of 5.0 tests
--echo #
--echo # Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X
--echo #
CREATE TABLE t1(a INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
RENAME TABLE t1 TO T1;
ALTER TABLE T1 RENAME t1;
DROP TABLE t1;
--echo #
--echo # Bug #27309094: REJECT LCTN CHANGING AFTER --INITIALIZE
--echo #
--echo # Verify that we are not allowed to restart the server with a
--echo # lower_case_table_names setting different than the setting
--echo # use during --initialize.
--echo #
let BASEDIR= `select @@basedir`;
let DDIR= $MYSQL_TMP_DIR/lctn_test;
let MYSQLD_LOG= $MYSQL_TMP_DIR/server.log;
let extra_args= --no-defaults --innodb_dedicated_server=OFF --secure-file-priv="" --log-error=$MYSQLD_LOG --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR;
let BOOTSTRAP_SQL= $MYSQL_TMP_DIR/tiny_bootstrap.sql;
--echo # 1. Shut server down.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # 2. initialize the server.
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR --cluster-id=1 --cluster-start-index=1 --cluster-info='127.0.0.1:23500@1'
--echo # 3. Restart the server with a different lower_case_table_names setting. Should fail.
--error 1
--exec $MYSQLD $extra_args --lower_case_table_names=1 --datadir=$DDIR
--echo # 4. Look for error.
perl;
use strict;
my $log= $ENV{'MYSQLD_LOG'} or die;
open(FILE, "$log") or die;
my $c_w= grep(/Different lower_case_table_names settings/gi,<FILE>);
print "# Found lower_case_table_names error $c_w times.\n";
close(FILE);
EOF
--echo # 5. Restart the server against default datadir.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # 6. Cleanup.
--echo # Delete \$DDIR.
--force-rmdir $DDIR
--echo # Delete sql files.
--remove_files_wildcard $MYSQL_TMP_DIR *.sql
--echo # Delete log files.
--remove_files_wildcard $MYSQL_TMP_DIR *.log
--echo # Delete expect files.
--remove_files_wildcard $MYSQL_TMP_DIR *.expect