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

Date arithmetic INTERVAL keyword not handled correctly #14

Closed
ikirker opened this issue May 25, 2017 · 2 comments
Closed

Date arithmetic INTERVAL keyword not handled correctly #14

ikirker opened this issue May 25, 2017 · 2 comments

Comments

@ikirker
Copy link

ikirker commented May 25, 2017

Minimal example:

package main

import (
    "fmt"
    "github.com/xwb1989/sqlparser"
)

func main() {
    sql := "SELECT DATE_SUB(NOW(), INTERVAL 1 MONTH)"
    tree, err := sqlparser.Parse(sql)
    if err != nil {
        fmt.Println("Error: ", err)
        panic("oh no")
    }
    fmt.Println(tree)
}
$ go run main.go
Error:  syntax error at position 34 near 1
panic: oh no

[trace info]

Looks like it's failing to handle the MONTH after INTERVAL.

@bramp
Copy link
Collaborator

bramp commented Sep 17, 2017

This issue seems fixed by d093d02 (Imported the latest https://github.com/youtube/vitess sqlparser)

@bramp
Copy link
Collaborator

bramp commented Oct 19, 2017

Closing this issue. Feel free to reopen with an example if you still encounter the issue.

@bramp bramp closed this as completed Oct 19, 2017
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