From 7bba8128ed65a5d841679fceb8c6c8dd5cac008c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Aug 2004 16:14:42 +0300 Subject: [PATCH] full text function moving to current select (BUG#4822) mysql-test/r/view.result: VIEW with full text mysql-test/t/view.test: VIEW with full text sql/table.cc: full text function moving to current select --- mysql-test/r/view.result | 13 +++++++++++++ mysql-test/t/view.test | 11 +++++++++++ sql/table.cc | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 0c14b80078c..c1b079fe527 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1103,3 +1103,16 @@ create view mysqltest.v1 as select a from mysqltest.t1; alter view mysqltest.v1 as select b from mysqltest.t1; alter view mysqltest.v1 as select a from mysqltest.t1; drop database mysqltest; +CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2)); +insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer'); +select * from t1 WHERE match (c2) against ('Beer'); +c1 c2 +1 real Beer +7 almost real Beer +CREATE VIEW v1 AS SELECT * from t1 WHERE match (c2) against ('Beer'); +select * from v1; +c1 c2 +1 real Beer +7 almost real Beer +drop view v1; +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index a6a676342c1..616b1bbedd5 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1055,3 +1055,14 @@ create view mysqltest.v1 as select a from mysqltest.t1; alter view mysqltest.v1 as select b from mysqltest.t1; alter view mysqltest.v1 as select a from mysqltest.t1; drop database mysqltest; + +# +# VIEW with full text +# +CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2)); +insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer'); +select * from t1 WHERE match (c2) against ('Beer'); +CREATE VIEW v1 AS SELECT * from t1 WHERE match (c2) against ('Beer'); +select * from v1; +drop view v1; +drop table t1; diff --git a/sql/table.cc b/sql/table.cc index a1e1faa36a6..3e481443801 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1603,6 +1603,16 @@ bool st_table_list::setup_ancestor(THD *thd, Item **conds) thd->restore_backup_item_arena(arena, &backup); } + /* full text function moving to current select */ + if (view->select_lex.ftfunc_list->elements) + { + Item_func_match *ifm; + List_iterator_fast + li(*(view->select_lex.ftfunc_list)); + while ((ifm= li++)) + current_select_save->ftfunc_list->push_front(ifm); + } + ok: thd->lex->select_lex.no_wrap_view_item= save_wrapper; thd->lex->current_select= current_select_save;