diff options
author | unknown <jimw@mysql.com> | 2005-03-22 21:52:01 +0100 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-03-22 21:52:01 +0100 |
commit | 8fc710cee68c086b8139e25cb53dfe0ad9fba942 (patch) | |
tree | 4f8c553488f1ffb1e92e5feb75882864da558d1d /scripts | |
parent | 21c3112536291745d69f29b7ba9496a33c8a5181 (diff) | |
download | mariadb-git-8fc710cee68c086b8139e25cb53dfe0ad9fba942.tar.gz |
Hack to ensure that CHAR's created in 5.0 are not converted to VARCHAR even if
the row type is dynamic (For 4.1 tables old 'VARCHAR' fields are converted to
true VARCHAR in the next ALTER TABLE)
This ensures that one can use MySQL 5.0 privilege tables with MySQL 4.1.
(Fix imported from main 5.0 tree to 5.0.3 build tree.)
mysql-test/r/information_schema.result:
Update results (for .frm version number change)
mysql-test/r/ndb_autodiscover.result:
Update results (for .frm version number change)
mysql-test/r/ps_1general.result:
Update results (for .frm version number change)
mysql-test/r/show_check.result:
Update results (for .frm version number change)
mysql-test/r/view.result:
Update results (for .frm version number change)
scripts/fill_func_tables.sh:
Ensure that no privilege tables that is used in 4.1 uses VARCHAR
scripts/mysql_create_system_tables.sh:
Ensure that no privilege tables that is used in 4.1 uses VARCHAR
sql/sql_table.cc:
Only set create_info->varchar if we are using the new VARCHAR field
scripts/mysql_fix_privilege_tables.sh:
Fixed bug that made it impossible to run the script from the mysql source dist
scripts/mysql_fix_privilege_tables.sql:
Ensure that no privilege tables that is used in 4.1 uses VARCHAR
sql/table.cc:
Hack to ensure that CHAR's created in 5.0 are not converted to VARCHAR even if
the row type is dynamic (For 4.1 tables old 'VARCHAR' fields are converted to
true VARCHAR in the next ALTER TABLE)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/fill_func_tables.sh | 8 | ||||
-rw-r--r-- | scripts/mysql_create_system_tables.sh | 10 | ||||
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sh | 2 | ||||
-rw-r--r-- | scripts/mysql_fix_privilege_tables.sql | 42 |
4 files changed, 47 insertions, 15 deletions
diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh index 459afee2fe1..203c730dd9a 100644 --- a/scripts/fill_func_tables.sh +++ b/scripts/fill_func_tables.sh @@ -131,8 +131,8 @@ print "USE mysql_help;\n"; print "DROP TABLE IF EXISTS function;\n"; print "CREATE TABLE function ("; print " func_id int unsigned not null auto_increment,"; -print " name varchar(64) not null,"; -print " url varchar(128) not null,"; +print " name char(64) not null,"; +print " url char(128) not null,"; print " description text not null,"; print " example text not null,"; print " min_args tinyint not null,"; @@ -145,8 +145,8 @@ print ") type=myisam;\n\n"; print "DROP TABLE IF EXISTS function_category_name;\n"; print "CREATE TABLE function_category_name ("; print " cat_id smallint unsigned not null auto_increment,"; -print " name varchar(64) not null,"; -print " url varchar(128) not null,"; +print " name char(64) not null,"; +print " url char(128) not null,"; print " date_created datetime not null,"; print " last_modified timestamp not null,"; print " primary key (cat_id)"; diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 29f6f7b41e1..bb4c2f08193 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -270,11 +270,11 @@ then c_ht="$c_ht CREATE TABLE help_topic (" c_ht="$c_ht help_topic_id int unsigned not null," - c_ht="$c_ht name varchar(64) not null," + c_ht="$c_ht name char(64) not null," c_ht="$c_ht help_category_id smallint unsigned not null," c_ht="$c_ht description text not null," c_ht="$c_ht example text not null," - c_ht="$c_ht url varchar(128) not null," + c_ht="$c_ht url char(128) not null," c_ht="$c_ht primary key (help_topic_id)," c_ht="$c_ht unique index (name)" c_ht="$c_ht ) engine=MyISAM" @@ -292,9 +292,9 @@ then c_hc="$c_hc CREATE TABLE help_category (" c_hc="$c_hc help_category_id smallint unsigned not null," - c_hc="$c_hc name varchar(64) not null," + c_hc="$c_hc name char(64) not null," c_hc="$c_hc parent_category_id smallint unsigned null," - c_hc="$c_hc url varchar(128) not null," + c_hc="$c_hc url char(128) not null," c_hc="$c_hc primary key (help_category_id)," c_hc="$c_hc unique index (name)" c_hc="$c_hc ) engine=MyISAM" @@ -310,7 +310,7 @@ then c_hk="$c_hk CREATE TABLE help_keyword (" c_hk="$c_hk help_keyword_id int unsigned not null," - c_hk="$c_hk name varchar(64) not null," + c_hk="$c_hk name char(64) not null," c_hk="$c_hk primary key (help_keyword_id)," c_hk="$c_hk unique index (name)" c_hk="$c_hk ) engine=MyISAM" diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh index d5c96532782..d080b68b268 100644 --- a/scripts/mysql_fix_privilege_tables.sh +++ b/scripts/mysql_fix_privilege_tables.sh @@ -13,7 +13,7 @@ args="" port="" socket="" database="mysql" -bindir="." +bindir="" pkgdatadir="@pkgdatadir@" print_defaults_bindir="." diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 628b034362d..dee4ebd3d2f 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -319,19 +319,19 @@ KEY Grantor (Grantor) CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, -name varchar(64) not null, +name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, -url varchar(128) not null, +url char(128) not null, primary key (help_topic_id), unique index (name) ) CHARACTER SET utf8 comment='help topics'; CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, -name varchar(64) not null, +name char(64) not null, parent_category_id smallint unsigned null, -url varchar(128) not null, +url char(128) not null, primary key (help_category_id), unique index (name) ) CHARACTER SET utf8 comment='help categories'; @@ -344,7 +344,7 @@ primary key (help_keyword_id, help_topic_id) CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, -name varchar(64) not null, +name char(64) not null, primary key (help_keyword_id), unique index (name) ) CHARACTER SET utf8 comment='help keywords'; @@ -491,3 +491,35 @@ ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL, 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT 0 NOT NULL; + +# +# Change all varchar fields in privilege tables to CHAR, to ensure that +# we can use the privilege tables in MySQL 4.1 +# Note that for this hack to work, we must change all CHAR() columns at +# the same time +# + +ALTER TABLE mysql.user +modify Host char(60) binary DEFAULT '' NOT NULL, +modify User char(16) binary DEFAULT '' NOT NULL, +modify Password char(41) binary DEFAULT '' NOT NULL; + +ALTER TABLE mysql.db +modify Host char(60) binary DEFAULT '' NOT NULL, +modify Db char(64) binary DEFAULT '' NOT NULL, +modify User char(16) binary DEFAULT '' NOT NULL; + +ALTER TABLE mysql.host +modify Host char(60) binary DEFAULT '' NOT NULL, +modify Db char(64) binary DEFAULT '' NOT NULL; + +ALTER TABLE help_topic +modify name char(64) not null, +modify url char(128) not null; + +ALTER TABLE help_category +modify name char(64) not null, +modify url char(128) not null; + +ALTER TABLE help_keyword +modify name char(64) not null; |