Support an alternative form of ClickHouse ANY JOIN
bug
**Describe the bug**
Even though ClickHouse's [documented JOIN syntax](https://clickhouse.com/docs/sql-reference/statements/select/join) is
```
SELECT <expr_list>
FROM <left_table>
[GLOBAL] [INNER|LEFT|RIGHT|FULL|CROSS] [OUTER|SEMI|ANTI|ANY|ALL|ASOF] JOIN <right_table>
(ON <expr_list>)|(USING <column_list>) ...
```
it allows writing `LEFT ANY JOIN` as `ANY LEFT JOIN` (even the above doc uses the latter syntax). However, sqlfmt doesn't support this alternative form yet.
**To Reproduce**
Given the input
```sql
select long_column_name from a any left join b on a.long_id_column_name = b.long_id_column_name
```
**Expected behavior**
...the formatted code should be
```sql
select long_column_name
from a
any left join b on a.long_id_column_name = b.long_id_column_name
```
**Actual behavior**
...but it is
```sql
select long_column_name
from a any
left join b on a.long_id_column_name = b.long_id_column_name
```
**Additional context**
I'm using sqlfmt via pre-commit with the following configuration
```yaml
- repo: https://github.com/tconbeer/sqlfmt
rev: v0.28.1
hooks:
- id: sqlfmt
language_version: python
args: ["--dialect", "clickhouse"]
additional_dependencies: ['.[jinjafmt]']
```
关闭于 2025-10-24 2 条评论