summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbell@sanja.is.com.ua <>2004-11-25 22:54:49 +0200
committerbell@sanja.is.com.ua <>2004-11-25 22:54:49 +0200
commit3c108b2a84fd69fc258f38303015fde5f1e07321 (patch)
tree0e93e04726753773c049e37bd0efbbbace208de0
parent2ca5a0f2b17b02c13711d5f45ff75c52a23e4fb3 (diff)
downloadmariadb-git-3c108b2a84fd69fc258f38303015fde5f1e07321.tar.gz
init values to avoid junk returning in case of null value asking without assigning value (BUG#6806)
-rw-r--r--mysql-test/r/subselect.result5
-rw-r--r--mysql-test/t/subselect.test8
-rw-r--r--sql/item.h6
3 files changed, 16 insertions, 3 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 53b92fe50f1..4ad234244bf 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -2005,3 +2005,8 @@ explain select a from t1 where c=2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
drop table t1;
+create table t1 (s1 int,s2 int);
+insert into t1 values (20,15);
+select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
+s1 s2
+drop table t1;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 19bfaa6194a..c3a10a835e2 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1301,3 +1301,11 @@ explain select a from t1 where c=2;
do @a:= (select sum(a) from t1 where b > @b);
explain select a from t1 where c=2;
drop table t1;
+
+#
+# Equal operation under row and empty subquery
+#
+create table t1 (s1 int,s2 int);
+insert into t1 values (20,15);
+select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
+drop table t1;
diff --git a/sql/item.h b/sql/item.h
index ccb0fda1c49..3c4f80e3857 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1127,7 +1127,7 @@ class Item_cache_int: public Item_cache
{
longlong value;
public:
- Item_cache_int(): Item_cache() {}
+ Item_cache_int(): Item_cache(), value(0) {}
void store(Item *item);
double val() { DBUG_ASSERT(fixed == 1); return (double) value; }
@@ -1145,7 +1145,7 @@ class Item_cache_real: public Item_cache
{
double value;
public:
- Item_cache_real(): Item_cache() {}
+ Item_cache_real(): Item_cache(), value(0) {}
void store(Item *item);
double val() { DBUG_ASSERT(fixed == 1); return value; }
@@ -1167,7 +1167,7 @@ class Item_cache_str: public Item_cache
char buffer[80];
String *value, value_buff;
public:
- Item_cache_str(): Item_cache() { }
+ Item_cache_str(): Item_cache(), value(0) { }
void store(Item *item);
double val();