diff options
author | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-08-15 10:13:17 +0300 |
---|---|---|
committer | unknown <gkodinov/kgeorge@macbook.gmz> | 2006-08-15 10:13:17 +0300 |
commit | 3915c3d94c48a96fdc9163d0841ca33159fc3268 (patch) | |
tree | 18ad4fe06a22026db0a877fda9f1c2bf7f7da892 /mysql-test/r/compare.result | |
parent | 1cf65f311dbf09615bea443b041a78db34d7e2ea (diff) | |
download | mariadb-git-3915c3d94c48a96fdc9163d0841ca33159fc3268.tar.gz |
Bug #21159: Optimizer: wrong result after AND with different data types
Disable const propagation for Item_hex_string.
This must be done because Item_hex_string->val_int() is not
the same as (Item_hex_string->val_str() in BINARY column)->val_int().
We cannot simply disable the replacement in a particular context (
e.g. <bin_col> = <int_col> AND <bin_col> = <hex_string>) since
Items don't know the context they are in and there are functions like
IF (<hex_string>, 'yes', 'no').
Note that this will disable some valid cases as well
(e.g. : <bin_col> = <hex_string> AND <bin_col2> = <bin_col>) but
there's no way to distinguish the valid cases without having the
Item's parent say something like : Item->set_context(Item::STRING_RESULT)
and have all the Items that contain other Items do that consistently.
mysql-test/r/compare.result:
Bug #21159: Optimizer: wrong result after AND with different data types
- test case
mysql-test/t/compare.test:
Bug #21159: Optimizer: wrong result after AND with different data types
- test case
sql/sql_select.cc:
Bug #21159: Optimizer: wrong result after AND with different data types
- disable const propagation for Item_hex_string.
Diffstat (limited to 'mysql-test/r/compare.result')
-rw-r--r-- | mysql-test/r/compare.result | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index 6f667aabac0..da0ca8ddba1 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -42,3 +42,10 @@ CHAR(31) = '' '' = CHAR(31) SELECT CHAR(30) = '', '' = CHAR(30); CHAR(30) = '' '' = CHAR(30) 0 0 +create table t1 (a tinyint(1),b binary(1)); +insert into t1 values (0x01,0x01); +select * from t1 where a=b; +a b +select * from t1 where a=b and b=0x01; +a b +drop table if exists t1; |