Skip to content

Commit

Permalink
Merge pull request #92 from dolthub/james/fix-2420-support-empty-cols…
Browse files Browse the repository at this point in the history
…-and-vals

parser can detect insert into <table> () values <tuple_list>
  • Loading branch information
jycor authored Nov 19, 2021
2 parents 1feb51c + e3533db commit ab01038
Show file tree
Hide file tree
Showing 4 changed files with 2,141 additions and 2,102 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
9 changes: 9 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,15 @@ func TestKeywords(t *testing.T) {
}, {
input: "insert into t(a, b) values (current_date, current_date())",
output: "insert into t(a, b) values (current_date(), current_date())",
}, {
input: "insert into t(a, b) values ('a', 'b')",
output: "insert into t(a, b) values ('a', 'b')",
}, {
input: "insert into t() values ()",
output: "insert into t() values ()",
}, {
input: "insert into t() values (), (), ()",
output: "insert into t() values (), (), ()",
}, {
input: "select * from t where a > utc_timestmp()",
}, {
Expand Down
Loading

0 comments on commit ab01038

Please sign in to comment.