Add test for #19222

This commit is contained in:
Raúl Marín 2022-02-15 17:35:01 +01:00
parent cf454a6539
commit 3bac81e4f3
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,4 @@
5000
5000
5000
5000

View File

@ -0,0 +1,41 @@
-- https://github.com/ClickHouse/ClickHouse/issues/19222
SET enable_global_with_statement = 1;
WITH t AS
(
SELECT number AS n
FROM numbers(10000)
)
SELECT count(*)
FROM t AS a
WHERE a.n < 5000;
WITH t AS
(
SELECT number AS n
FROM numbers(10000)
)
SELECT count(*)
FROM t AS a
WHERE t.n < 5000;
SET enable_global_with_statement = 0;
WITH t AS
(
SELECT number AS n
FROM numbers(10000)
)
SELECT count(*)
FROM t AS a
WHERE a.n < 5000;
WITH t AS
(
SELECT number AS n
FROM numbers(10000)
)
SELECT count(*)
FROM t AS a
WHERE t.n < 5000;