Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#46314
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
Defined2014 authored and ti-chi-bot committed Aug 22, 2023
1 parent 8040e28 commit 76b4285
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,27 @@ func (s *Scanner) isTokenIdentifier(lit string, offset int) int {
// An identifier before or after '.' means it is part of a qualified identifier.
// We do not parse it as keyword.
if s.r.peek() == '.' {
<<<<<<< HEAD
return 0
}
if offset > 0 && s.r.s[offset-1] == '.' {
return 0
}
=======
return 0
}

for idx := offset - 1; idx >= 0; idx-- {
if s.r.s[idx] == ' ' {
continue
} else if s.r.s[idx] == '.' {
return 0
} else {
break
}
}

>>>>>>> 1769f3a1ac3 (parser: fix parser identifier with dot (#46314))
buf := &s.buf
buf.Reset()
buf.Grow(len(lit))
Expand Down
1 change: 1 addition & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ AAAAAAAAAAAA5gm5Mg==

{"select `t`.`1a`.1 from t;", true, "SELECT `t`.`1a`.`1` FROM `t`"},
{"select * from 1db.1table;", true, "SELECT * FROM `1db`.`1table`"},
{"select * from t where t. status = 1;", true, "SELECT * FROM `t` WHERE `t`.`status`=1"},

// for show placement
{"SHOW PLACEMENT", true, "SHOW PLACEMENT"},
Expand Down

0 comments on commit 76b4285

Please sign in to comment.