mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / fix_priv_tables.test
blobeeda9bc8d15789cb410cbf3eece19a09c9033aeb
1 # Embedded server doesn't support external clients
2 --source include/not_embedded.inc
4 # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
5 # to the location of mysql_fix_privilege_tables.sql
6 if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
8   skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
12 # This is the test for mysql_fix_privilege_tables
13 # It checks that a system tables from mysql 4.1.23
14 # can be upgraded to current system table format
16 # Note: If this test fails, don't be confused about the errors reported
17 # by mysql-test-run This shows warnings generated by
18 # mysql_fix_system_tables which should be ignored.
19 # Instead, concentrate on the errors in r/system_mysql_db.reject
21 --disable_warnings
22 drop table if exists t1,t1aa,t2aa;
23 --enable_warnings
26 # Bug #20589 Missing some table level privileges after upgrade
28 # Add some grants that should survive the "upgrade"
30 --disable_warnings
31 DROP DATABASE IF EXISTS testdb;
32 --enable_warnings
33 CREATE DATABASE testdb;
34 CREATE TABLE testdb.t1 (
35   c1 INT,
36   c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
38 CREATE VIEW testdb.v1 AS
39         SELECT * FROM testdb.t1;
41 GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost';
42 SHOW GRANTS FOR 'show_view_tbl'@'localhost';
43 echo;
45 # Some extra GRANTS for more complete test
46 GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
47 SHOW GRANTS FOR 'select_only_c1'@'localhost';
48 echo;
50 -- disable_result_log
51 -- disable_query_log
53 # Run the mysql_fix_privilege_tables.sql using "mysql --force"
54 # Determine the number of open sessions
55 --source include/count_sessions.inc
56 --exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log 2>&1
57 --remove_file $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log
58 # Wait till the number of open sessions is <= the number before the run with $MYSQL
59 # = The session caused by mysql has finished its disconnect
60 --source include/wait_until_count_sessions.inc
62 -- enable_query_log
63 -- enable_result_log
65 echo "after fix privs";
67 SHOW GRANTS FOR 'show_view_tbl'@'localhost';
68 echo;
69 SHOW GRANTS FOR 'select_only_c1'@'localhost';
70 echo;
72 DROP USER 'show_view_tbl'@'localhost';
73 DROP USER 'select_only_c1'@'localhost';
75 DROP VIEW testdb.v1;
76 DROP TABLE testdb.t1;
77 DROP DATABASE testdb;
79 # End of 4.1 tests