You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GROUP BY using WITH columns alias don't work if we call the column using the column name on SELECT #7520
bugConfirmed user-visible misbehaviour in official releasecomp-ddlDDL command coordination and execution (ON CLUSTER, DDL queue).st-acceptedThe issue is in our backlog, ready to take
If we do a GROUP BY using an alias column on the WITH, it consider the following column as not part of the ORDER BY
How to reproduce
Clickhouse server v19.14.3
CREATE TABLE test (`a` UInt32, `b` UInt32) ENGINE = Memory;
WITH
a as key
SELECT
a as k1,
sum(b) as k2
FROM
test
GROUP BY
key
ORDER BY k1, k2;
Code: 215. DB::Exception: Received from 127.0.0.1:10000. DB::Exception: Column a is not under aggregate function and not in GROUP BY..
Expected behavior
This query should be executable as the alias key and the column a share the same expression.
bugConfirmed user-visible misbehaviour in official releasecomp-ddlDDL command coordination and execution (ON CLUSTER, DDL queue).st-acceptedThe issue is in our backlog, ready to take
Activity
YiuRULE commentedon Oct 30, 2019
I saw also a similar strange behavior who could be related to the following issue.
for the same database definition as the original pull-request, this request return the error
DB::Exception: Unknown identifier: a.WITH a as key SELECT key as k1 FROM test GROUP BY key;However, if we do
WITH a as key SELECT key as k1 FROM test;(so without the grouping key), it's working fineClose: #7520