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
Use of explicit table.column alongside alias for the same column fails for function calls #39923
I'd like to alias a column to have the same name as an existing column but also make use of the original column.
The following works as expected:
SELECT
errors.name AS labels,
value,
'ch_errors_total' AS name
FROM system.errors
LIMIT 5
Query id: 187cd40f-71ec-43ed-b59b-1c4fc8c4be34
┌─labels─────────────┬─value─┬─name────────────┐
│ BAD_ARGUMENTS │ 20 │ ch_errors_total │
│ UNKNOWN_IDENTIFIER │ 22 │ ch_errors_total │
│ UNKNOWN_FORMAT │ 4 │ ch_errors_total │
│ CYCLIC_ALIASES │ 1 │ ch_errors_total │
└────────────────────┴───────┴─────────────────┘
4 rows in set. Elapsed: 0.001 sec.
The following however, does not work:
SELECT
map('name', errors.name) AS labels,
value,
'ch_errors_total' AS name
FROM system.errors
LIMIT 5
Query id: 4cb16e3f-6610-49b3-a175-936998be94d5
0 rows in set. Elapsed: 0.001 sec.
Received exception:
Code: 47. DB::Exception: Unknown identifier: name; there are columns: value, 'name': While processing map('name', name) AS labels, value, 'ch_errors_total' AS name. (UNKNOWN_IDENTIFIER)
Does it reproduce on recent release?
Yes, we're on the latest release 22.7
Activity
kitaisreal commentedon Aug 5, 2022
Related to #23194.
Close: #39923