diff --git a/tests/queries/0_stateless/01881_union_header_mismatch_bug.reference b/tests/queries/0_stateless/01881_union_header_mismatch_bug.reference index 62596a01d0b..fbec53380d2 100644 --- a/tests/queries/0_stateless/01881_union_header_mismatch_bug.reference +++ b/tests/queries/0_stateless/01881_union_header_mismatch_bug.reference @@ -1 +1,11 @@ table 10 101 +a 0 +a 1 +a 2 +a 3 +a 4 +b 0 +b 1 +b 2 +b 3 +b 4 diff --git a/tests/queries/0_stateless/01881_union_header_mismatch_bug.sql b/tests/queries/0_stateless/01881_union_header_mismatch_bug.sql index 98dd32c8bd7..9a220ffd49f 100644 --- a/tests/queries/0_stateless/01881_union_header_mismatch_bug.sql +++ b/tests/queries/0_stateless/01881_union_header_mismatch_bug.sql @@ -1 +1,30 @@ -select * from ( select 'table' as table, toInt64(10) as rows, toInt64(101) as elements union all select 'another table' as table, toInt64(0) as rows, toInt64(0) as elements ) where rows - elements <> 0 +select * from ( select 'table' as table, toInt64(10) as rows, toInt64(101) as elements union all select 'another table' as table, toInt64(0) as rows, toInt64(0) as elements ) where rows - elements <> 0; + +SELECT + label, + number +FROM +( + SELECT + 'a' AS label, + number + FROM + ( + SELECT number + FROM numbers(10) + ) + UNION ALL + SELECT + 'b' AS label, + number + FROM + ( + SELECT number + FROM numbers(10) + ) +) +WHERE number IN +( + SELECT number + FROM numbers(5) +) order by label, number;