summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2005-06-28 22:59:16 +0300
committerunknown <bell@sanja.is.com.ua>2005-06-28 22:59:16 +0300
commit90300c071aa63cf4b91a490f2058e83aeb35abec (patch)
treeda53f5131498e0063340e3449f763cd89e446aa7
parentdadf91f0ff29d1ac767a16803c3eaca7db3e13ed (diff)
parent3aca0a0c62d8e2557dd366a9b2ecf0053bf1b832 (diff)
downloadmariadb-git-90300c071aa63cf4b91a490f2058e83aeb35abec.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-bug3-4.1
-rw-r--r--mysql-test/r/select.result9
-rw-r--r--mysql-test/t/select.test15
-rw-r--r--sql/item_cmpfunc.h6
3 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index f828759672a..abf5c8c87ad 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2515,3 +2515,12 @@ SELECT b FROM t1 WHERE b=0x8000000000000000;
b
9223372036854775808
DROP TABLE t1;
+CREATE TABLE `t1` ( `gid` int(11) default NULL, `uid` int(11) default NULL);
+CREATE TABLE `t2` ( `ident` int(11) default NULL, `level` char(16) default NULL);
+INSERT INTO `t2` VALUES (0,'READ');
+CREATE TABLE `t3` ( `id` int(11) default NULL, `name` char(16) default NULL);
+INSERT INTO `t3` VALUES (1,'fs');
+select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid, t3.id, 0);
+id name gid uid ident level
+1 fs NULL NULL 0 READ
+drop table t1,t2,t3;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 3877e67de41..baaab6e4189 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2060,3 +2060,18 @@ CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
INSERT INTO t1 VALUES (0x8000000000000000);
SELECT b FROM t1 WHERE b=0x8000000000000000;
DROP TABLE t1;
+
+#
+# IN with outer join condition (BUG#9393)
+#
+CREATE TABLE `t1` ( `gid` int(11) default NULL, `uid` int(11) default NULL);
+
+CREATE TABLE `t2` ( `ident` int(11) default NULL, `level` char(16) default NULL);
+INSERT INTO `t2` VALUES (0,'READ');
+
+CREATE TABLE `t3` ( `id` int(11) default NULL, `name` char(16) default NULL);
+INSERT INTO `t3` VALUES (1,'fs');
+
+select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid, t3.id, 0);
+
+drop table t1,t2,t3;
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index bea8250de9d..525f269e528 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -769,6 +769,12 @@ class Item_func_in :public Item_int_func
bool nulls_in_row();
bool is_bool_func() { return 1; }
CHARSET_INFO *compare_collation() { return cmp_collation.collation; }
+ /*
+ IN() protect from NULL only first argument, if construction like
+ "expression IN ()" will be allowed, we will need to check number of
+ argument here, because "NOT(NULL IN ())" is TRUE.
+ */
+ table_map not_null_tables() const { return args[0]->not_null_tables(); }
};
/* Functions used by where clause */