2024-04-10 15:10:02 +00:00
|
|
|
-- https://github.com/ClickHouse/ClickHouse/issues/56466
|
|
|
|
|
2024-07-12 12:49:26 +00:00
|
|
|
SET enable_analyzer=1;
|
2024-04-12 12:53:07 +00:00
|
|
|
|
2024-04-10 15:10:02 +00:00
|
|
|
DROP TABLE IF EXISTS users;
|
|
|
|
|
|
|
|
CREATE TABLE users (uid Int16, name String, age Int16) ENGINE=Memory;
|
|
|
|
|
|
|
|
INSERT INTO users VALUES (1231, 'John', 33);
|
|
|
|
INSERT INTO users VALUES (6666, 'Ksenia', 48);
|
|
|
|
INSERT INTO users VALUES (8888, 'Alice', 50);
|
|
|
|
|
2024-04-12 12:53:07 +00:00
|
|
|
-- The query works when using a single SELECT *
|
2024-04-10 15:10:02 +00:00
|
|
|
SELECT *
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
name,
|
|
|
|
age
|
|
|
|
FROM users
|
|
|
|
)
|
|
|
|
GROUP BY
|
|
|
|
1,
|
2024-04-12 12:53:07 +00:00
|
|
|
2
|
|
|
|
ORDER BY ALL;
|
2024-04-10 15:10:02 +00:00
|
|
|
|
|
|
|
-- It doesn't when the GROUP BY is nested deeper
|
|
|
|
SELECT *
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT *
|
|
|
|
FROM
|
|
|
|
(
|
|
|
|
SELECT
|
|
|
|
name,
|
|
|
|
age
|
|
|
|
FROM users
|
|
|
|
)
|
|
|
|
GROUP BY
|
|
|
|
1,
|
|
|
|
2
|
2024-04-12 12:53:07 +00:00
|
|
|
)
|
|
|
|
ORDER BY ALL;
|
2024-04-10 15:10:02 +00:00
|
|
|
|
|
|
|
DROP TABLE IF EXISTS users;
|