cockroachdb / cockroachdb/cockroachdb-parser

[sql/sem/tree]: Pretty-printed tuples are always formatted with comma

Đang mở
#10 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
43
Fork
12
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

We're using the `tree` package to format auto-generated SQL for tests. It's very useful for this, thanks for the work that has gone into this package.

One thing that we came across is that tuples are formatted with a trailing comma when there's a single item in it:

https://github.com/cockroachdb/cockroachdb-parser/blob/302c9ad52e1a81d9cf51398875c45333a1c6d635/pkg/sql/sem/tree/pretty.go#L1124-L1126

While this is equivalent, the output is a bit unexpected

Input

```sql
SELECT * FROM some_table WHERE (some_column IN ('abc'))
```

Output

```sql
SELECT * FROM some_table WHERE some_column IN ('abc',);
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.