Skip to content

Commit

Permalink
Feat: parse alias in tuples
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Aug 8, 2023
1 parent b639754 commit 12a66dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3710,7 +3710,11 @@ def _parse_bracket(self, this: t.Optional[exp.Expression]) -> t.Optional[exp.Exp
self.expression(exp.Slice, expression=self._parse_conjunction())
]
else:
expressions = self._parse_csv(lambda: self._parse_slice(self._parse_conjunction()))
expressions = self._parse_csv(
lambda: self._parse_slice(
self._parse_alias(self._parse_conjunction(), explicit=True)
)
)

# https://duckdb.org/docs/sql/data_types/struct.html#creating-structs
if bracket_kind == TokenType.L_BRACE:
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/identity.sql
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ x IN ('a', 'a''a')
x IN ((1))
x BETWEEN -1 AND 1
x BETWEEN 'a' || b AND 'c' || d
((a, b) AS c)
NOT x IS NULL
x IS TRUE
x IS FALSE
Expand Down

0 comments on commit 12a66dd

Please sign in to comment.