Skip to content

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

@akupila

Description

@akupila

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:

if len(node.Exprs) == 1 {
exprDoc = pretty.Concat(exprDoc, pretty.Text(","))
}

While this is equivalent, the output is a bit unexpected

Input

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

Output

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

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