parse error
func main() { sql := "SELECT * FROM table WHERE a = 'abc'" stmt, err := sqlparser.Parse(sql) if err != nil { fmt.Printf("%s",err.Error()) }
// Otherwise do something with stmt
switch stmt := stmt.(type) {
case *sqlparser.Select:
_ = stmt
case *sqlparser.Insert:
}
fmt.Printf("stmt :%v", stmt)
}
result err: syntax error at position 20 near 'table'
Table is a reserved word. Either wrap it in backtics or use a different name for your table.
On Fri, 10 Sep 2021, 12:58 am xinlushi, @.***> wrote:
func main() { sql := "SELECT * FROM table WHERE a = 'abc'" stmt, err := sqlparser.Parse(sql) if err != nil { fmt.Printf("%s",err.Error()) }
// Otherwise do something with stmt switch stmt := stmt.(type) { case *sqlparser.Select: _ = stmt case *sqlparser.Insert: }
fmt.Printf("stmt :%v", stmt)
}
result err: syntax error at position 20 near 'table'stmt :
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xwb1989/sqlparser/issues/68, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABHG4YUIQS3UPWCFL6U2B3UBG3A3ANCNFSM5DYZCVUA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Please replace the example, this is the code of the example
There is a table in the database ‘information_schema’ as ‘tables’, this problem causes this table to be accessed abnormally