bug#33731 - INSTALL/UNINSTALL PLUGIN: Inconsistent handling of identifier case

indexed column in mysql.plugin table should use case-insensitive collation
for index lookups to work

(backport from 6.0)
This commit is contained in:
Sergei Golubchik 2009-10-12 20:15:10 +02:00
parent 8cf706218a
commit df59e27b4e
3 changed files with 11 additions and 5 deletions

View file

@ -22,7 +22,7 @@ set @had_user_table= @@warning_count != 0;
CREATE TABLE IF NOT EXISTS 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';
CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl char(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='MySQL plugins';
CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins';
CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';

View file

@ -229,6 +229,11 @@ SET GLOBAL slow_query_log = 'OFF';
ALTER TABLE slow_log MODIFY COLUMN server_id INTEGER UNSIGNED NOT NULL;
SET GLOBAL slow_query_log = @old_log_state;
ALTER TABLE plugin
MODIFY name varchar(64) COLLATE utf8_general_ci NOT NULL DEFAULT '',
MODIFY dl varchar(128) COLLATE utf8_general_ci NOT NULL DEFAULT '',
CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
#
# Detect whether we had Create_view_priv
#

View file

@ -1764,12 +1764,13 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
reap_plugins();
pthread_mutex_unlock(&LOCK_plugin);
uchar user_key[MAX_KEY_LENGTH];
table->use_all_columns();
table->field[0]->store(name->str, name->length, system_charset_info);
if (! table->file->index_read_idx_map(table->record[0], 0,
(uchar *)table->field[0]->ptr,
HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
if (! table->file->index_read_idx_map(table->record[0], 0, user_key,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
{
int error;
/*