diff options
author | unknown <monty@mashka.mysql.fi> | 2002-11-11 15:57:35 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2002-11-11 15:57:35 +0200 |
commit | 3165440cdec9d1270a2101973cb75e67e334dc5c (patch) | |
tree | af6d24e40719efd42eef9d7580ef497455ddd45d /mysql-test/t/bool.test | |
parent | 1b6548d54d6d649c068a73c8550e75ddb26bfd00 (diff) | |
download | mariadb-git-3165440cdec9d1270a2101973cb75e67e334dc5c.tar.gz |
Fixed that NULL and 0 returns 0 instead of NULL
This is coded to not cause a speed impact on top level AND expressions where we don't care if an AND expression returns 0 or NULL
mysql-test/r/bdb.result:
Fix results after serges last patch
mysql-test/r/innodb.result:
Fix results after serges last patch
mysql-test/r/null.result:
Update for new AND handling of NULL
scripts/mysqld_safe.sh:
Fix 'isroot' test to work even if user is not root
sql/item.h:
Fixed that NULL and 0 returns 0 instead of NULL
sql/item_cmpfunc.cc:
Fixed that NULL and 0 returns 0 instead of NULL
sql/item_cmpfunc.h:
Fixed that NULL and 0 returns 0 instead of NULL
sql/sql_base.cc:
Fixed that NULL and 0 returns 0 instead of NULL
sql/sql_parse.cc:
Fixed that NULL and 0 returns 0 instead of NULL
sql/sql_select.cc:
Fixed that NULL and 0 returns 0 instead of NULL
sql/sql_yacc.yy:
Fixed that NULL and 0 returns 0 instead of NULL
Diffstat (limited to 'mysql-test/t/bool.test')
-rw-r--r-- | mysql-test/t/bool.test | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test new file mode 100644 index 00000000000..5754acf4bcd --- /dev/null +++ b/mysql-test/t/bool.test @@ -0,0 +1,28 @@ +# +# Test of boolean operations with NULL +# + +DROP TABLE IF EXISTS t1; + +SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2); +SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0; + +create table t1 (a int); +insert into t1 values (0),(1),(NULL); +SELECT * FROM t1 WHERE IF(a AND 1, 0, 1); +SELECT * FROM t1 WHERE IF(1 AND a, 0, 1); +SELECT * FROM t1 where NOT(a AND 1); +SELECT * FROM t1 where NOT(1 AND a); +SELECT * FROM t1 where (a AND 1)=0; +SELECT * FROM t1 where (1 AND a)=0; +SELECT * FROM t1 where (1 AND a)=1; +SELECT * FROM t1 where (1 AND a) IS NULL; + +# Verify that NULL optimisation works in AND clause: +SET @a=0, @b=0; +SELECT * FROM t1 WHERE NULL AND (@a:=@a+1); +SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1)); +SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1)); +SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1))); +SELECT @a, @b; +DROP TABLE t1; |