summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-03-09 14:07:34 +0300
committerunknown <evgen@moonbone.local>2006-03-09 14:07:34 +0300
commit5e54b63fa372ff2b6ff33fb4363febe15174c96c (patch)
treed722cdc238298dfe98360bd17243d2c5fa0757ec
parent6c81f3436900336a589a4fcf1bdc577df51cf3c2 (diff)
parentcc7a75e6fdf5f4253c550ee3d5d93c46b96f5678 (diff)
downloadmariadb-git-5e54b63fa372ff2b6ff33fb4363febe15174c96c.tar.gz
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0
into moonbone.local:/work/17726-bug-5.0-mysql sql/item_cmpfunc.cc: Auto merged
-rw-r--r--mysql-test/r/view.result14
-rw-r--r--mysql-test/t/view.test14
-rw-r--r--sql/item_cmpfunc.cc3
3 files changed, 30 insertions, 1 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index c9a79e50cc3..7678c70bda2 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2539,3 +2539,17 @@ drop view v1;
//
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache `test`.`t1`.`id` AS `id` from `t1`
+create table t1(f1 int, f2 int);
+create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
+.f1 and ta.f2=tb.f2;
+insert into t1 values(1,1),(2,2);
+create view v2 as select * from v1 where a > 1 with check option;
+select * from v2;
+a b
+2 2
+update v2 set b=3 where a=2;
+select * from v2;
+a b
+3 3
+drop view v2, v1;
+drop table t1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index b7e678c6f77..e17e2b98527 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2385,3 +2385,17 @@ show create view v1;
drop view v1;
//
delimiter ;//
+
+#
+# Bug#17726 Not checked empty list caused endless loop
+#
+create table t1(f1 int, f2 int);
+create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
+.f1 and ta.f2=tb.f2;
+insert into t1 values(1,1),(2,2);
+create view v2 as select * from v1 where a > 1 with check option;
+select * from v2;
+update v2 set b=3 where a=2;
+select * from v2;
+drop view v2, v1;
+drop table t1;
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 304e9e8babe..b31853ccf02 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2547,7 +2547,8 @@ Item_cond::fix_fields(THD *thd, Item **ref)
{
table_map tmp_table_map;
while (item->type() == Item::COND_ITEM &&
- ((Item_cond*) item)->functype() == functype())
+ ((Item_cond*) item)->functype() == functype() &&
+ !((Item_cond*) item)->list.is_empty())
{ // Identical function
li.replace(((Item_cond*) item)->list);
((Item_cond*) item)->list.empty();