Commit 42002d5d authored by unknown's avatar unknown

Report 'SYSTEM VIEW' as table_type of INFORMATION_SCHEMA views. (Bug #11711)


mysql-test/r/information_schema.result:
  Update results
sql/sql_show.cc:
  Show 'SYSTEM VIEW' for table_type of views in INFORMATION_SCHEMA.
sql/table.h:
  Add SYSTEM_TMP_TABLE to tmp_table_type enum, for internal temporary
  "tables" like INFORMATION_SCHEMA views.
parent b7ab9300
...@@ -577,8 +577,8 @@ select TABLE_NAME,TABLE_TYPE,ENGINE ...@@ -577,8 +577,8 @@ 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 SCHEMATA SYSTEM VIEW MEMORY
TABLES TEMPORARY MEMORY TABLES SYSTEM VIEW 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
...@@ -590,10 +590,10 @@ ERROR HY000: Can't create database 'information_schema'; database exists ...@@ -590,10 +590,10 @@ ERROR HY000: Can't create database 'information_schema'; database exists
use information_schema; 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 SYSTEM VIEW
TABLE_PRIVILEGES TEMPORARY TABLE_PRIVILEGES SYSTEM VIEW
TABLE_CONSTRAINTS TEMPORARY TABLE_CONSTRAINTS SYSTEM VIEW
TRIGGERS TEMPORARY TRIGGERS SYSTEM VIEW
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
use test; use test;
......
...@@ -2034,7 +2034,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2034,7 +2034,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
if (with_i_schema) if (with_i_schema)
{ {
table->field[3]->store("TEMPORARY", 9, system_charset_info); table->field[3]->store("SYSTEM VIEW", 11, system_charset_info);
} }
else else
{ {
...@@ -2193,7 +2193,9 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables, ...@@ -2193,7 +2193,9 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
handler *file= show_table->file; handler *file= show_table->file;
file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK); file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);
if (share->tmp_table == TMP_TABLE) if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store("SYSTEM VIEW", 11, cs);
else if (share->tmp_table)
table->field[3]->store("TEMPORARY", 9, cs); table->field[3]->store("TEMPORARY", 9, cs);
else else
table->field[3]->store("BASE TABLE", 10, cs); table->field[3]->store("BASE TABLE", 10, cs);
...@@ -3532,7 +3534,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) ...@@ -3532,7 +3534,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
{ {
DBUG_RETURN(1); DBUG_RETURN(1);
} }
table->s->tmp_table= TMP_TABLE; table->s->tmp_table= SYSTEM_TMP_TABLE;
table->grant.privilege= SELECT_ACL; table->grant.privilege= SELECT_ACL;
/* /*
This test is necessary to make This test is necessary to make
......
...@@ -49,7 +49,8 @@ typedef struct st_grant_info ...@@ -49,7 +49,8 @@ typedef struct st_grant_info
ulong want_privilege; ulong want_privilege;
} GRANT_INFO; } GRANT_INFO;
enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2}; enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2,
SYSTEM_TMP_TABLE=3};
enum frm_type_enum enum frm_type_enum
{ {
......
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