Skip to content

Commit

Permalink
Fix: allow joins in FROM expression parser (#3389)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas committed May 1, 2024
1 parent cc6259d commit 0d23b20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ class Parser(metaclass=_Parser):
exp.Condition: lambda self: self._parse_conjunction(),
exp.DataType: lambda self: self._parse_types(allow_identifiers=False),
exp.Expression: lambda self: self._parse_expression(),
exp.From: lambda self: self._parse_from(),
exp.From: lambda self: self._parse_from(joins=True),
exp.Group: lambda self: self._parse_group(),
exp.Having: lambda self: self._parse_having(),
exp.Identifier: lambda self: self._parse_id_var(),
Expand Down
4 changes: 4 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ def test_build(self):
lambda: exp.update("tbl", {"x": 1}, from_="tbl2"),
"UPDATE tbl SET x = 1 FROM tbl2",
),
(
lambda: exp.update("tbl", {"x": 1}, from_="tbl2 cross join tbl3"),
"UPDATE tbl SET x = 1 FROM tbl2 CROSS JOIN tbl3",
),
(
lambda: union("SELECT * FROM foo", "SELECT * FROM bla"),
"SELECT * FROM foo UNION SELECT * FROM bla",
Expand Down

0 comments on commit 0d23b20

Please sign in to comment.