Commit 7c3f55ec authored by unknown's avatar unknown

fix for bug #12315 - SHOW TABLE STATUS FROM `information_schema`; does not sort tablenames


mysql-test/r/information_schema.result:
  fix the test case for fix for bug #12315 - SHOW TABLE STATUS FROM `information_schema`; does not sort tablenames
mysql-test/r/information_schema_db.result:
  fix the test case for fix for bug #12315 - SHOW TABLE STATUS FROM `information_schema`; does not sort tablenames
sql/sql_show.cc:
  reorder the structure
  fix for bug #12315 - SHOW TABLE STATUS FROM `information_schema`; does not sort tablenames
sql/table.h:
  reorder the enum
  fix for bug #12315 - SHOW TABLE STATUS FROM `information_schema`; does not sort tablenames
parent 299a394d
...@@ -33,22 +33,22 @@ create table mysqltest.t4(a int); ...@@ -33,22 +33,22 @@ create table mysqltest.t4(a int);
create view v1 (c) as select table_name from information_schema.TABLES; create view v1 (c) as select table_name from information_schema.TABLES;
select * from v1; select * from v1;
c c
SCHEMATA
TABLES
COLUMNS
CHARACTER_SETS CHARACTER_SETS
COLLATIONS COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
KEY_COLUMN_USAGE
ROUTINES ROUTINES
STATISTICS SCHEMATA
VIEWS
USER_PRIVILEGES
SCHEMA_PRIVILEGES SCHEMA_PRIVILEGES
TABLE_PRIVILEGES STATISTICS
COLUMN_PRIVILEGES TABLES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
KEY_COLUMN_USAGE TABLE_PRIVILEGES
TRIGGERS TRIGGERS
VIEWS
USER_PRIVILEGES
columns_priv columns_priv
db db
func func
...@@ -76,8 +76,8 @@ inner join information_schema.TABLES v2 on (v1.c=v2.table_name) ...@@ -76,8 +76,8 @@ inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%"; where v1.c like "t%";
c table_name c table_name
TABLES TABLES TABLES TABLES
TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS TRIGGERS TRIGGERS
tables_priv tables_priv tables_priv tables_priv
time_zone time_zone time_zone time_zone
...@@ -94,8 +94,8 @@ left join information_schema.TABLES v2 on (v1.c=v2.table_name) ...@@ -94,8 +94,8 @@ left join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%"; where v1.c like "t%";
c table_name c table_name
TABLES TABLES TABLES TABLES
TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS TRIGGERS TRIGGERS
tables_priv tables_priv tables_priv tables_priv
time_zone time_zone time_zone time_zone
...@@ -112,8 +112,8 @@ right join information_schema.TABLES v2 on (v1.c=v2.table_name) ...@@ -112,8 +112,8 @@ right join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%"; where v1.c like "t%";
c table_name c table_name
TABLES TABLES TABLES TABLES
TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS TRIGGERS TRIGGERS
tables_priv tables_priv tables_priv tables_priv
time_zone time_zone time_zone time_zone
...@@ -577,13 +577,13 @@ select TABLE_NAME,TABLE_TYPE,ENGINE ...@@ -577,13 +577,13 @@ select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables from information_schema.tables
where table_schema='information_schema' limit 2; where table_schema='information_schema' limit 2;
TABLE_NAME TABLE_TYPE ENGINE TABLE_NAME TABLE_TYPE ENGINE
SCHEMATA TEMPORARY MEMORY CHARACTER_SETS TEMPORARY MEMORY
TABLES TEMPORARY MEMORY COLLATIONS TEMPORARY MEMORY
show tables from information_schema like "T%"; show tables from information_schema like "T%";
Tables_in_information_schema (T%) Tables_in_information_schema (T%)
TABLES TABLES
TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TRIGGERS TRIGGERS
create database information_schema; create database information_schema;
ERROR HY000: Can't create database 'information_schema'; database exists ERROR HY000: Can't create database 'information_schema'; database exists
...@@ -591,8 +591,8 @@ use information_schema; ...@@ -591,8 +591,8 @@ use information_schema;
show full tables like "T%"; show full tables like "T%";
Tables_in_information_schema (T%) Table_type Tables_in_information_schema (T%) Table_type
TABLES TEMPORARY TABLES TEMPORARY
TABLE_PRIVILEGES TEMPORARY
TABLE_CONSTRAINTS TEMPORARY TABLE_CONSTRAINTS TEMPORARY
TABLE_PRIVILEGES TEMPORARY
TRIGGERS TEMPORARY TRIGGERS TEMPORARY
create table t1(a int); create table t1(a int);
ERROR 42S02: Unknown table 't1' in information_schema ERROR 42S02: Unknown table 't1' in information_schema
...@@ -603,8 +603,8 @@ use information_schema; ...@@ -603,8 +603,8 @@ use information_schema;
show tables like "T%"; show tables like "T%";
Tables_in_information_schema (T%) Tables_in_information_schema (T%)
TABLES TABLES
TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TRIGGERS TRIGGERS
select table_name from tables where table_name='user'; select table_name from tables where table_name='user';
table_name table_name
...@@ -710,18 +710,18 @@ table_schema table_name column_name ...@@ -710,18 +710,18 @@ table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE information_schema COLUMNS COLUMN_TYPE
information_schema ROUTINES ROUTINE_DEFINITION information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE information_schema ROUTINES SQL_MODE
information_schema VIEWS VIEW_DEFINITION
information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT information_schema TRIGGERS ACTION_STATEMENT
information_schema TRIGGERS SQL_MODE information_schema TRIGGERS SQL_MODE
information_schema VIEWS VIEW_DEFINITION
select table_name, column_name, data_type from information_schema.columns select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime'; where data_type = 'datetime';
table_name column_name data_type table_name column_name data_type
ROUTINES CREATED datetime
ROUTINES LAST_ALTERED datetime
TABLES CREATE_TIME datetime TABLES CREATE_TIME datetime
TABLES UPDATE_TIME datetime TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime TABLES CHECK_TIME datetime
ROUTINES CREATED datetime
ROUTINES LAST_ALTERED datetime
TRIGGERS CREATED datetime TRIGGERS CREATED datetime
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
WHERE NOT EXISTS WHERE NOT EXISTS
...@@ -756,14 +756,14 @@ grant select on test.* to mysqltest_4@localhost; ...@@ -756,14 +756,14 @@ grant select on test.* to mysqltest_4@localhost;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME'; where COLUMN_NAME='TABLE_NAME';
TABLE_NAME COLUMN_NAME PRIVILEGES TABLE_NAME COLUMN_NAME PRIVILEGES
TABLES TABLE_NAME select
COLUMNS TABLE_NAME select COLUMNS TABLE_NAME select
STATISTICS TABLE_NAME select
VIEWS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select
COLUMN_PRIVILEGES TABLE_NAME select COLUMN_PRIVILEGES TABLE_NAME select
TABLE_CONSTRAINTS TABLE_NAME select
KEY_COLUMN_USAGE TABLE_NAME select KEY_COLUMN_USAGE TABLE_NAME select
STATISTICS TABLE_NAME select
TABLES TABLE_NAME select
TABLE_CONSTRAINTS TABLE_NAME select
TABLE_PRIVILEGES TABLE_NAME select
VIEWS TABLE_NAME select
delete from mysql.user where user='mysqltest_4'; delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4';
flush privileges; flush privileges;
......
use INFORMATION_SCHEMA; use INFORMATION_SCHEMA;
show tables; show tables;
Tables_in_information_schema Tables_in_information_schema
SCHEMATA
TABLES
COLUMNS
CHARACTER_SETS CHARACTER_SETS
COLLATIONS COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
KEY_COLUMN_USAGE
ROUTINES ROUTINES
STATISTICS SCHEMATA
VIEWS
USER_PRIVILEGES
SCHEMA_PRIVILEGES SCHEMA_PRIVILEGES
TABLE_PRIVILEGES STATISTICS
COLUMN_PRIVILEGES TABLES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
KEY_COLUMN_USAGE TABLE_PRIVILEGES
TRIGGERS TRIGGERS
VIEWS
USER_PRIVILEGES
show tables from INFORMATION_SCHEMA like 'T%'; show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_information_schema (T%) Tables_in_information_schema (T%)
TABLES TABLES
TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TRIGGERS TRIGGERS
create database `inf%`; create database `inf%`;
use `inf%`; use `inf%`;
......
...@@ -3981,46 +3981,46 @@ ST_FIELD_INFO variables_fields_info[]= ...@@ -3981,46 +3981,46 @@ ST_FIELD_INFO variables_fields_info[]=
ST_SCHEMA_TABLE schema_tables[]= ST_SCHEMA_TABLE schema_tables[]=
{ {
{"SCHEMATA", schema_fields_info, create_schema_table,
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, 0},
{"COLUMNS", columns_fields_info, create_schema_table,
get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0},
{"CHARACTER_SETS", charsets_fields_info, create_schema_table, {"CHARACTER_SETS", charsets_fields_info, create_schema_table,
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0}, fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0},
{"COLLATIONS", collation_fields_info, create_schema_table, {"COLLATIONS", collation_fields_info, create_schema_table,
fill_schema_collation, make_old_format, 0, -1, -1, 0}, fill_schema_collation, make_old_format, 0, -1, -1, 0},
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info, {"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0}, create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0},
{"ROUTINES", proc_fields_info, create_schema_table, {"COLUMNS", columns_fields_info, create_schema_table,
fill_schema_proc, make_proc_old_format, 0, -1, -1, 0}, get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0},
{"STATISTICS", stat_fields_info, create_schema_table,
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, 0},
{"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table,
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, 0},
{"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
fill_schema_table_privileges, 0, 0, -1, -1, 0},
{"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table, {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
fill_schema_column_privileges, 0, 0, -1, -1, 0}, 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, 0},
{"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table, {"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0}, 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, 1},
{"OPEN_TABLES", open_tables_fields_info, create_schema_table, {"OPEN_TABLES", open_tables_fields_info, create_schema_table,
fill_open_tables, make_old_format, 0, -1, -1, 1}, fill_open_tables, make_old_format, 0, -1, -1, 1},
{"ROUTINES", proc_fields_info, create_schema_table,
fill_schema_proc, make_proc_old_format, 0, -1, -1, 0},
{"SCHEMATA", schema_fields_info, create_schema_table,
fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0},
{"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
fill_schema_schema_privileges, 0, 0, -1, -1, 0},
{"STATISTICS", stat_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0},
{"STATUS", variables_fields_info, create_schema_table, fill_status, {"STATUS", variables_fields_info, create_schema_table, fill_status,
make_old_format, 0, -1, -1, 1}, make_old_format, 0, -1, -1, 1},
{"TABLES", tables_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0},
{"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
get_all_tables, 0, get_schema_constraints_record, 3, 4, 0},
{"TABLE_NAMES", table_names_fields_info, create_schema_table,
get_all_tables, make_table_names_old_format, 0, 1, 2, 1},
{"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
fill_schema_table_privileges, 0, 0, -1, -1, 0},
{"TRIGGERS", triggers_fields_info, create_schema_table, {"TRIGGERS", triggers_fields_info, create_schema_table,
get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0}, get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0},
{"VARIABLES", variables_fields_info, create_schema_table, fill_variables, {"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
make_old_format, 0, -1, -1, 1}, make_old_format, 0, -1, -1, 1},
{"VIEWS", view_fields_info, create_schema_table,
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, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0}
}; };
......
...@@ -278,11 +278,26 @@ typedef struct st_foreign_key_info ...@@ -278,11 +278,26 @@ typedef struct st_foreign_key_info
enum enum_schema_tables enum enum_schema_tables
{ {
SCH_SCHEMATA= 0, SCH_TABLES, SCH_COLUMNS, SCH_CHARSETS, SCH_COLLATIONS, SCH_CHARSETS= 0,
SCH_COLLATION_CHARACTER_SET_APPLICABILITY, SCH_PROCEDURES, SCH_STATISTICS, SCH_COLLATIONS,
SCH_VIEWS, SCH_USER_PRIVILEGES, SCH_SCHEMA_PRIVILEGES, SCH_TABLE_PRIVILEGES, SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
SCH_COLUMN_PRIVILEGES, SCH_TABLE_CONSTRAINTS, SCH_KEY_COLUMN_USAGE, SCH_COLUMNS,
SCH_TABLE_NAMES, SCH_OPEN_TABLES, SCH_STATUS, SCH_TRIGGERS, SCH_VARIABLES SCH_COLUMN_PRIVILEGES,
SCH_KEY_COLUMN_USAGE,
SCH_OPEN_TABLES,
SCH_PROCEDURES,
SCH_SCHEMATA,
SCH_SCHEMA_PRIVILEGES,
SCH_STATISTICS,
SCH_STATUS,
SCH_TABLES,
SCH_TABLE_CONSTRAINTS,
SCH_TABLE_NAMES,
SCH_TABLE_PRIVILEGES,
SCH_TRIGGERS,
SCH_VARIABLES,
SCH_VIEWS,
SCH_USER_PRIVILEGES
}; };
......
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