Commit 7269388d authored by gluh@gluh.mysql.r18.ru's avatar gluh@gluh.mysql.r18.ru

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.0

into gluh.mysql.r18.ru:/home/gluh/MySQL/mysql-5.0.1
parents f92dac8d a67b4a5b
...@@ -252,7 +252,7 @@ sel2 sel2 ...@@ -252,7 +252,7 @@ sel2 sel2
select count(*) from information_schema.ROUTINES; select count(*) from information_schema.ROUTINES;
count(*) count(*)
2 2
create view v0 (c) as select schema_name from information_schema.SCHEMATA; create view v0 (c) as select schema_name from information_schema.schemata;
select * from v0; select * from v0;
c c
mysql mysql
...@@ -260,22 +260,22 @@ test ...@@ -260,22 +260,22 @@ test
explain select * from v0; explain select * from v0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY # ALL NULL NULL NULL NULL 2 1 PRIMARY # ALL NULL NULL NULL NULL 2
create view v1 (c) as select table_name from information_schema.TABLES create view v1 (c) as select table_name from information_schema.tables
where table_name="v1"; where table_name="v1";
select * from v1; select * from v1;
c c
v1 v1
create view v2 (c) as select column_name from information_schema.COLUMNS create view v2 (c) as select column_name from information_schema.columns
where table_name="v2"; where table_name="v2";
select * from v2; select * from v2;
c c
c c
create view v3 (c) as select CHARACTER_SET_NAME from information_schema.CHARACTER_SETS create view v3 (c) as select CHARACTER_SET_NAME from information_schema.character_sets
where CHARACTER_SET_NAME like "latin1%"; where CHARACTER_SET_NAME like "latin1%";
select * from v3; select * from v3;
c c
latin1 latin1
create view v4 (c) as select COLLATION_NAME from information_schema.COLLATIONS create view v4 (c) as select COLLATION_NAME from information_schema.collations
where COLLATION_NAME like "latin1%"; where COLLATION_NAME like "latin1%";
select * from v4; select * from v4;
c c
...@@ -289,13 +289,13 @@ latin1_general_cs ...@@ -289,13 +289,13 @@ latin1_general_cs
latin1_spanish_ci latin1_spanish_ci
show keys from v4; show keys from v4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
select * from information_schema.VIEWS where TABLE_NAME like "v%"; select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE
NULL test v0 select `SCHEMATA`.`SCHEMA_NAME` AS `c` from `information_schema`.`SCHEMATA` NONE NO NULL test v0 select `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO
NULL test v1 select `TABLES`.`TABLE_NAME` AS `c` from `information_schema`.`TABLES` where (`TABLES`.`TABLE_NAME` = _utf8'v1') NONE NO NULL test v1 select `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO
NULL test v2 select `COLUMNS`.`COLUMN_NAME` AS `c` from `information_schema`.`COLUMNS` where (`COLUMNS`.`TABLE_NAME` = _utf8'v2') NONE NO NULL test v2 select `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO
NULL test v3 select `CHARACTER_SETS`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`CHARACTER_SETS` where (`CHARACTER_SETS`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO NULL test v3 select `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO
NULL test v4 select `COLLATIONS`.`COLLATION_NAME` AS `c` from `information_schema`.`COLLATIONS` where (`COLLATIONS`.`COLLATION_NAME` like _utf8'latin1%') NONE NO NULL test v4 select `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO
drop view v0, v1, v2, v3, v4; drop view v0, v1, v2, v3, v4;
create table t1 (a int); create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost; grant select,update,insert on t1 to mysqltest_1@localhost;
...@@ -434,18 +434,18 @@ information_schema.tables; ...@@ -434,18 +434,18 @@ information_schema.tables;
s1 s1
9 9
drop table t1; drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` char(30) NOT NULL default '', `CHARACTER_SET_NAME` char(30) NOT NULL default '',
`DESCRIPTION` char(60) NOT NULL default '', `DESCRIPTION` char(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '', `DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0' `MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2282 ) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2282
set names latin2; set names latin2;
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table Table Create Table
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` ( character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` char(30) NOT NULL default '', `CHARACTER_SET_NAME` char(30) NOT NULL default '',
`DESCRIPTION` char(60) NOT NULL default '', `DESCRIPTION` char(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '', `DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
...@@ -517,3 +517,19 @@ from information_schema.columns; open c; open c; end;// ...@@ -517,3 +517,19 @@ from information_schema.columns; open c; open c; end;//
call p108()// call p108()//
ERROR 24000: Cursor is already open ERROR 24000: Cursor is already open
drop procedure p108; drop procedure p108;
create view v1 as select A1.table_name from information_schema.TABLES A1
where table_name= "user";
select * from v1;
table_name
user
drop view v1;
create view vo as select 'a' union select 'a';
show index from vo;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
select * from information_schema.TABLE_CONSTRAINTS where
TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_METHOD
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
drop view vo;
...@@ -110,24 +110,24 @@ select count(*) from information_schema.ROUTINES; ...@@ -110,24 +110,24 @@ select count(*) from information_schema.ROUTINES;
# #
# Test for views # Test for views
# #
create view v0 (c) as select schema_name from information_schema.SCHEMATA; create view v0 (c) as select schema_name from information_schema.schemata;
select * from v0; select * from v0;
--replace_column 3 # --replace_column 3 #
explain select * from v0; explain select * from v0;
create view v1 (c) as select table_name from information_schema.TABLES create view v1 (c) as select table_name from information_schema.tables
where table_name="v1"; where table_name="v1";
select * from v1; select * from v1;
create view v2 (c) as select column_name from information_schema.COLUMNS create view v2 (c) as select column_name from information_schema.columns
where table_name="v2"; where table_name="v2";
select * from v2; select * from v2;
create view v3 (c) as select CHARACTER_SET_NAME from information_schema.CHARACTER_SETS create view v3 (c) as select CHARACTER_SET_NAME from information_schema.character_sets
where CHARACTER_SET_NAME like "latin1%"; where CHARACTER_SET_NAME like "latin1%";
select * from v3; select * from v3;
create view v4 (c) as select COLLATION_NAME from information_schema.COLLATIONS create view v4 (c) as select COLLATION_NAME from information_schema.collations
where COLLATION_NAME like "latin1%"; where COLLATION_NAME like "latin1%";
select * from v4; select * from v4;
show keys from v4; show keys from v4;
select * from information_schema.VIEWS where TABLE_NAME like "v%"; select * from information_schema.views where TABLE_NAME like "v%";
drop view v0, v1, v2, v3, v4; drop view v0, v1, v2, v3, v4;
# #
...@@ -222,9 +222,9 @@ information_schema.tables) union select version from ...@@ -222,9 +222,9 @@ information_schema.tables) union select version from
information_schema.tables; information_schema.tables;
drop table t1; drop table t1;
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
set names latin2; set names latin2;
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
set names latin1; set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS create table t1 select * from information_schema.CHARACTER_SETS
...@@ -260,3 +260,16 @@ from information_schema.columns; open c; open c; end;// ...@@ -260,3 +260,16 @@ from information_schema.columns; open c; open c; end;//
call p108()// call p108()//
delimiter ;// delimiter ;//
drop procedure p108; drop procedure p108;
create view v1 as select A1.table_name from information_schema.TABLES A1
where table_name= "user";
select * from v1;
drop view v1;
create view vo as select 'a' union select 'a';
show index from vo;
select * from information_schema.TABLE_CONSTRAINTS where
TABLE_NAME= "vo";
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
drop view vo;
...@@ -2628,7 +2628,7 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables, ...@@ -2628,7 +2628,7 @@ static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
{ {
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_stat_record"); DBUG_ENTER("get_schema_stat_record");
if (!res) if (!res && !tables->view)
{ {
TABLE *show_table= tables->table; TABLE *show_table= tables->table;
KEY *key_info=show_table->key_info; KEY *key_info=show_table->key_info;
...@@ -2737,7 +2737,7 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables, ...@@ -2737,7 +2737,7 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
{ {
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_constarints_record"); DBUG_ENTER("get_schema_constarints_record");
if (!res) if (!res && !tables->view)
{ {
List<FOREIGN_KEY_INFO> f_key_list; List<FOREIGN_KEY_INFO> f_key_list;
TABLE *show_table= tables->table; TABLE *show_table= tables->table;
...@@ -2792,7 +2792,7 @@ static int get_schema_key_column_usage_record(THD *thd, ...@@ -2792,7 +2792,7 @@ static int get_schema_key_column_usage_record(THD *thd,
{ {
DBUG_ENTER("get_schema_key_column_usage_record"); DBUG_ENTER("get_schema_key_column_usage_record");
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
if (!res) if (!res && !tables->view)
{ {
List<FOREIGN_KEY_INFO> f_key_list; List<FOREIGN_KEY_INFO> f_key_list;
TABLE *show_table= tables->table; TABLE *show_table= tables->table;
...@@ -2960,7 +2960,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) ...@@ -2960,7 +2960,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
field_list, (ORDER*) 0, 0, 0, field_list, (ORDER*) 0, 0, 0,
(select_lex->options | thd->options | (select_lex->options | thd->options |
TMP_TABLE_ALL_COLUMNS), TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR, table_list->real_name))) HA_POS_ERROR, table_list->alias)))
DBUG_RETURN(0); DBUG_RETURN(0);
DBUG_RETURN(table); DBUG_RETURN(table);
} }
...@@ -3136,6 +3136,9 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) ...@@ -3136,6 +3136,9 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
} }
table->tmp_table= TMP_TABLE; table->tmp_table= TMP_TABLE;
table->grant.privilege= SELECT_ACL; table->grant.privilege= SELECT_ACL;
table->alias_name_used= my_strcasecmp(table_alias_charset,
table_list->real_name,
table_list->alias);
table_list->schema_table_name= table_list->real_name; table_list->schema_table_name= table_list->real_name;
table_list->real_name= table->real_name; table_list->real_name= table->real_name;
table_list->table= table; table_list->table= table;
......
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