cockroachdb / cockroachdb/cockroachdb-parser

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

Aperta
#10 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
43
Fork
12
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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',);
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.