fix #2224: make influxql keywords case insensitive
parent
5bfdba0348
commit
c2b61af3a1
|
@ -1,5 +1,8 @@
|
|||
## v0.9.0-rc22 [unreleased]
|
||||
|
||||
### Bugfixes
|
||||
- [#2225](https://github.com/influxdb/influxdb/pull/2225): Make keywords completely case insensitive
|
||||
|
||||
### Features
|
||||
- [#2214](https://github.com/influxdb/influxdb/pull/2214): Added the option to influx CLI to execute single command and exit. Thanks @n1tr0g
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ func TestScanner_Scan(t *testing.T) {
|
|||
{s: `WITH`, tok: influxql.WITH},
|
||||
{s: `WRITE`, tok: influxql.WRITE},
|
||||
{s: `explain`, tok: influxql.EXPLAIN}, // case insensitive
|
||||
{s: `seLECT`, tok: influxql.SELECT}, // case insensitive
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
|
|
|
@ -231,11 +231,9 @@ var keywords map[string]Token
|
|||
func init() {
|
||||
keywords = make(map[string]Token)
|
||||
for tok := keyword_beg + 1; tok < keyword_end; tok++ {
|
||||
keywords[strings.ToUpper(tokens[tok])] = tok
|
||||
keywords[strings.ToLower(tokens[tok])] = tok
|
||||
}
|
||||
for _, tok := range []Token{AND, OR} {
|
||||
keywords[strings.ToUpper(tokens[tok])] = tok
|
||||
keywords[strings.ToLower(tokens[tok])] = tok
|
||||
}
|
||||
keywords["true"] = TRUE
|
||||
|
@ -280,7 +278,7 @@ func tokstr(tok Token, lit string) string {
|
|||
|
||||
// Lookup returns the token associated with a given string.
|
||||
func Lookup(ident string) Token {
|
||||
if tok, ok := keywords[ident]; ok {
|
||||
if tok, ok := keywords[strings.ToLower(ident)]; ok {
|
||||
return tok
|
||||
}
|
||||
return IDENT
|
||||
|
|
Loading…
Reference in New Issue