Skip to content

[FORMATTING] ClickHouse: ASOF LEFT JOIN and ANY LEFT JOIN are split into two lines #989

Closed as not planned

Description

@MunMunMiao

Input data

SELECT a FROM t1 ASOF LEFT JOIN t2 ON t1.k = t2.k AND t1.t >= t2.t ANY LEFT JOIN t3 USING (k)

Options: { language: 'clickhouse' }

Expected Output

SELECT
  a
FROM
  t1
  ASOF LEFT JOIN t2 ON t1.k = t2.k
  AND t1.t >= t2.t
  ANY LEFT JOIN t3 USING (k)

Actual Output

SELECT
  a
FROM
  t1 ASOF
  LEFT JOIN t2 ON t1.k = t2.k
  AND t1.t >= t2.t ANY
  LEFT JOIN t3 USING (k)

Usage

  • format(sql, { language: 'clickhouse' })
  • ClickHouse. The dialect only knows the join strictness after the join type (LEFT ASOF JOIN, LEFT ANY JOIN). ClickHouse also accepts it before the join type and documents it that way: ASOF LEFT JOIN in the ASOF JOIN section, and ANY LEFT JOIN in an example on the same page. So ASOF and ANY are left at the end of the previous line.
  • sql-formatter 15.9.0

A fix is in #987.


This was prepared with Claude Code (an AI coding assistant); the outputs above come from sql-formatter 15.9.0.

Activity

  1. MunMunMiao commented on Oct 14, 2026

    @MunMunMiao
    Author

    Closing for now: I'm going to handle the formatting on my side instead. Thanks for the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions