Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sqlite_utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2003,6 +2003,9 @@ def rows_where(
if limit is not None:
sql += f" limit {limit}"
if offset is not None:
# SQLite requires LIMIT when OFFSET is used (issue #816).
if limit is None:
sql += " limit -1"
sql += f" offset {offset}"
cursor = self.db.execute(sql, where_args or [])
columns = dedupe_keys(c[0] for c in cursor.description)
Expand Down Expand Up @@ -3594,6 +3597,9 @@ def search_sql(
if limit is not None:
limit_offset += f" limit {limit}"
if offset is not None:
# SQLite requires LIMIT when OFFSET is used (issue #816).
if limit is None and " limit " not in limit_offset:
limit_offset += " limit -1"
limit_offset += f" offset {offset}"
return sql.format(
dbtable=quote_identifier(self.name),
Expand Down
Loading