diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-22 07:22:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-12-22 07:23:29 +0000 |
commit | d5c2cca0ebcd090fb36660f7f900b75452782aa5 (patch) | |
tree | 9169d15c801dda9ff3f417a886f4c3e4b9bd2308 /sqlglot/parser.py | |
parent | Releasing debian version 10.2.6-1. (diff) | |
download | sqlglot-d5c2cca0ebcd090fb36660f7f900b75452782aa5.tar.xz sqlglot-d5c2cca0ebcd090fb36660f7f900b75452782aa5.zip |
Merging upstream version 10.2.9.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/parser.py')
-rw-r--r-- | sqlglot/parser.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/sqlglot/parser.py b/sqlglot/parser.py index 55ab453..29bc9c0 100644 --- a/sqlglot/parser.py +++ b/sqlglot/parser.py @@ -562,6 +562,7 @@ class Parser(metaclass=_Parser): TRANSACTION_KIND = {"DEFERRED", "IMMEDIATE", "EXCLUSIVE"} STRICT_CAST = True + LATERAL_FUNCTION_AS_VIEW = False __slots__ = ( "error_level", @@ -1287,16 +1288,26 @@ class Parser(metaclass=_Parser): return None if not this: - this = self._parse_function() - - table_alias = self._parse_id_var(any_token=False) + this = self._parse_function() or self._parse_id_var(any_token=False) + while self._match(TokenType.DOT): + this = exp.Dot( + this=this, + expression=self._parse_function() or self._parse_id_var(any_token=False), + ) columns = None - if self._match(TokenType.ALIAS): - columns = self._parse_csv(self._parse_id_var) - elif self._match(TokenType.L_PAREN): - columns = self._parse_csv(self._parse_id_var) - self._match_r_paren() + table_alias = None + if view or self.LATERAL_FUNCTION_AS_VIEW: + table_alias = self._parse_id_var(any_token=False) + if self._match(TokenType.ALIAS): + columns = self._parse_csv(self._parse_id_var) + else: + self._match(TokenType.ALIAS) + table_alias = self._parse_id_var(any_token=False) + + if self._match(TokenType.L_PAREN): + columns = self._parse_csv(self._parse_id_var) + self._match_r_paren() expression = self.expression( exp.Lateral, |