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

Expected 'AS' in alias when SELECT #611

Open
Catwoolfii opened this issue Mar 18, 2024 · 2 comments
Open

Expected 'AS' in alias when SELECT #611

Catwoolfii opened this issue Mar 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Catwoolfii
Copy link

I'm just starting to try Proton and maybe I'm missing something or misunderstanding something.
I'm trying to run a request with pseudocode and getting an exception. This behavior is not reproduced in any version of Clickhouse.

How to reproduce

  1. Executing a query:
    SELECT x.* FROM (SELECT 'test' name) x

When executing query following exception is received:

Syntax error: failed at position 32 ('name'):

SELECT x.* FROM (SELECT 'test' name) x

Expected one of: NOT, BETWEEN, IS, AS, FROM, WHERE, PARTITION BY, SHUFFLE BY, GROUP BY, WITH, HAVING, WINDOW, ORDER BY, LIMIT, EMIT, SETTINGS, UNION
  1. Executing a query when an alias is created with the 'AS' keyword:
    SELECT x.* FROM (SELECT 'test' AS name) AS x

When executing query following output is received:

┌─name─┐
│ test │
└──────┘

1 row in set. Elapsed: 0.001 sec.

Additional context
I expect that such queries should be executed without exceptions, since the keyword 'AS' is optional.

@Catwoolfii Catwoolfii added the bug Something isn't working label Mar 18, 2024
@Sake169
Copy link

Sake169 commented Mar 18, 2024

yes, it may need an enhancement, i tried the clickhouse in the same query, it can work well,

@yl-lisen
Copy link
Collaborator

yl-lisen commented Mar 19, 2024

Thank you for your experience @Catwoolfii .
For some reasons, we must use explicit aliases for tables via AS keyword.
Usually, we always recommend using AS to define aliases everywhere, which is more understandable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants