summaryrefslogtreecommitdiff
path: root/mysql-test/r/bool.result
diff options
context:
space:
mode:
authormonty@mashka.mysql.fi <>2002-11-11 15:57:35 +0200
committermonty@mashka.mysql.fi <>2002-11-11 15:57:35 +0200
commit876f3f4d308739805a0a1ac71c32c9dc3060a948 (patch)
treeaf6d24e40719efd42eef9d7580ef497455ddd45d /mysql-test/r/bool.result
parentb0f5c6d625a77ef51554a1f98f1fd27b4b3f7801 (diff)
downloadmariadb-git-876f3f4d308739805a0a1ac71c32c9dc3060a948.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
Diffstat (limited to 'mysql-test/r/bool.result')
-rw-r--r--mysql-test/r/bool.result48
1 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/r/bool.result b/mysql-test/r/bool.result
new file mode 100644
index 00000000000..dc170ee5150
--- /dev/null
+++ b/mysql-test/r/bool.result
@@ -0,0 +1,48 @@
+DROP TABLE IF EXISTS t1;
+SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
+IF(NULL AND 1, 1, 2) IF(1 AND NULL, 1, 2)
+2 2
+SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
+NULL AND 1 1 AND NULL 0 AND NULL NULL and 0
+NULL NULL 0 0
+create table t1 (a int);
+insert into t1 values (0),(1),(NULL);
+SELECT * FROM t1 WHERE IF(a AND 1, 0, 1);
+a
+0
+NULL
+SELECT * FROM t1 WHERE IF(1 AND a, 0, 1);
+a
+0
+NULL
+SELECT * FROM t1 where NOT(a AND 1);
+a
+0
+SELECT * FROM t1 where NOT(1 AND a);
+a
+0
+SELECT * FROM t1 where (a AND 1)=0;
+a
+0
+SELECT * FROM t1 where (1 AND a)=0;
+a
+0
+SELECT * FROM t1 where (1 AND a)=1;
+a
+1
+SELECT * FROM t1 where (1 AND a) IS NULL;
+a
+NULL
+SET @a=0, @b=0;
+SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
+a
+SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
+a
+SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
+a
+SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
+a
+SELECT @a, @b;
+@a @b
+0 6
+DROP TABLE t1;