sqlite-utils/tests
ethanhawkes-gif 43d5d3331f
Emit LIMIT -1 when offset is used without limit (#821)
* Emit LIMIT -1 when offset is used without limit, closes #816

SQLite requires a LIMIT clause to appear before OFFSET, so passing offset
without limit generated invalid SQL such as:

    select * from "t" offset 2

which raised OperationalError: near "2": syntax error.

A negative limit means "no upper bound" in SQLite, so "limit -1 offset N"
returns all rows from position N onwards.

Fixed in three places that build LIMIT/OFFSET SQL:

- Queryable.rows_where() - also covers pks_and_rows_where()
- Table.search_sql() - also covers search()
- the "sqlite-utils rows" CLI command

* Remove duplicate comments

---------

Co-authored-by: ethanhawkes-gif <259455325+ethanhawkes-gif@users.noreply.github.com>
2026-08-11 22:52:43 -07:00
..
sniff sqlite-utils insert --sniff option, closes #230 2021-02-14 11:23:12 -08:00
__init__.py Initial project layout + database table creation tools 2018-07-28 06:46:17 -07:00
conftest.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
ext.c Support entrypoints for --load-extension (#473) 2022-08-26 22:55:47 -07:00
test_analyze.py Use sqlean if available in environment (#560) 2023-06-25 16:25:51 -07:00
test_analyze_tables.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_atomic.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_attach.py db.attach(alias, filepath) method, closes #113 2021-02-18 20:56:32 -08:00
test_cli.py Emit LIMIT -1 when offset is used without limit (#821) 2026-08-11 22:52:43 -07:00
test_cli_bulk.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_cli_convert.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_cli_insert.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_cli_memory.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_cli_migrate.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_column_affinity.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_column_casing.py Match column names case-insensitively, closes #760 2026-07-05 22:11:22 -07:00
test_constructor.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_conversions.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_convert.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_create.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_create_table_parser.py Preserve column before/after comments through .transform() 2026-08-11 22:45:00 -07:00
test_create_view.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_default_value.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_delete.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_docs.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_duplicate.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_enable_counts.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_extract.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_extracts.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_foreign_keys.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_fts.py Emit LIMIT -1 when offset is used without limit (#821) 2026-08-11 22:52:43 -07:00
test_get.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_gis.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_hypothesis.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_insert_files.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_introspect.py table.checks, table.column_checks, table.table_checks, closes #834 2026-08-11 22:45:00 -07:00
test_list_mode.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_lookup.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_m2m.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_migrations.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_mutator_transactions.py .transform() preserves check constraints, refs #762 2026-08-11 22:45:00 -07:00
test_plugins.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_query.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_recipes.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_recreate.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_register_function.py Database as a context manager, fixed many pytest warnings 2025-12-11 16:56:12 -08:00
test_rows.py Emit LIMIT -1 when offset is used without limit (#821) 2026-08-11 22:52:43 -07:00
test_rows_from_file.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_sniff.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_suggest_column_types.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_tracer.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_transform.py Preserve column before/after comments through .transform() 2026-08-11 22:45:00 -07:00
test_update.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_upsert.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_utils.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00
test_wal.py Fixes for Ruff>=0.16.0 (#814) 2026-07-25 14:53:12 -07:00