summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2005-08-05 11:01:29 +0200
committerunknown <andrey@lmy004.>2005-08-05 11:01:29 +0200
commit7c3f55ec9cbe9b5de71440717a89b6259664d3cf (patch)
tree09c895dc486451583056b0b082cdbc2391880f78
parent299a394d36cc9295096c37bd6c0c641047004058 (diff)
downloadmariadb-git-7c3f55ec9cbe9b5de71440717a89b6259664d3cf.tar.gz
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
-rw-r--r--mysql-test/r/information_schema.result50
-rw-r--r--mysql-test/r/information_schema_db.result20
-rw-r--r--sql/sql_show.cc44
-rw-r--r--sql/table.h25
4 files changed, 77 insertions, 62 deletions
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index e6a929d7e3e..5688d8c2145 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -33,22 +33,22 @@ create table mysqltest.t4(a int);
create view v1 (c) as select table_name from information_schema.TABLES;
select * from v1;
c
-SCHEMATA
-TABLES
-COLUMNS
CHARACTER_SETS
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
+COLUMNS
+COLUMN_PRIVILEGES
+KEY_COLUMN_USAGE
ROUTINES
-STATISTICS
-VIEWS
-USER_PRIVILEGES
+SCHEMATA
SCHEMA_PRIVILEGES
-TABLE_PRIVILEGES
-COLUMN_PRIVILEGES
+STATISTICS
+TABLES
TABLE_CONSTRAINTS
-KEY_COLUMN_USAGE
+TABLE_PRIVILEGES
TRIGGERS
+VIEWS
+USER_PRIVILEGES
columns_priv
db
func
@@ -76,8 +76,8 @@ inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
c table_name
TABLES TABLES
-TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
+TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS
tables_priv tables_priv
time_zone time_zone
@@ -94,8 +94,8 @@ left join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
c table_name
TABLES TABLES
-TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
+TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS
tables_priv tables_priv
time_zone time_zone
@@ -112,8 +112,8 @@ right join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
c table_name
TABLES TABLES
-TABLE_PRIVILEGES TABLE_PRIVILEGES
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
+TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS
tables_priv tables_priv
time_zone time_zone
@@ -577,13 +577,13 @@ select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
where table_schema='information_schema' limit 2;
TABLE_NAME TABLE_TYPE ENGINE
-SCHEMATA TEMPORARY MEMORY
-TABLES TEMPORARY MEMORY
+CHARACTER_SETS TEMPORARY MEMORY
+COLLATIONS TEMPORARY MEMORY
show tables from information_schema like "T%";
Tables_in_information_schema (T%)
TABLES
-TABLE_PRIVILEGES
TABLE_CONSTRAINTS
+TABLE_PRIVILEGES
TRIGGERS
create database information_schema;
ERROR HY000: Can't create database 'information_schema'; database exists
@@ -591,8 +591,8 @@ use information_schema;
show full tables like "T%";
Tables_in_information_schema (T%) Table_type
TABLES TEMPORARY
-TABLE_PRIVILEGES TEMPORARY
TABLE_CONSTRAINTS TEMPORARY
+TABLE_PRIVILEGES TEMPORARY
TRIGGERS TEMPORARY
create table t1(a int);
ERROR 42S02: Unknown table 't1' in information_schema
@@ -603,8 +603,8 @@ use information_schema;
show tables like "T%";
Tables_in_information_schema (T%)
TABLES
-TABLE_PRIVILEGES
TABLE_CONSTRAINTS
+TABLE_PRIVILEGES
TRIGGERS
select table_name from tables where table_name='user';
table_name
@@ -710,18 +710,18 @@ table_schema table_name column_name
information_schema COLUMNS COLUMN_TYPE
information_schema ROUTINES ROUTINE_DEFINITION
information_schema ROUTINES SQL_MODE
-information_schema VIEWS VIEW_DEFINITION
information_schema TRIGGERS ACTION_CONDITION
information_schema TRIGGERS ACTION_STATEMENT
information_schema TRIGGERS SQL_MODE
+information_schema VIEWS VIEW_DEFINITION
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
table_name column_name data_type
+ROUTINES CREATED datetime
+ROUTINES LAST_ALTERED datetime
TABLES CREATE_TIME datetime
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
-ROUTINES CREATED datetime
-ROUTINES LAST_ALTERED datetime
TRIGGERS CREATED datetime
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
WHERE NOT EXISTS
@@ -756,14 +756,14 @@ grant select on test.* to mysqltest_4@localhost;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME';
TABLE_NAME COLUMN_NAME PRIVILEGES
-TABLES 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
-TABLE_CONSTRAINTS 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.db where user='mysqltest_4';
flush privileges;
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index ece30924055..d3ff310b812 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -1,27 +1,27 @@
use INFORMATION_SCHEMA;
show tables;
Tables_in_information_schema
-SCHEMATA
-TABLES
-COLUMNS
CHARACTER_SETS
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
+COLUMNS
+COLUMN_PRIVILEGES
+KEY_COLUMN_USAGE
ROUTINES
-STATISTICS
-VIEWS
-USER_PRIVILEGES
+SCHEMATA
SCHEMA_PRIVILEGES
-TABLE_PRIVILEGES
-COLUMN_PRIVILEGES
+STATISTICS
+TABLES
TABLE_CONSTRAINTS
-KEY_COLUMN_USAGE
+TABLE_PRIVILEGES
TRIGGERS
+VIEWS
+USER_PRIVILEGES
show tables from INFORMATION_SCHEMA like 'T%';
Tables_in_information_schema (T%)
TABLES
-TABLE_PRIVILEGES
TABLE_CONSTRAINTS
+TABLE_PRIVILEGES
TRIGGERS
create database `inf%`;
use `inf%`;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 56272b4fdaf..e3c6fa14522 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3981,46 +3981,46 @@ ST_FIELD_INFO variables_fields_info[]=
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,
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, 0},
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
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, 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},
+ {"COLUMNS", columns_fields_info, create_schema_table,
+ get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0},
{"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
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,
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,
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,
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,
get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0},
{"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
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}
};
diff --git a/sql/table.h b/sql/table.h
index 13d44766804..22a35e29e87 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -278,11 +278,26 @@ typedef struct st_foreign_key_info
enum enum_schema_tables
{
- SCH_SCHEMATA= 0, SCH_TABLES, SCH_COLUMNS, SCH_CHARSETS, SCH_COLLATIONS,
- SCH_COLLATION_CHARACTER_SET_APPLICABILITY, SCH_PROCEDURES, SCH_STATISTICS,
- SCH_VIEWS, SCH_USER_PRIVILEGES, SCH_SCHEMA_PRIVILEGES, SCH_TABLE_PRIVILEGES,
- SCH_COLUMN_PRIVILEGES, SCH_TABLE_CONSTRAINTS, SCH_KEY_COLUMN_USAGE,
- SCH_TABLE_NAMES, SCH_OPEN_TABLES, SCH_STATUS, SCH_TRIGGERS, SCH_VARIABLES
+ SCH_CHARSETS= 0,
+ SCH_COLLATIONS,
+ SCH_COLLATION_CHARACTER_SET_APPLICABILITY,
+ SCH_COLUMNS,
+ 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
};