ClickHouse / ClickHouse/ClickHouse

clickhouse format --comment lost all comments

Open
#87,708 0 comments 1 reaction 0 assignees View on GitHub
comp-sql-syntax external unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
20h 33m
Merged PRs (30d)
501

Description

### Company or project name

_No response_

### Describe the unexpected behaviour

clickhouse-format drop all comments

### Which ClickHouse versions are affected?

25.8.7.3

### How to reproduce

```
$ chc --version
ClickHouse client version 25.8.7.3 (official build).

$ cat /tmp/q.sql
/* comment 1 */

-- comment 2

SELECT version();

/* comment 3 */

-- comment 4

SELECT version()

/* comment 5 */

-- comment 6
$ cat /tmp/q.sql | clickhouse-format --comments -n
SELECT version();

SELECT version();

```

### Expected behavior

Comments should remain

### Error message and/or stacktrace

N/A

### Additional context

Related to 62256

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.