Commit 952a778d authored by unknown's avatar unknown

Fix bad output in SHOW CREATE VIEW, update affected

test result.


mysql-test/r/view.result:
  Update test result to match sql_show.cc change.
sql/sql_show.cc:
  Fix bad output in SHOW CREATE VIEW.
parent 9af3278f
...@@ -55,7 +55,7 @@ Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`v1` ...@@ -55,7 +55,7 @@ Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`v1`
create algorithm=temptable view v2 (c) as select b+1 from t1; create algorithm=temptable view v2 (c) as select b+1 from t1;
show create table v2; show create table v2;
Table Create Table Table Create Table
v2 CREATE ALGORITHM=TMPTABLE VIEW `test`.`v2` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1` v2 CREATE ALGORITHM=TEMPTABLE VIEW `test`.`v2` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
select c from v2; select c from v2;
c c
3 3
...@@ -313,7 +313,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -313,7 +313,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
show create table mysqltest.v2; show create table mysqltest.v2;
Table Create Table Table Create Table
v2 CREATE ALGORITHM=TMPTABLE VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` v2 CREATE ALGORITHM=TEMPTABLE VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1`
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show create table mysqltest.v3; show create table mysqltest.v3;
...@@ -335,7 +335,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -335,7 +335,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
show create table mysqltest.v2; show create table mysqltest.v2;
Table Create Table Table Create Table
v2 CREATE ALGORITHM=TMPTABLE VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` v2 CREATE ALGORITHM=TEMPTABLE VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1`
explain select c from mysqltest.v3; explain select c from mysqltest.v3;
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 t2 system NULL NULL NULL NULL 0 const row not found 1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
...@@ -348,7 +348,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -348,7 +348,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
show create table mysqltest.v4; show create table mysqltest.v4;
Table Create Table Table Create Table
v4 CREATE ALGORITHM=TMPTABLE VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` v4 CREATE ALGORITHM=TEMPTABLE VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2`
revoke all privileges on mysqltest.* from mysqltest_1@localhost; revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user='mysqltest_1'; delete from mysql.user where user='mysqltest_1';
drop database mysqltest; drop database mysqltest;
......
...@@ -1601,7 +1601,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff) ...@@ -1601,7 +1601,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
{ {
buff->append("ALGORITHM=", 10); buff->append("ALGORITHM=", 10);
if (table->algorithm == VIEW_ALGORITHM_TMPTABLE) if (table->algorithm == VIEW_ALGORITHM_TMPTABLE)
buff->append("TMPTABLE ", 9); buff->append("TEMPTABLE ", 10);
else else
buff->append("MERGE ", 6); buff->append("MERGE ", 6);
} }
......
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