# Basic tables, no nulls

statement ok
CREATE TABLE t1 (k INT PRIMARY KEY, v INT)

statement ok
INSERT INTO t1 VALUES (-1, -1), (0, 4), (2, 1), (3, 4), (5, 4)

statement ok
CREATE TABLE t2 (x INT, y INT, INDEX x (x))

statement ok
INSERT INTO t2 VALUES (0, 5), (1, 3), (1, 4), (3, 2), (3, 3), (4, 6)

query IIII rowsort
SELECT k, v, x, y FROM t1 INNER MERGE JOIN t2 ON k = x
----
0 4 0 5
3 4 3 2
3 4 3 3

statement ok
DROP TABLE t1

statement ok
DROP TABLE t2

# Basic tables with nulls

statement ok
CREATE TABLE t1 (k INT, INDEX k(k))

statement ok
INSERT INTO t1 VALUES (0), (null)

statement ok
CREATE TABLE t2 (x INT, INDEX x (x))

statement ok
INSERT INTO t2 VALUES (0), (null)

query II
SELECT k, x FROM t1 INNER MERGE JOIN t2 ON k = x
----
0 0

# Regression test for the inputs that have comparable but different types (see
# issue #44798).
statement ok
CREATE TABLE t44798_0(c0 INT4 PRIMARY KEY); CREATE TABLE t44798_1(c0 INT8 PRIMARY KEY)

statement ok
INSERT INTO t44798_0(c0) VALUES(0), (1), (2); INSERT INTO t44798_1(c0) VALUES(0), (2), (4)

# Note that integers of different width are still considered equal.
query I rowsort
SELECT * FROM t44798_0 NATURAL JOIN t44798_1
----
0
2

# Regression test for batch type schema prefix mismatch after LEFT ANTI join
# (48622).
statement ok
CREATE TABLE l (l INT PRIMARY KEY); INSERT INTO l VALUES (1), (2);
CREATE TABLE r (r INT PRIMARY KEY); INSERT INTO r VALUES (1)

query IB
SELECT *, true FROM (SELECT l FROM l WHERE l NOT IN (SELECT r FROM r))
----
2 true
