system_mysql_db_fix30020.test 3.47 KB
Newer Older
1 2 3
# Embedded server doesn't support external clients
--source include/not_embedded.inc

4 5 6
# Windows doesn't support execution of shell scripts (to fix!!)
--source include/not_windows.inc

7 8 9 10
# check that CSV engine was compiled in, as the test relies on the presence
# of the log tables (which are CSV-based)
--source include/have_csv.inc

11
#
12
# This is the test for mysql_fix_privilege_tables
13 14
# It checks that a system tables from mysql 3.20
# can be upgraded to current system table format
15
#
monty@mysql.com's avatar
monty@mysql.com committed
16
# Note: If this test fails, don't be confused about the errors reported
17
# by mysql-test-run This shows warnings generated by
monty@mysql.com's avatar
monty@mysql.com committed
18 19 20 21 22 23
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject

--disable_warnings
drop table if exists t1,t1aa,t2aa;
--enable_warnings
24

25 26
-- disable_result_log
-- disable_query_log
monty@mysql.com's avatar
monty@mysql.com committed
27

28
use test;
monty@mysql.com's avatar
monty@mysql.com committed
29

30
# create system tables as in mysql-3.20
monty@mysql.com's avatar
monty@mysql.com committed
31

32
--disable_warnings
33 34 35 36 37 38 39 40 41 42 43 44 45
CREATE TABLE db (
  Host char(60) binary DEFAULT '' NOT NULL,
  Db char(32) binary DEFAULT '' NOT NULL,
  User char(16) binary DEFAULT '' NOT NULL,
  Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  PRIMARY KEY Host (Host,Db,User),
  KEY User (User)
)
46
engine=MyISAM;
47
--enable_warnings
48 49 50 51

INSERT INTO db VALUES ('%','test',   '','Y','Y','Y','Y','Y','Y');
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y');

52
--disable_warnings
53 54 55 56 57 58 59 60 61 62 63
CREATE TABLE host (
  Host char(60) binary DEFAULT '' NOT NULL,
  Db char(32) binary DEFAULT '' NOT NULL,
  Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  PRIMARY KEY Host (Host,Db)
)
64
engine=MyISAM;
65
--enable_warnings
66

67
--disable_warnings
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
CREATE TABLE user (
  Host char(60) binary DEFAULT '' NOT NULL,
  User char(16) binary DEFAULT '' NOT NULL,
  Password char(16),
  Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,
  PRIMARY KEY Host (Host,User)
)
83
engine=MyISAM;
84
--enable_warnings
85 86 87

INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','',    '','N','N','N','N','N','N','N','N','N');
monty@mysql.com's avatar
monty@mysql.com committed
88

89
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
90
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > $MYSQLTEST_VARDIR/log/system_mysql_db_fix30020.log 2>&1
91 92 93 94 95 96 97
-- enable_query_log
-- enable_result_log

-- source include/system_db_struct.inc

-- disable_query_log

98 99 100 101
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv,
procs_priv, help_category, help_keyword, help_relation, help_topic, proc,
time_zone, time_zone_leap_second, time_zone_name, time_zone_transition,
time_zone_transition_type, general_log, slow_log, event;
serg@serg.mylan's avatar
serg@serg.mylan committed
102

103
-- enable_query_log
104

105
# check that we dropped all system tables
106
show tables;
107 108

# End of 4.1 tests