~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/t/system_mysql_db_fix40123.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Embedded server doesn't support external clients
 
2
--source include/not_embedded.inc
 
3
 
 
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`)
 
7
{
 
8
  skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
 
9
}
 
10
 
 
11
#
 
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
 
15
#
 
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
 
20
 
 
21
--disable_warnings
 
22
drop table if exists t1,t1aa,t2aa;
 
23
--enable_warnings
 
24
 
 
25
-- disable_result_log
 
26
-- disable_query_log
 
27
 
 
28
use test;
 
29
 
 
30
# create system tables as in mysql-4.1.23
 
31
# created by executing "./mysql_create_system_tables real ."
 
32
 
 
33
set storage_engine=myisam;
 
34
CREATE TABLE db (   Host char(60) binary DEFAULT '' NOT NULL,   Db char(64) binary DEFAULT '' NOT NULL,   User char(16) binary DEFAULT '' NOT NULL,   Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
 
35
INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
 
36
INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
 
37
 
 
38
CREATE TABLE host (  Host char(60) binary DEFAULT '' NOT NULL,  Db char(64) binary DEFAULT '' NOT NULL,  Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,  PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges;  Merged with database privileges';
 
39
 
 
40
 
 
41
CREATE TABLE user (   Host char(60) binary DEFAULT '' NOT NULL,   User char(16) binary DEFAULT '' NOT NULL,   Password char(41) binary DEFAULT '' NOT NULL,   Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL,   ssl_cipher BLOB NOT NULL,   x509_issuer BLOB NOT NULL,   x509_subject BLOB NOT NULL,   max_questions int(11) unsigned DEFAULT 0  NOT NULL,   max_updates int(11) unsigned DEFAULT 0  NOT NULL,   max_connections int(11) unsigned DEFAULT 0  NOT NULL,   PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
 
42
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
 
43
           INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
 
44
 
 
45
CREATE TABLE func (   name char(64) binary DEFAULT '' NOT NULL,   ret tinyint(1) DEFAULT '0' NOT NULL,   dl char(128) DEFAULT '' NOT NULL,   type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL,   PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin   comment='User defined functions';
 
46
 
 
47
 
 
48
CREATE TABLE tables_priv (   Host char(60) binary DEFAULT '' NOT NULL,   Db char(64) binary DEFAULT '' NOT NULL,   User char(16) binary DEFAULT '' NOT NULL,   Table_name char(64) binary DEFAULT '' NOT NULL,   Grantor char(77) DEFAULT '' NOT NULL,   Timestamp timestamp,   Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL,   Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,   PRIMARY KEY (Host,Db,User,Table_name),   KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin   comment='Table privileges';
 
49
CREATE TABLE columns_priv (   Host char(60) binary DEFAULT '' NOT NULL,   Db char(64) binary DEFAULT '' NOT NULL,   User char(16) binary DEFAULT '' NOT NULL,   Table_name char(64) binary DEFAULT '' NOT NULL,   Column_name char(64) binary DEFAULT '' NOT NULL,   Timestamp timestamp,   Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL,   PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin   comment='Column privileges';
 
50
 
 
51
CREATE TABLE help_topic (   help_topic_id    int unsigned not null,   name             varchar(64) not null,   help_category_id smallint unsigned not null,   description      text not null,   example          text not null,   url              varchar(128) not null,   primary key      (help_topic_id),   unique index     (name) ) engine=MyISAM CHARACTER SET utf8   comment='help topics';
 
52
CREATE TABLE help_category (   help_category_id   smallint unsigned not null,   name               varchar(64) not null,   parent_category_id smallint unsigned null,   url                varchar(128) not null,   primary key        (help_category_id),   unique index       (name) ) engine=MyISAM CHARACTER SET utf8   comment='help categories';
 
53
CREATE TABLE help_relation (   help_topic_id    int unsigned not null references help_topic,   help_keyword_id  int unsigned not null references help_keyword,   primary key      (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8   comment='keyword-topic relation';
 
54
CREATE TABLE help_keyword (   help_keyword_id  int unsigned not null,   name             varchar(64) not null,   primary key      (help_keyword_id),   unique index     (name) ) engine=MyISAM CHARACTER SET utf8   comment='help keywords';
 
55
 
 
56
CREATE TABLE time_zone_name (   Name char(64) NOT NULL,   Time_zone_id int unsigned NOT NULL,   PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8   comment='Time zone names';
 
57
 
 
58
CREATE TABLE time_zone (   Time_zone_id int unsigned NOT NULL auto_increment,   Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL,   PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8   comment='Time zones';
 
59
 
 
60
CREATE TABLE time_zone_transition (   Time_zone_id int unsigned NOT NULL,   Transition_time bigint signed NOT NULL,   Transition_type_id int unsigned NOT NULL,   PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8   comment='Time zone transitions';
 
61
 
 
62
CREATE TABLE time_zone_transition_type (   Time_zone_id int unsigned NOT NULL,   Transition_type_id int unsigned NOT NULL,   Offset int signed DEFAULT 0 NOT NULL,   Is_DST tinyint unsigned DEFAULT 0 NOT NULL,   Abbreviation char(8) DEFAULT '' NOT NULL,   PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8   comment='Time zone transition types';
 
63
 
 
64
CREATE TABLE time_zone_leap_second (   Transition_time bigint signed NOT NULL,   Correction int signed NOT NULL,   PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8   comment='Leap seconds information for time zones';
 
65
 
 
66
 
 
67
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
 
68
--exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/system_mysql_db_fix40123.log 2>&1
 
69
 
 
70
-- enable_query_log
 
71
-- enable_result_log
 
72
 
 
73
# Dump the tables that should be compared
 
74
-- source include/system_db_struct.inc
 
75
 
 
76
-- disable_query_log
 
77
 
 
78
# Drop all tables created by this test
 
79
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, 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, ndb_binlog_index, online_backup, online_backup_progress;
 
80
 
 
81
-- enable_query_log
 
82
 
 
83
# check that we dropped all system tables
 
84
show tables;
 
85
 
 
86
# End of 4.1 tests