query I rowsort
select 1 union select 2
----
1
2

query I rowsort
select 1 union select 2 + 1
----
1
3

query I rowsort
select 1 union select 1
----
1

query I rowsort
select 1 union all select 1
----
1
1

query T rowsort
select (1, 2) union select (2, 1) union select (1, 2)
----
(1, 2)
(2, 1)

statement ok
create table t1(id int primary key, v1 int unique)

statement ok
insert into t1 values (1,1), (2,2), (3,3), (4,4)

query I rowsort
select id from t1 union select v1 from t1
----
1
2
3
4

query I rowsort
select id from t1 union all select v1 from t1
----
1
1
2
2
3
3
4
4

statement ok
drop table t1