vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.

Home Page:http://vitess.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go/vt/sqlparser: statement serialized incorrectly (2)

dvyukov opened this issue · comments

The following program fails:

package main

import (
    "fmt"
    "github.com/youtube/vitess/go/vt/sqlparser"
)

func main() {
    data := []byte("select a - -b from f")
    stmt, err := sqlparser.Parse(string(data))
    if err != nil {
        return
    }
    data1 := sqlparser.String(stmt)
    _, err = sqlparser.Parse(data1)
    if err != nil {
        fmt.Printf("data0: %q\n", data)
        fmt.Printf("data1: %q\n", data1)
        panic(err)
    }
}
data0: "select a - -b from f"
data1: "select a--b from f"
panic: syntax error at position 20

on commit 27bdc06