summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-03-22 15:48:06 +0200
committerunknown <monty@mysql.com>2005-03-22 15:48:06 +0200
commita99cb51c9d93d34eedbc08a9fca793855e3b9e05 (patch)
treec6c0d1b66f3806c56a502e647603e7e2566f6604 /scripts
parent3e13c80a20379bb9c3d1d2005e8a408ed8ac5225 (diff)
downloadmariadb-git-a99cb51c9d93d34eedbc08a9fca793855e3b9e05.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 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 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/sql_table.cc: Only set create_info->varchar if we are using the new VARCHAR field 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.sh8
-rw-r--r--scripts/mysql_create_system_tables.sh10
-rw-r--r--scripts/mysql_fix_privilege_tables.sh2
-rw-r--r--scripts/mysql_fix_privilege_tables.sql42
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 d87113d3656..0260bdea887 100644
--- a/scripts/mysql_create_system_tables.sh
+++ b/scripts/mysql_create_system_tables.sh
@@ -269,11 +269,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"
@@ -291,9 +291,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"
@@ -309,7 +309,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 2310e8d0bef..344f8ca5bb3 100644
--- a/scripts/mysql_fix_privilege_tables.sql
+++ b/scripts/mysql_fix_privilege_tables.sql
@@ -307,19 +307,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';
@@ -332,7 +332,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';
@@ -479,3 +479,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;