Commit aa374dc7 authored by Alexander Nozdrin's avatar Alexander Nozdrin

Auto-merge from mysql-trunk-merge.

parents 22f4498c db6afa75
......@@ -148,3 +148,20 @@ a
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
#
# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
# returns nothing
#
CREATE TABLE `ttt` (
`f1` char(3) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
'TTT';
count(COLUMN_NAME)
1
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
count(*)
1
DROP TABLE `ttt`;
End of 5.0 tests.
......@@ -169,4 +169,46 @@ DROP PROCEDURE testproc;
WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary.
WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary.
WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.
#
# Bug #53613: mysql_upgrade incorrectly revokes
# TRIGGER privilege on given table
#
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
Run mysql_upgrade with all privileges on a user
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
SHOW GRANTS FOR 'user3'@'%';
Grants for user3@%
GRANT USAGE ON *.* TO 'user3'@'%'
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched.
......@@ -160,4 +160,26 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--echo End of 5.0 tests.
--echo #
--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
--echo # returns nothing
--echo #
CREATE TABLE `ttt` (
`f1` char(3) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
'TTT';
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
DROP TABLE `ttt`;
--echo End of 5.0 tests.
......@@ -108,6 +108,23 @@ DROP PROCEDURE testproc;
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
--echo #
--echo # Bug #53613: mysql_upgrade incorrectly revokes
--echo # TRIGGER privilege on given table
--echo #
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
--echo Run mysql_upgrade with all privileges on a user
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
SHOW GRANTS FOR 'user3'@'%';
DROP USER 'user3'@'%';
--echo End of 5.1 tests
#
# Test the --upgrade-system-tables option
#
......
......@@ -69,7 +69,7 @@ ALTER TABLE tables_priv
COLLATE utf8_general_ci DEFAULT '' NOT NULL,
MODIFY Table_priv set('Select','Insert','Update','Delete','Create',
'Drop','Grant','References','Index','Alter',
'Create View','Show view')
'Create View','Show view','Trigger')
COLLATE utf8_general_ci DEFAULT '' NOT NULL,
COMMENT='Table privileges';
......@@ -603,8 +603,6 @@ ALTER TABLE host MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAU
ALTER TABLE db ADD Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE db MODIFY Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL;
UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0;
#
......
......@@ -2626,36 +2626,54 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
{
LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
bool rc= 0;
bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES));
switch (lex->sql_command) {
case SQLCOM_SHOW_DATABASES:
if (wild)
{
lookup_field_values->db_value.str= (char*) wild;
lookup_field_values->db_value.length= strlen(wild);
thd->make_lex_string(&lookup_field_values->db_value,
wild, strlen(wild), 0);
lookup_field_values->wild_db_value= 1;
}
return 0;
break;
case SQLCOM_SHOW_TABLES:
case SQLCOM_SHOW_TABLE_STATUS:
case SQLCOM_SHOW_TRIGGERS:
case SQLCOM_SHOW_EVENTS:
lookup_field_values->db_value.str= lex->select_lex.db;
lookup_field_values->db_value.length=strlen(lex->select_lex.db);
thd->make_lex_string(&lookup_field_values->db_value,
lex->select_lex.db, strlen(lex->select_lex.db), 0);
if (wild)
{
lookup_field_values->table_value.str= (char*)wild;
lookup_field_values->table_value.length= strlen(wild);
thd->make_lex_string(&lookup_field_values->table_value,
wild, strlen(wild), 0);
lookup_field_values->wild_table_value= 1;
}
return 0;
break;
default:
/*
The "default" is for queries over I_S.
All previous cases handle SHOW commands.
*/
return calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
rc= calc_lookup_values_from_cond(thd, cond, tables, lookup_field_values);
break;
}
if (lower_case_table_names && !rc)
{
/*
We can safely do in-place upgrades here since all of the above cases
are allocating a new memory buffer for these strings.
*/
if (lookup_field_values->db_value.str && lookup_field_values->db_value.str[0])
my_casedn_str(system_charset_info, lookup_field_values->db_value.str);
if (lookup_field_values->table_value.str &&
lookup_field_values->table_value.str[0])
my_casedn_str(system_charset_info, lookup_field_values->table_value.str);
}
return rc;
}
......@@ -3441,6 +3459,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
error= 0;
goto err;
}
DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
STR_OR_NIL(lookup_field_vals.db_value.str),
STR_OR_NIL(lookup_field_vals.table_value.str)));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment