Skip to content

Commit 89976c1

Browse files
authored
Fix(parser): allow 'cube' to be used for identifiers (#3850)
1 parent d00ea9c commit 89976c1

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

sqlglot/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ class Parser(metaclass=_Parser):
393393
TokenType.COMMIT,
394394
TokenType.CONSTRAINT,
395395
TokenType.COPY,
396+
TokenType.CUBE,
396397
TokenType.DEFAULT,
397398
TokenType.DELETE,
398399
TokenType.DESC,
@@ -3827,7 +3828,7 @@ def _parse_group(self, skip_group_by_token: bool = False) -> t.Optional[exp.Grou
38273828
while True:
38283829
expressions = self._parse_csv(
38293830
lambda: None
3830-
if self._match(TokenType.ROLLUP, advance=False)
3831+
if self._match_set((TokenType.CUBE, TokenType.ROLLUP), advance=False)
38313832
else self._parse_assignment()
38323833
)
38333834
if expressions:

tests/fixtures/identity.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ SELECT name
868868
SELECT copy
869869
SELECT rollup
870870
SELECT unnest
871+
SELECT cube, cube.x FROM cube
871872
SELECT * FROM a STRAIGHT_JOIN b
872873
SELECT COUNT(DISTINCT "foo bar") FROM (SELECT 1 AS "foo bar") AS t
873874
SELECT vector

0 commit comments

Comments
 (0)