Skip to content

Commit

Permalink
Fix: parse query modifiers for ddl selects (#1703)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesittas authored May 30, 2023
1 parent 910166c commit 611c234
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4135,8 +4135,8 @@ def _parse_select_or_expression(self, alias: bool = False) -> t.Optional[exp.Exp
)

def _parse_ddl_select(self) -> t.Optional[exp.Expression]:
return self._parse_set_operations(
self._parse_select(nested=True, parse_subquery_alias=False)
return self._parse_query_modifiers(
self._parse_set_operations(self._parse_select(nested=True, parse_subquery_alias=False))
)

def _parse_transaction(self) -> exp.Expression:
Expand Down
3 changes: 3 additions & 0 deletions tests/dialects/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def test_bigquery(self):
self.validate_identity(
"SELECT * FROM (SELECT * FROM `t`) AS a UNPIVOT((c) FOR c_name IN (v1, v2))"
)
self.validate_identity(
"CREATE TABLE IF NOT EXISTS foo AS SELECT * FROM bla EXCEPT DISTINCT (SELECT * FROM bar) LIMIT 0"
)

self.validate_all('x <> ""', write={"bigquery": "x <> ''"})
self.validate_all('x <> """"""', write={"bigquery": "x <> ''"})
Expand Down

0 comments on commit 611c234

Please sign in to comment.