statement ok
DROP TABLE IF EXISTS t

statement ok
CREATE TABLE t (k INT PRIMARY KEY null, a INT null, b INT null)

statement ok
INSERT INTO t VALUES (1, NULL, NULL), (2, NULL, 1), (3, 1, NULL), (4, 2, 0), (5, 3, 3)

statement error (?s)1006.*divided by zero while evaluating function `divide\(3, 0\)`
SELECT a <> 2 AND 3 / b = 1 FROM t ORDER BY k

query I
SELECT a FROM t WHERE a <> 2 AND 3 / b = 1 ORDER BY k
----
3

statement error (?s)1006.*divided by zero while evaluating function `divide\(3, 0\)`
SELECT a = 2 OR 3 / b = 1 FROM t ORDER BY k

query I
SELECT a FROM t WHERE a = 2 OR 3 / b = 1 ORDER BY k
----
2
3

statement ok
truncate table t

statement ok
INSERT INTO t VALUES (1, NULL, NULL), (2, NULL, 1), (3, 1, NULL), (4, 2, 1), (5, 3, 3)

query T
SELECT a <> 2 AND 3 / b = 1 FROM t ORDER BY k
----
null
false
null
false
true

query I
SELECT a FROM t WHERE a <> 2 AND 3 / b = 1 ORDER BY k
----
3

query T
SELECT a = 2 OR 3 / b = 1 FROM t ORDER BY k
----
null
null
null
true
true

query I
SELECT a FROM t WHERE a = 2 OR 3 / b = 1 ORDER BY k
----
2
3

statement ok
DROP TABLE IF EXISTS t