ClickHouse/tests/queries/0_stateless/03132_sqlancer_union_all.sql
2024-08-05 15:29:14 +00:00

31 lines
828 B
SQL

SET enable_analyzer = 1;
DROP TABLE IF EXISTS t0;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
CREATE TABLE t0 (c0 String) ENGINE = Memory() ;
CREATE TABLE IF NOT EXISTS t1 (c0 Int32, c1 Int32, c2 ALIAS c1) ENGINE = Log() ;
CREATE TABLE t2 (c0 Int32) ENGINE = MergeTree() ORDER BY tuple() ;
CREATE TABLE t3 (c0 String) ENGINE = Memory() ;
CREATE TABLE t4 (c0 Int32) ENGINE = Memory() ;
INSERT INTO t4(c0) VALUES (-405831124);
INSERT INTO t1(c1, c0) VALUES (278926179, 891140511);
INSERT INTO t4(c0) VALUES (1586457527);
INSERT INTO t3(c0) VALUES ('?/|D!6 '), ('1586457527');
INSERT INTO t2(c0) VALUES (1475250982);
SELECT t1.c1
FROM t3, t1
WHERE true AND t1.c2
UNION ALL
SELECT t1.c1
FROM t3, t1
WHERE NOT t1.c2
UNION ALL
SELECT t1.c1
FROM t3, t1
WHERE t1.c2 IS NULL;