diff options
author | unknown <evgen@moonbone.local> | 2005-06-24 21:47:17 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-06-24 21:47:17 +0400 |
commit | be3d7091703c73686e4d6097734245a40151c276 (patch) | |
tree | b8160d7ecb96ffc30ecffd9230ae4902c317c41b | |
parent | 0c0a5097cb1b5f33a9d93235277dd4990a924a8a (diff) | |
parent | fd3ac3829bec048fa7cfeae5c8d1fb88d16e6380 (diff) | |
download | mariadb-git-be3d7091703c73686e4d6097734245a40151c276.tar.gz |
Merge
mysql-test/r/view.result:
SCCS merged
mysql-test/t/view.test:
SCCS merged
-rw-r--r-- | mysql-test/r/view.result | 11 | ||||
-rw-r--r-- | mysql-test/t/view.test | 11 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 10 |
3 files changed, 28 insertions, 4 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index d4d6eb08cad..4c1db618b4b 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1831,6 +1831,17 @@ select * from v1; t 01:00 drop view v1; +create table t1 (f1 date); +insert into t1 values ('2005-01-01'),('2005-02-02'); +create view v1 as select * from t1; +select * from v1 where f1='2005.02.02'; +f1 +2005-02-02 +select * from v1 where '2005.02.02'=f1; +f1 +2005-02-02 +drop view v1; +drop table t1; CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd"); SELECT * FROM v1; drop view v1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index f131f9d2604..06b523b3610 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1675,6 +1675,17 @@ select * from v1; drop view v1; # +# bug #11325 Wrong date comparison in views +# +create table t1 (f1 date); +insert into t1 values ('2005-01-01'),('2005-02-02'); +create view v1 as select * from t1; +select * from v1 where f1='2005.02.02'; +select * from v1 where '2005.02.02'=f1; +drop view v1; +drop table t1; + +# # using encrypt & substring_index in view (BUG#7024) # CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd"); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 0442865b7f9..58a7f3316d7 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -238,9 +238,10 @@ void Item_bool_func2::fix_length_and_dec() return; } - if (args[0]->type() == FIELD_ITEM) + Item *real_item= args[0]->real_item(); + if (real_item->type() == FIELD_ITEM) { - Field *field=((Item_field*) args[0])->field; + Field *field= ((Item_field*) real_item)->field; if (field->can_be_compared_as_longlong()) { if (convert_constant_item(thd, field,&args[1])) @@ -251,9 +252,10 @@ void Item_bool_func2::fix_length_and_dec() } } } - if (args[1]->type() == FIELD_ITEM /* && !args[1]->const_item() */) + real_item= args[1]->real_item(); + if (real_item->type() == FIELD_ITEM) { - Field *field=((Item_field*) args[1])->field; + Field *field= ((Item_field*) real_item)->field; if (field->can_be_compared_as_longlong()) { if (convert_constant_item(thd, field,&args[0])) |