Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dvyukov opened this issue Jun 16, 2015 · 0 comments
Closed

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

dvyukov opened this issue Jun 16, 2015 · 0 comments

Comments

@dvyukov
Copy link
Contributor

dvyukov commented Jun 16, 2015

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

sougou added a commit that referenced this issue Jul 30, 2015
This fixes issue #798
where a construct like "a - -b" produced incorrect code.
I also found a related bug where a construct like "- -a"
also produced incorrect code.
This is also a potential vulnerability because "--" is
treated as a comment.
@sougou sougou closed this as completed Jul 30, 2015
rsajwani pushed a commit to planetscale/vitess that referenced this issue Aug 1, 2022
* clean error message upon RETRY

Signed-off-by: Shlomi Noach <[email protected]>

* auditing change of status, change of message, termination, finding stale migration

Signed-off-by: Shlomi Noach <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants