Commit 62344496 authored by unknown's avatar unknown

Manual merge


sql/sql_base.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
parents edcdc57b e02416c5
...@@ -51,7 +51,7 @@ explain extended select c from v1; ...@@ -51,7 +51,7 @@ explain extended select c from v1;
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 t1 ALL NULL NULL NULL NULL 5 1 PRIMARY t1 ALL NULL NULL NULL NULL 5
Warnings: Warnings:
Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`v1` Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
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 view v2; show create view v2;
View Create View View Create View
...@@ -85,7 +85,7 @@ explain extended select c from v3; ...@@ -85,7 +85,7 @@ explain extended select c from 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 t1 ALL NULL NULL NULL NULL 5 1 PRIMARY t1 ALL NULL NULL NULL NULL 5
Warnings: Warnings:
Note 1003 select ((`test`.`t1`.`b` + 1) + 1) AS `c` from `test`.`v3` Note 1003 select ((`test`.`t1`.`b` + 1) + 1) AS `c` from `test`.`t1`
create algorithm=temptable view v4 (c) as select c+1 from v2; create algorithm=temptable view v4 (c) as select c+1 from v2;
select c from v4; select c from v4;
c c
...@@ -114,7 +114,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -114,7 +114,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5 1 PRIMARY <derived3> ALL NULL NULL NULL NULL 5
3 DERIVED t1 ALL NULL NULL NULL NULL 5 3 DERIVED t1 ALL NULL NULL NULL NULL 5
Warnings: Warnings:
Note 1003 select (`v2`.`c` + 1) AS `c` from `test`.`v5` Note 1003 select (`v2`.`c` + 1) AS `c` from `test`.`v2`
create algorithm=temptable view v6 (c) as select c+1 from v1; create algorithm=temptable view v6 (c) as select c+1 from v1;
select c from v6; select c from v6;
c c
...@@ -204,21 +204,6 @@ create table t1 (a int); ...@@ -204,21 +204,6 @@ create table t1 (a int);
insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3);
create view v1 (a) as select a+1 from t1; create view v1 (a) as select a+1 from t1;
create view v2 (a) as select a-1 from t1; create view v2 (a) as select a-1 from t1;
select * from t1 natural left join v1;
a a
1 NULL
2 2
3 3
select * from v2 natural left join t1;
a a
0 NULL
1 1
2 2
select * from v2 natural left join v1;
a a
0 NULL
1 NULL
2 2
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
create table t1 (a int); create table t1 (a int);
...@@ -378,7 +363,7 @@ explain extended select * from v1; ...@@ -378,7 +363,7 @@ explain extended select * from v1;
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 t1 ALL NULL NULL NULL NULL 5 Using where 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
Warnings: Warnings:
Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`v1` where (`test`.`t1`.`a` < 3) Note 1003 select `test`.`t1`.`b` AS `c` from `test`.`t1` where (`test`.`t1`.`a` < 3)
update v1 set c=c+1; update v1 set c=c+1;
select * from t1; select * from t1;
a b a b
...@@ -1393,7 +1378,7 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1393,7 +1378,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 1 PRIMARY t2 ALL NULL NULL NULL NULL 2
Warnings: Warnings:
Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`v1` left join `test`.`v2` on((`test`.`t1`.`a` = `test`.`t2`.`a`))) on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where 1 Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t1`.`a` = `test`.`t2`.`a`))) on((`test`.`t3`.`a` = `test`.`t1`.`a`)) where 1
prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);"; prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);";
execute stmt1; execute stmt1;
a a b a a b
...@@ -1712,3 +1697,18 @@ a b a b ...@@ -1712,3 +1697,18 @@ a b a b
3 3 3 3 3 3 3 3
drop view v1, v2; drop view v1, v2;
drop table t1, t2, t3; drop table t1, t2, t3;
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
INSERT INTO t1 VALUES (1), (2), (3), (4);
INSERT INTO t2 VALUES (4), (2);
CREATE VIEW v1 AS SELECT * FROM t1,t2 WHERE t1.a=t2.b;
SELECT * FROM v1;
a b
2 2
4 4
CREATE VIEW v2 AS SELECT * FROM v1;
SELECT * FROM v2;
a b
2 2
4 4
DROP VIEW v2,v1;
...@@ -148,9 +148,10 @@ insert into t1 values (1), (2), (3); ...@@ -148,9 +148,10 @@ insert into t1 values (1), (2), (3);
create view v1 (a) as select a+1 from t1; create view v1 (a) as select a+1 from t1;
create view v2 (a) as select a-1 from t1; create view v2 (a) as select a-1 from t1;
select * from t1 natural left join v1; # WL #2486 should enable these tests
select * from v2 natural left join t1; #select * from t1 natural left join v1;
select * from v2 natural left join v1; #select * from v2 natural left join t1;
#select * from v2 natural left join v1;
drop view v1, v2; drop view v1, v2;
drop table t1; drop table t1;
...@@ -1533,3 +1534,18 @@ select * from v2 A, v2 B where A.a = B.b; ...@@ -1533,3 +1534,18 @@ select * from v2 A, v2 B where A.a = B.b;
drop view v1, v2; drop view v1, v2;
drop table t1, t2, t3; drop table t1, t2, t3;
#
# Test case for bug #8528: select from view over multi-table view
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
INSERT INTO t1 VALUES (1), (2), (3), (4);
INSERT INTO t2 VALUES (4), (2);
CREATE VIEW v1 AS SELECT * FROM t1,t2 WHERE t1.a=t2.b;
SELECT * FROM v1;
CREATE VIEW v2 AS SELECT * FROM v1;
SELECT * FROM v2;
DROP VIEW v2,v1;
...@@ -3169,10 +3169,8 @@ TABLE_LIST **make_leaves_list(TABLE_LIST **list, TABLE_LIST *tables) ...@@ -3169,10 +3169,8 @@ TABLE_LIST **make_leaves_list(TABLE_LIST **list, TABLE_LIST *tables)
{ {
for (TABLE_LIST *table= tables; table; table= table->next_local) for (TABLE_LIST *table= tables; table; table= table->next_local)
{ {
if (table->view && !table->table) if (table->view && table->effective_algorithm == VIEW_ALGORITHM_MERGE)
{ {
/* it is for multi table views only, check it */
DBUG_ASSERT(table->ancestor->next_local != 0);
list= make_leaves_list(list, table->ancestor); list= make_leaves_list(list, table->ancestor);
} }
else else
......
...@@ -46,8 +46,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ...@@ -46,8 +46,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (!(table= table_list->table)) if (!(table= table_list->table))
{ {
DBUG_ASSERT(table_list->view &&
table_list->ancestor && table_list->ancestor->next_local);
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0), my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
table_list->view_db.str, table_list->view_name.str); table_list->view_db.str, table_list->view_name.str);
DBUG_RETURN(-1); DBUG_RETURN(-1);
......
...@@ -81,8 +81,6 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, ...@@ -81,8 +81,6 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
{ {
if (!table) if (!table)
{ {
DBUG_ASSERT(table_list->view &&
table_list->ancestor && table_list->ancestor->next_local);
my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0),
table_list->view_db.str, table_list->view_name.str); table_list->view_db.str, table_list->view_name.str);
return -1; return -1;
...@@ -125,7 +123,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, ...@@ -125,7 +123,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
thd->lex->select_lex.no_wrap_view_item= 0; thd->lex->select_lex.no_wrap_view_item= 0;
if (res) if (res)
return -1; return -1;
if (table == 0) if (table_list->effective_algorithm == VIEW_ALGORITHM_MERGE)
{ {
/* it is join view => we need to find table for update */ /* it is join view => we need to find table for update */
List_iterator_fast<Item> it(fields); List_iterator_fast<Item> it(fields);
...@@ -135,7 +133,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list, ...@@ -135,7 +133,7 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
while ((item= it++)) while ((item= it++))
map|= item->used_tables(); map|= item->used_tables();
if (table_list->check_single_table(&tbl, map) || tbl == 0) if (table_list->check_single_table(&tbl, map, table_list) || tbl == 0)
{ {
my_error(ER_VIEW_MULTIUPDATE, MYF(0), my_error(ER_VIEW_MULTIUPDATE, MYF(0),
table_list->view_db.str, table_list->view_name.str); table_list->view_db.str, table_list->view_name.str);
...@@ -709,8 +707,6 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, ...@@ -709,8 +707,6 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
thd->lex->empty_field_list_on_rset= 1; thd->lex->empty_field_list_on_rset= 1;
if (!table_list->table) if (!table_list->table)
{ {
DBUG_ASSERT(table_list->view &&
table_list->ancestor && table_list->ancestor->next_local);
my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0),
table_list->view_db.str, table_list->view_name.str); table_list->view_db.str, table_list->view_name.str);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -1764,7 +1764,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1764,7 +1764,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->lex-> thd->lex->
select_lex.table_list.link_in_list((byte*) &table_list, select_lex.table_list.link_in_list((byte*) &table_list,
(byte**) &table_list.next_local); (byte**) &table_list.next_local);
thd->lex->query_tables= &table_list; thd->lex->add_to_query_tables(&table_list);
/* switch on VIEW optimisation: do not fill temporary tables */ /* switch on VIEW optimisation: do not fill temporary tables */
thd->lex->sql_command= SQLCOM_SHOW_FIELDS; thd->lex->sql_command= SQLCOM_SHOW_FIELDS;
......
...@@ -1006,7 +1006,7 @@ static int mysql_test_update(Prepared_statement *stmt, ...@@ -1006,7 +1006,7 @@ static int mysql_test_update(Prepared_statement *stmt,
if (!open_tables(thd, &table_list, &table_count)) if (!open_tables(thd, &table_list, &table_count))
{ {
if (table_list->ancestor && table_list->ancestor->next_local) if (table_list->multitable_view)
{ {
DBUG_ASSERT(table_list->view != 0); DBUG_ASSERT(table_list->view != 0);
DBUG_PRINT("info", ("Switch to multi-update")); DBUG_PRINT("info", ("Switch to multi-update"));
...@@ -1095,8 +1095,6 @@ static int mysql_test_delete(Prepared_statement *stmt, ...@@ -1095,8 +1095,6 @@ static int mysql_test_delete(Prepared_statement *stmt,
bool res; bool res;
if (!table_list->table) if (!table_list->table)
{ {
DBUG_ASSERT(table_list->view &&
table_list->ancestor && table_list->ancestor->next_local);
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0), my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
table_list->view_db.str, table_list->view_name.str); table_list->view_db.str, table_list->view_name.str);
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -1458,8 +1456,6 @@ static int mysql_test_multidelete(Prepared_statement *stmt, ...@@ -1458,8 +1456,6 @@ static int mysql_test_multidelete(Prepared_statement *stmt,
return res; return res;
if (!tables->table) if (!tables->table)
{ {
DBUG_ASSERT(tables->view &&
tables->ancestor && tables->ancestor->next_local);
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0), my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
tables->view_db.str, tables->view_name.str); tables->view_db.str, tables->view_name.str);
return -1; return -1;
......
...@@ -7300,7 +7300,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top) ...@@ -7300,7 +7300,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
*/ */
if (table->on_expr) if (table->on_expr)
{ {
Item *expr; Item *expr= table->prep_on_expr ? table->prep_on_expr : table->on_expr;
/* /*
If an on expression E is attached to the table, If an on expression E is attached to the table,
check all null rejected predicates in this expression. check all null rejected predicates in this expression.
...@@ -7310,7 +7310,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top) ...@@ -7310,7 +7310,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
the corresponding on expression is added to E. the corresponding on expression is added to E.
*/ */
expr= simplify_joins(join, &nested_join->join_list, expr= simplify_joins(join, &nested_join->join_list,
table->on_expr, FALSE); expr, FALSE);
table->prep_on_expr= table->on_expr= expr; table->prep_on_expr= table->on_expr= expr;
} }
nested_join->used_tables= (table_map) 0; nested_join->used_tables= (table_map) 0;
......
...@@ -139,7 +139,7 @@ int mysql_update(THD *thd, ...@@ -139,7 +139,7 @@ int mysql_update(THD *thd,
if (open_tables(thd, &table_list, &table_count)) if (open_tables(thd, &table_list, &table_count))
DBUG_RETURN(1); DBUG_RETURN(1);
if (table_list->ancestor && table_list->ancestor->next_local) if (table_list->multitable_view)
{ {
DBUG_ASSERT(table_list->view != 0); DBUG_ASSERT(table_list->view != 0);
DBUG_PRINT("info", ("Switch to multi-update")); DBUG_PRINT("info", ("Switch to multi-update"));
...@@ -706,9 +706,11 @@ bool mysql_multi_update_prepare(THD *thd) ...@@ -706,9 +706,11 @@ bool mysql_multi_update_prepare(THD *thd)
if (!tl->placeholder() && !tl->schema_table && !using_lock_tables) if (!tl->placeholder() && !tl->schema_table && !using_lock_tables)
tl->table->reginfo.lock_type= tl->lock_type; tl->table->reginfo.lock_type= tl->lock_type;
} }
}
for(tl= table_list; tl; tl= tl->next_local)
{
/* Check access privileges for table */ /* Check access privileges for table */
if (!tl->derived && !tl->belong_to_view) if (!tl->derived)
{ {
uint want_privilege= tl->updating ? UPDATE_ACL : SELECT_ACL; uint want_privilege= tl->updating ? UPDATE_ACL : SELECT_ACL;
if (check_access(thd, want_privilege, if (check_access(thd, want_privilege,
...@@ -721,12 +723,10 @@ bool mysql_multi_update_prepare(THD *thd) ...@@ -721,12 +723,10 @@ bool mysql_multi_update_prepare(THD *thd)
/* check single table update for view compound from several tables */ /* check single table update for view compound from several tables */
for (tl= table_list; tl; tl= tl->next_local) for (tl= table_list; tl; tl= tl->next_local)
{ {
if (tl->table == 0) if (tl->effective_algorithm == VIEW_ALGORITHM_MERGE)
{ {
DBUG_ASSERT(tl->view &&
tl->ancestor && tl->ancestor->next_local);
TABLE_LIST *for_update= 0; TABLE_LIST *for_update= 0;
if (tl->check_single_table(&for_update, tables_for_update)) if (tl->check_single_table(&for_update, tables_for_update, tl))
{ {
my_error(ER_VIEW_MULTIUPDATE, MYF(0), my_error(ER_VIEW_MULTIUPDATE, MYF(0),
tl->view_db.str, tl->view_name.str); tl->view_db.str, tl->view_name.str);
......
...@@ -774,9 +774,9 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) ...@@ -774,9 +774,9 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
for (tbl= lex->select_lex.get_table_list(); tbl; tbl= tbl->next_local) for (tbl= lex->select_lex.get_table_list(); tbl; tbl= tbl->next_local)
tbl->select_lex= table->select_lex; tbl->select_lex= table->select_lex;
/* multi table view */
if (view_tables->next_local)
{ {
if (view_tables->next_local)
table->multitable_view= TRUE;
/* make nested join structure for view tables */ /* make nested join structure for view tables */
NESTED_JOIN *nested_join; NESTED_JOIN *nested_join;
if (!(nested_join= table->nested_join= if (!(nested_join= table->nested_join=
......
...@@ -1655,11 +1655,13 @@ void st_table_list::set_ancestor() ...@@ -1655,11 +1655,13 @@ void st_table_list::set_ancestor()
*/ */
tbl->ancestor->set_ancestor(); tbl->ancestor->set_ancestor();
} }
if (tbl->multitable_view)
multitable_view= TRUE;
if (tbl->table)
tbl->table->grant= grant; tbl->table->grant= grant;
} while ((tbl= tbl->next_local)); } while ((tbl= tbl->next_local));
/* if view contain only one table, substitute TABLE of it */ if (!multitable_view)
if (!ancestor->next_local)
{ {
table= ancestor->table; table= ancestor->table;
schema_table= ancestor->schema_table; schema_table= ancestor->schema_table;
...@@ -1686,8 +1688,6 @@ void st_table_list::save_and_clear_want_privilege() ...@@ -1686,8 +1688,6 @@ void st_table_list::save_and_clear_want_privilege()
} }
else else
{ {
DBUG_ASSERT(tbl->view && tbl->ancestor &&
tbl->ancestor->next_local);
tbl->save_and_clear_want_privilege(); tbl->save_and_clear_want_privilege();
} }
} }
...@@ -1709,8 +1709,6 @@ void st_table_list::restore_want_privilege() ...@@ -1709,8 +1709,6 @@ void st_table_list::restore_want_privilege()
tbl->table->grant.want_privilege= privilege_backup; tbl->table->grant.want_privilege= privilege_backup;
else else
{ {
DBUG_ASSERT(tbl->view && tbl->ancestor &&
tbl->ancestor->next_local);
tbl->restore_want_privilege(); tbl->restore_want_privilege();
} }
} }
...@@ -2064,16 +2062,17 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure) ...@@ -2064,16 +2062,17 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
{ {
if (check_option && check_option->val_int() == 0) if (check_option && check_option->val_int() == 0)
{ {
TABLE_LIST *view= (belong_to_view ? belong_to_view : this);
if (ignore_failure) if (ignore_failure)
{ {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED), ER_VIEW_CHECK_FAILED, ER(ER_VIEW_CHECK_FAILED),
view_db.str, view_name.str); view->view_db.str, view->view_name.str);
return(VIEW_CHECK_SKIP); return(VIEW_CHECK_SKIP);
} }
else else
{ {
my_error(ER_VIEW_CHECK_FAILED, MYF(0), view_db.str, view_name.str); my_error(ER_VIEW_CHECK_FAILED, MYF(0), view->view_db.str, view->view_name.str);
return(VIEW_CHECK_ERROR); return(VIEW_CHECK_ERROR);
} }
} }
...@@ -2091,13 +2090,15 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure) ...@@ -2091,13 +2090,15 @@ int st_table_list::view_check_option(THD *thd, bool ignore_failure)
(should be 0 on call, to find table, or point to table for (should be 0 on call, to find table, or point to table for
unique test) unique test)
map bit mask of tables map bit mask of tables
view view for which we are looking table
RETURN RETURN
FALSE table not found or found only one FALSE table not found or found only one
TRUE found several tables TRUE found several tables
*/ */
bool st_table_list::check_single_table(st_table_list **table, table_map map) bool st_table_list::check_single_table(st_table_list **table, table_map map,
st_table_list *view)
{ {
for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local) for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local)
{ {
...@@ -2108,11 +2109,14 @@ bool st_table_list::check_single_table(st_table_list **table, table_map map) ...@@ -2108,11 +2109,14 @@ bool st_table_list::check_single_table(st_table_list **table, table_map map)
if (*table) if (*table)
return TRUE; return TRUE;
else else
{
*table= tbl; *table= tbl;
tbl->check_option= view->check_option;
}
} }
} }
else else
if (tbl->check_single_table(table, map)) if (tbl->check_single_table(table, map, view))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
...@@ -2142,7 +2146,7 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root) ...@@ -2142,7 +2146,7 @@ bool st_table_list::set_insert_values(MEM_ROOT *mem_root)
} }
else else
{ {
DBUG_ASSERT(view && ancestor && ancestor->next_local); DBUG_ASSERT(view && ancestor);
for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local) for (TABLE_LIST *tbl= ancestor; tbl; tbl= tbl->next_local)
if (tbl->set_insert_values(mem_root)) if (tbl->set_insert_values(mem_root))
return TRUE; return TRUE;
......
...@@ -436,6 +436,10 @@ typedef struct st_table_list ...@@ -436,6 +436,10 @@ typedef struct st_table_list
bool skip_temporary; /* this table shouldn't be temporary */ bool skip_temporary; /* this table shouldn't be temporary */
/* TRUE if this merged view contain auto_increment field */ /* TRUE if this merged view contain auto_increment field */
bool contain_auto_increment; bool contain_auto_increment;
#if 0
#else
bool multitable_view; /* TRUE iff this is multitable view */
#endif
/* FRMTYPE_ERROR if any type is acceptable */ /* FRMTYPE_ERROR if any type is acceptable */
enum frm_type_enum required_type; enum frm_type_enum required_type;
char timestamp_buffer[20]; /* buffer for timestamp (19+1) */ char timestamp_buffer[20]; /* buffer for timestamp (19+1) */
...@@ -454,7 +458,8 @@ typedef struct st_table_list ...@@ -454,7 +458,8 @@ typedef struct st_table_list
void print(THD *thd, String *str); void print(THD *thd, String *str);
void save_and_clear_want_privilege(); void save_and_clear_want_privilege();
void restore_want_privilege(); void restore_want_privilege();
bool check_single_table(st_table_list **table, table_map map); bool check_single_table(st_table_list **table, table_map map,
st_table_list *view);
bool set_insert_values(MEM_ROOT *mem_root); bool set_insert_values(MEM_ROOT *mem_root);
st_table_list *find_underlying_table(TABLE *table); st_table_list *find_underlying_table(TABLE *table);
} TABLE_LIST; } TABLE_LIST;
......
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