File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -545,6 +545,13 @@ class Parser(parser.Parser):
545545 TokenType .OPTION : lambda self : ("options" , self ._parse_options ()),
546546 }
547547
548+ # T-SQL does not allow BEGIN to be used as an identifier
549+ ID_VAR_TOKENS = parser .Parser .ID_VAR_TOKENS - {TokenType .BEGIN }
550+ ALIAS_TOKENS = parser .Parser .ALIAS_TOKENS - {TokenType .BEGIN }
551+ TABLE_ALIAS_TOKENS = parser .Parser .TABLE_ALIAS_TOKENS - {TokenType .BEGIN }
552+ COMMENT_TABLE_ALIAS_TOKENS = parser .Parser .COMMENT_TABLE_ALIAS_TOKENS - {TokenType .BEGIN }
553+ UPDATE_ALIAS_TOKENS = parser .Parser .UPDATE_ALIAS_TOKENS - {TokenType .BEGIN }
554+
548555 FUNCTIONS = {
549556 ** parser .Parser .FUNCTIONS ,
550557 "CHARINDEX" : lambda args : exp .StrPosition (
Original file line number Diff line number Diff line change @@ -558,8 +558,6 @@ class Parser(metaclass=_Parser):
558558 }
559559 ID_VAR_TOKENS .remove (TokenType .UNION )
560560
561- INTERVAL_VARS = ID_VAR_TOKENS - {TokenType .END }
562-
563561 TABLE_ALIAS_TOKENS = ID_VAR_TOKENS - {
564562 TokenType .ANTI ,
565563 TokenType .APPLY ,
Original file line number Diff line number Diff line change @@ -453,6 +453,9 @@ def test_tsql(self):
453453 },
454454 )
455455
456+ with self .assertRaises (ParseError ):
457+ parse_one ("SELECT begin" , read = "tsql" )
458+
456459 def test_option (self ):
457460 possible_options = [
458461 "HASH GROUP" ,
You can’t perform that action at this time.
0 commit comments