diff options
author | unknown <monty@mysql.com> | 2004-12-18 12:49:14 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-12-18 12:49:14 +0200 |
commit | 0b661d5505541ff7424ee8a83c5160ce6067e714 (patch) | |
tree | e0f20963673717d648ca1809a7665a6c7e1d264e | |
parent | 6dd846d8dd1dc18ba01cfdd493199540d365d24d (diff) | |
parent | a70ab6539d7444dad83f195fa3072744a0b65844 (diff) | |
download | mariadb-git-0b661d5505541ff7424ee8a83c5160ce6067e714.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/my/mysql-5.0
mysql-test/r/information_schema.result:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
-rw-r--r-- | mysql-test/r/information_schema.result | 24 | ||||
-rw-r--r-- | mysql-test/t/information_schema.test | 13 | ||||
-rw-r--r-- | sql/sql_parse.cc | 13 | ||||
-rw-r--r-- | sql/sql_show.cc | 36 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 3 | ||||
-rw-r--r-- | sql/table.h | 1 |
6 files changed, 67 insertions, 23 deletions
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index ea541c4d599..0bd3ba14636 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -49,7 +49,6 @@ TABLE_PRIVILEGES COLUMN_PRIVILEGES TABLE_CONSTRAINTS KEY_COLUMN_USAGE -TABLE_NAMES columns_priv db func @@ -78,7 +77,6 @@ c table_name TABLES TABLES TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_CONSTRAINTS TABLE_CONSTRAINTS -TABLE_NAMES TABLE_NAMES tables_priv tables_priv time_zone time_zone time_zone_leap_second time_zone_leap_second @@ -96,7 +94,6 @@ c table_name TABLES TABLES TABLE_PRIVILEGES TABLE_PRIVILEGES TABLE_CONSTRAINTS TABLE_CONSTRAINTS -TABLE_NAMES TABLE_NAMES tables_priv tables_priv time_zone time_zone time_zone_leap_second time_zone_leap_second @@ -577,7 +574,6 @@ Tables_in_information_schema (T%) Table_type TABLES TEMPORARY TABLE_PRIVILEGES TEMPORARY TABLE_CONSTRAINTS TEMPORARY -TABLE_NAMES TEMPORARY create table t1(a int); ERROR 42S02: Unknown table 't1' in information_schema use test; @@ -589,7 +585,23 @@ Tables_in_information_schema (T%) TABLES TABLE_PRIVILEGES TABLE_CONSTRAINTS -TABLE_NAMES +select table_name from tables where table_name='user'; +table_name +user +select column_name, privileges from columns +where table_name='user' and column_name like '%o%'; +column_name privileges +Host select,insert,update,references +Password select,insert,update,references +Drop_priv select,insert,update,references +Reload_priv select,insert,update,references +Shutdown_priv select,insert,update,references +Process_priv select,insert,update,references +Show_db_priv select,insert,update,references +Lock_tables_priv select,insert,update,references +Show_view_priv select,insert,update,references +max_questions select,insert,update,references +max_connections select,insert,update,references use test; create function sub1(i int) returns int return i+1; @@ -627,3 +639,5 @@ constraint_name drop view t2; drop view t3; drop table t4; +select * from information_schema.table_names; +ERROR 42S02: Unknown table 'table_names' in information_schema diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 0fe7636e500..f7d4cdd43b2 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -294,6 +294,13 @@ use information_schema; show tables like "T%"; # +# Bug#7210: information_schema: can't access when table-name = reserved word +# +select table_name from tables where table_name='user'; +select column_name, privileges from columns +where table_name='user' and column_name like '%o%'; + +# # Bug#7212: information_schema: "Can't find file" errors if storage engine gone # Bug#7211: information_schema: crash if bad view # @@ -318,3 +325,9 @@ where table_schema='test'; drop view t2; drop view t3; drop table t4; + +# +# Bug#7213: information_schema: redundant non-standard TABLE_NAMES table +# +--error 1109 +select * from information_schema.table_names; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9fc4cfacfd2..c076872b755 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1583,6 +1583,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, packet, (uint) (pend-packet), thd->charset()); table_list.alias= table_list.real_name= conv_name.str; packet= pend+1; + + if (!my_strcasecmp(system_charset_info, table_list.db, + information_schema_name.str)) + { + ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, table_list.alias); + if (schema_table) + table_list.schema_table= schema_table; + } + /* command not cachable => no gap for data base name */ if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1))) break; @@ -5265,7 +5274,9 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, information_schema_name.str)) { ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->real_name); - if (!schema_table) + if (!schema_table || + (schema_table->hidden && + lex->orig_sql_command == SQLCOM_END)) // not a 'show' command { my_error(ER_UNKNOWN_TABLE, MYF(0), ptr->real_name, information_schema_name.str); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 3023a7e869d..826bd2038f9 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1976,6 +1976,8 @@ int schema_tables_add(THD *thd, List<char> *files, const char *wild) ST_SCHEMA_TABLE *tmp_schema_table= schema_tables; for ( ; tmp_schema_table->table_name; tmp_schema_table++) { + if (tmp_schema_table->hidden) + continue; if (wild) { if (lower_case_table_names) @@ -3688,38 +3690,38 @@ ST_FIELD_INFO table_names_fields_info[]= ST_SCHEMA_TABLE schema_tables[]= { {"SCHEMATA", schema_fields_info, create_schema_table, - fill_schema_shemata, make_schemata_old_format, 0, 1, -1}, + fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0}, {"TABLES", tables_fields_info, create_schema_table, - get_all_tables, make_old_format, get_schema_tables_record, 1, 2}, + get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0}, {"COLUMNS", columns_fields_info, create_schema_table, - get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2}, + get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0}, {"CHARACTER_SETS", charsets_fields_info, create_schema_table, - fill_schema_charsets, make_character_sets_old_format, 0, -1, -1}, + fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0}, {"COLLATIONS", collation_fields_info, create_schema_table, - fill_schema_collation, make_old_format, 0, -1, -1}, + fill_schema_collation, make_old_format, 0, -1, -1, 0}, {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info, - create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1}, + create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0}, {"ROUTINES", proc_fields_info, create_schema_table, - fill_schema_proc, make_proc_old_format, 0, -1, -1}, + fill_schema_proc, make_proc_old_format, 0, -1, -1, 0}, {"STATISTICS", stat_fields_info, create_schema_table, - get_all_tables, make_old_format, get_schema_stat_record, 1, 2}, + get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0}, {"VIEWS", view_fields_info, create_schema_table, - get_all_tables, 0, get_schema_views_record, 1, 2}, + get_all_tables, 0, get_schema_views_record, 1, 2, 0}, {"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table, - fill_schema_user_privileges, 0, 0, -1, -1}, + fill_schema_user_privileges, 0, 0, -1, -1, 0}, {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table, - fill_schema_schema_privileges, 0, 0, -1, -1}, + fill_schema_schema_privileges, 0, 0, -1, -1, 0}, {"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table, - fill_schema_table_privileges, 0, 0, -1, -1}, + fill_schema_table_privileges, 0, 0, -1, -1, 0}, {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table, - fill_schema_column_privileges, 0, 0, -1, -1}, + fill_schema_column_privileges, 0, 0, -1, -1, 0}, {"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table, - get_all_tables, 0, get_schema_constraints_record, 3, 4}, + get_all_tables, 0, get_schema_constraints_record, 3, 4, 0}, {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table, - get_all_tables, 0, get_schema_key_column_usage_record, 4, 5}, + get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0}, {"TABLE_NAMES", table_names_fields_info, create_schema_table, - get_all_tables, make_table_names_old_format, 0, 1, 2}, - {0, 0, 0, 0, 0, 0, 0, 0} + get_all_tables, make_table_names_old_format, 0, 1, 2, 1}, + {0, 0, 0, 0, 0, 0, 0, 0, 0} }; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 55a0f6ff692..98966374f2a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6885,6 +6885,7 @@ keyword: | CLIENT_SYM {} | CLOSE_SYM {} | COLLATION_SYM {} + | COLUMNS {} | COMMENT_SYM {} | COMMITTED_SYM {} | COMMIT_SYM {} @@ -7006,6 +7007,7 @@ keyword: | POLYGON {} | PREPARE_SYM {} | PREV_SYM {} + | PRIVILEGES {} | PROCESS {} | PROCESSLIST_SYM {} | QUARTER_SYM {} @@ -7057,6 +7059,7 @@ keyword: | SUBDATE_SYM {} | SUBJECT_SYM {} | SUPER_SYM {} + | TABLES {} | TABLESPACE {} | TEMPORARY {} | TEMPTABLE_SYM {} diff --git a/sql/table.h b/sql/table.h index f5f2a76c6f1..a804376ee3c 100644 --- a/sql/table.h +++ b/sql/table.h @@ -254,6 +254,7 @@ typedef struct st_schema_table TABLE *table, bool res, const char *base_name, const char *file_name); int idx_field1, idx_field2; + bool hidden; } ST_SCHEMA_TABLE; |