Skip to content

Commit

Permalink
Fix: offset subquery
Browse files Browse the repository at this point in the history
  • Loading branch information
tobymao committed Jul 22, 2023
1 parent 327451f commit f2f4084
Show file tree
Hide file tree
Showing 2 changed files with 2 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 @@ -2828,7 +2828,7 @@ def _parse_offset(self, this: t.Optional[exp.Expression] = None) -> t.Optional[e
if not self._match(TokenType.OFFSET):
return this

count = self._parse_number()
count = self._parse_term()
self._match_set((TokenType.ROW, TokenType.ROWS))
return self.expression(exp.Offset, this=this, expression=count)

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/identity.sql
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ SELECT * FROM test LIMIT 100
SELECT * FROM test LIMIT 1 + 1
SELECT * FROM test LIMIT 100 OFFSET 200
SELECT * FROM test LIMIT (SELECT 1)
SELECT * FROM test LIMIT (SELECT 1) OFFSET (SELECT 1)
SELECT * FROM test FETCH FIRST ROWS ONLY
SELECT * FROM test FETCH FIRST 1 ROWS ONLY
SELECT * FROM test ORDER BY id DESC FETCH FIRST 10 ROWS WITH TIES
Expand Down

0 comments on commit f2f4084

Please sign in to comment.