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

SQL syntax parsing exception when the field name in the SQL statement is error #846

Closed
bloodsucker1 opened this issue May 6, 2020 · 1 comment · Fixed by #851
Closed
Labels
severity/minor type/bug Something isn't working

Comments

@bloodsucker1
Copy link

bloodsucker1 commented May 6, 2020

Bug Report

SQL syntax parsing exception when the field name in the SQL statement is error,

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
func TestExample(t *testing.T) {
	p := parser.New()
	stmtNodes, _, err := p.Parse("select message_id,error,update_time from test", "", "")
	fmt.Println(stmtNodes[0], err)
}
  1. What did you expect to see?
    Get sql syntax tree

  2. What did you see instead?
    Syntax parsing exception

panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0
goroutine 36 [running]:
  1. What version of TiDB SQL Parser are you using?
    v0.0.0-20200218113622-517beb2e39c2
@kennytm kennytm added the type/bug Something isn't working label May 10, 2020
@kennytm
Copy link
Contributor

kennytm commented May 10, 2020

Thanks for the bug report. ERROR is not a reserved word in MySQL 8.0 (there is no (R) in https://dev.mysql.com/doc/refman/8.0/en/keywords.html), but was classified as one in the parser.

The other keywords with the same problem:

  • chain
  • error
  • general
  • nvarchar
  • pack_keys
  • parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants