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
parser/clickhouse: table functions in FROM (numbers(10), remote(...)) fail to parse #606
ClickHouse table functions in FROM, such as numbers(N), remote(...), file(...) and url(...), are rejected because function-call table references are enabled only for Snowflake, BigQuery and PostgreSQL.
Reproduction
gosqlx.ParseWithDialect(sql, keywords.DialectClickHouse) on main 61ca6c8:
SELECT * FROM numbers(10) -> E2002 at 1:22 expected statement, got LPAREN
SELECT number FROM numbers(10) AS n -> E2002 at 1:27 expected statement, got LPAREN
SELECT * FROM remote('host', db, tbl) -> E2002 at 1:21 expected statement, got LPAREN
SELECT * FROM t, numbers(3) -> E2002 at 1:25 expected statement, got LPAREN
Expected: each parses into a TableReference with TableFunc set, as generate_series(1,10) does in the PostgreSQL dialect.
Notes
pkg/sql/parser/pivot.go:295supportsTableFunction() lists only Snowflake, BigQuery and PostgreSQL. The call site is pkg/sql/parser/select_subquery.go:121. Adding ClickHouse is probably enough to parse these. The default dialect also rejects FROM generate_series(1,10) g. Whether to enable it there is a separate decision.
These references are also dropped on render. That is filed separately (TableFunc arguments missing from SQL()/formatter output), and it should be fixed together with this one, or enabling ClickHouse will produce lossy output.
Activity
fix(parser/clickhouse): parse table functions in FROM (numbers, remot…