Skip to content

Commit

Permalink
changed to parse empty columns; fixed formatting for empty columns
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cor committed Nov 19, 2021
1 parent 006e9b3 commit e3533db
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -3057,7 +3057,8 @@ func (node Columns) Format(buf *TrackedBuffer) {
if node == nil {
return
}
prefix := "("
buf.WriteString("(")
prefix := ""
for _, n := range node {
buf.Myprintf("%s%v", prefix, n)
prefix = ", "
Expand Down
4 changes: 2 additions & 2 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2611,10 +2611,10 @@ func TestKeywords(t *testing.T) {
output: "insert into t(a, b) values ('a', 'b')",
}, {
input: "insert into t() values ()",
output: "insert into t values ()",
output: "insert into t() values ()",
}, {
input: "insert into t() values (), (), ()",
output: "insert into t values (), (), ()",
output: "insert into t() values (), (), ()",
}, {
input: "select * from t where a > utc_timestmp()",
}, {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -4398,7 +4398,7 @@ insert_data:
}
| openb closeb VALUES tuple_list
{
$$ = &Insert{Rows: $4}
$$ = &Insert{Columns: []ColIdent{}, Rows: $4}
}
| select_statement
{
Expand Down

0 comments on commit e3533db

Please sign in to comment.