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

Wrong query after sqlmesh format in Clickhouse dialect #4056

Closed
dnbnero opened this issue Mar 31, 2025 · 1 comment · Fixed by tobymao/sqlglot#4930
Closed

Wrong query after sqlmesh format in Clickhouse dialect #4056

dnbnero opened this issue Mar 31, 2025 · 1 comment · Fixed by tobymao/sqlglot#4930
Assignees
Labels
Bug Something isn't working

Comments

@dnbnero
Copy link

dnbnero commented Mar 31, 2025

After sqlmesh format clickhouse query is wrong if using values table function (https://clickhouse-docs.vercel.app/docs/sql-reference/table-functions/values)
Original query:

select
    type, id
from values(
    'id Int, type Int',
    (1, 1),
    (2, 1),
    (3, 1),
    (4, 1)
)

After format:

SELECT
  type,
  id
FROM (
  SELECT
    'id Int, type Int',
    (1, 1),
    (2, 1),
    (3, 1),
    (4, 1)
)

First query returining two columns and 4 rows, second query throws error

@georgesittas
Copy link
Contributor

georgesittas commented Mar 31, 2025

@VaggelisD can you take a look please? It seems like VALUES(...) is now supported in ClickHouse so SQLGlot needs to take that into account. This isn't related to sqlmesh format, it's an AST generation issue.

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

Successfully merging a pull request may close this issue.

3 participants