diff --git a/token/token.go b/token/token.go index 14d76220..bc8b531c 100644 --- a/token/token.go +++ b/token/token.go @@ -339,9 +339,12 @@ func reservedKeywordToken(typ Type, value, org string, pos *Position) *Token { func init() { for _, keyword := range reservedNullKeywords { - reservedKeywordMap[keyword] = func(value, org string, pos *Position) *Token { + f := func(value, org string, pos *Position) *Token { return reservedKeywordToken(NullType, value, org, pos) } + + reservedKeywordMap[keyword] = f + reservedEncKeywordMap[keyword] = f } for _, keyword := range reservedBoolKeywords { f := func(value, org string, pos *Position) *Token { diff --git a/token/token_test.go b/token/token_test.go index dc1b4df0..27565fbb 100644 --- a/token/token_test.go +++ b/token/token_test.go @@ -121,6 +121,10 @@ func TestIsNeedQuoted(t *testing.T) { " a", " a ", "a ", + "null", + "Null", + "NULL", + "~", } for i, test := range needQuotedTests { if !token.IsNeedQuoted(test) {