Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got "Unknown identifier" while quering #27068

Closed
assassinors opened this issue Aug 2, 2021 · 1 comment · Fixed by #62185
Closed

Got "Unknown identifier" while quering #27068

assassinors opened this issue Aug 2, 2021 · 1 comment · Fixed by #62185
Labels
bug Confirmed user-visible misbehaviour in official release st-hold We've paused the work on issue for some reason

Comments

@assassinors
Copy link

Describe the bug
Hello,recently I met a bug while using clickhouse to do some queries with tableau server,which is weird and I can not find any solutions after searching the internet.

How to reproduce
Here are the steps to reproduce the bug.

  1. ClickHouse Server version : 21.1.2.15

  2. Table DDL
    CREATE TABLE test ( id String, create_time DateTime ) ENGINE = MergeTree ORDER BY id

  3. insert some values into the table
    insert into test values(1,'1970-02-01 00:00:00');
    insert into test values(2,'1970-02-01 00:00:00');

  4. the query sql
    select id,'1997-02-01' as create_time from test where test.create_time='1970-02-01 00:00:00'
    once you run the sql,you'll get an exception which is said "Unkown identifier create_time there are columns : id: while processing create_time='1997-02-01 00:00:00'(version 21.1.2.15 (official build))"
    I also try these steps in mysql,however,there is no problem in it. So,I think it is a bug in clickhouse.

I know it's kind of strange that the column alias is the same as the column in the table,but it is tableau's behaviour and I can hardly change it.

@assassinors assassinors added the bug Confirmed user-visible misbehaviour in official release label Aug 2, 2021
@kitaisreal kitaisreal self-assigned this Aug 2, 2021
@kitaisreal
Copy link
Collaborator

It is related to identifier resolving. We have task that will fix that #23194.
As workaround you can specify different alias_name if possible.

select id, '1997-02-01' as create_time_test from test where test.create_time='1970-02-01 00:00:00'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release st-hold We've paused the work on issue for some reason
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants