Commit Graph

5185 Commits

Author SHA1 Message Date
Levy A.
96e3f7bc5c refactor: remove magic number 2025-06-11 14:19:06 -03:00
Levy A.
8ecc561cd3 refactor: dereference impl Copy 2025-06-11 14:19:06 -03:00
Levy A.
e7ccb0b707 fix: prevent duplicate columns 2025-06-11 14:19:06 -03:00
Levy A.
e3da5a1f09 fix: clippy 2025-06-11 14:19:06 -03:00
Levy A.
3b36c3e771 refactor 2025-06-11 14:19:06 -03:00
Levy A.
dd0551b6f9 improve fuzzing 2025-06-11 14:19:06 -03:00
Levy A.
01a680b69e feat(fuzz)+fix: add schema fuzz testing and fix some bugs 2025-06-11 14:19:06 -03:00
Levy A.
54e8e7f097 fix spacing 2025-06-11 14:19:06 -03:00
Levy A.
b88cb99ff0 fix warnings and some refactoring 2025-06-11 14:19:06 -03:00
Levy A.
1881cd04b5 chore: fmt 2025-06-11 14:19:06 -03:00
Levy A.
49a6ddad97 wip 2025-06-11 14:19:04 -03:00
Levy A.
c2f25b6a1d fix: proper identifier normalization and column constraints 2025-06-11 14:18:41 -03:00
Levy A.
0bb725899d fix: set is_rowid_alias 2025-06-11 14:18:41 -03:00
Levy A.
d65fe0f978 refactor: simplification and better names 2025-06-11 14:18:41 -03:00
Levy A.
a7761e431b fix: escape string literals 2025-06-11 14:18:41 -03:00
Levy A.
41cb13aa74 fix: ignore non-constants 2025-06-11 14:18:41 -03:00
Levy A.
15e0cab8d8 refactor+fix: precompute default values from schema 2025-06-11 14:18:39 -03:00
Levy A.
7638b0dab7 fix: use default value on empty columns added via ALTER TABLE 2025-06-11 14:18:19 -03:00
Levy A.
326a8b39db fix: default values not being converted to SQL 2025-06-11 14:17:36 -03:00
Levy A.
6945c0c09e fix+refactor: incorrect label placement
also added a `cursor_loop` helper on `ProgramBuilder` to avoid making
this mistake in the future. this is zero-cost, and will be optimized to
the same thing (hopefully).
2025-06-11 14:17:36 -03:00
Levy A.
6d0a3c95c6 more tests! 2025-06-11 14:17:36 -03:00
Levy A.
db7bee41c3 restore fuzz/Cargo.lock 2025-06-11 14:17:36 -03:00
Levy A.
fa621115b5 fix: broken test 2025-06-11 14:17:36 -03:00
Levy A.
3bc24eb86f feat: proper column definition parsing 2025-06-11 14:17:36 -03:00
Levy A.
f92e000277 fix: remove unused variable 2025-06-11 14:17:36 -03:00
Levy A.
587cf345cc refactor: merge branches 2025-06-11 14:17:36 -03:00
Levy A.
d8bc8c48c3 add constraint dropping tests 2025-06-11 14:17:36 -03:00
Levy A.
91f981a8b1 fix(compat): sqlite firt checks if old_table exists
something like `ALTER TABLE a RENAME TO a` should fail with
`no such table: a` if `a` doesn't exists.
2025-06-11 14:17:36 -03:00
Levy A.
65b6984c2a fix: make sure to not modify a index 2025-06-11 14:17:36 -03:00
Levy A.
5f25ed0738 fix UNIQUE constraints 2025-06-11 14:17:36 -03:00
Levy A.
de2ac89ad2 feat: complete ALTER TABLE implementation 2025-06-11 14:17:36 -03:00
Jussi Saurio
6bb10d4d45 Merge 'Disable index usage in DELETE because it does not work safely' from Jussi Saurio
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1715
2025-06-11 12:23:03 +03:00
Jussi Saurio
e9d1f0823b Disable index usage in DELETE because it does not work safely 2025-06-11 12:15:20 +03:00
Jussi Saurio
32cacd81ef Merge 'Add affinity-based type coercion for seek and comparison operation' from Krishna Vishal
This PR implements SQLite-compatible affinity-based type coercion for
seek operations and comparison operators, bringing Limbo's behavior
closer to SQLite's type conversion rules.
### Key Changes
- Added affinity handling to all comparison operators (`Eq`, `Ne`, `Lt`,
`Le`, `Gt`, `Ge`).
- Added `get_expr_affinity()` to determine expression affinity based on
column types and casts.
- Added affinity functionality `CmpInsFlags` which carries the affinity
information from translation layer to execution layer.
- Added comprehensive `apply_numeric_affinity()` function that handles
many edge cases when converting to numerical quantities.
- Implemented `comparison_affinity()` that follows SQLite's affinity
precedence rules.
- Added fuzz tests for partial numeric strings, hex literals, and
various numeric formats.
### SQLite Compatibility Improvements
This implementation now correctly handles cases like:
- `SELECT * FROM t WHERE x < X'41'` (blob comparisons)
- `SELECT * FROM t WHERE x < '123abc'` (partial numeric strings)
- `SELECT * FROM t WHERE x < 4.9 ` (float precision in seeks)
- Mixed-type comparisons with proper affinity conversion
Thanks 🤝@PThorpe92 and @pedrocarlo for helping improve my planner
understanding.
Closes: https://github.com/tursodatabase/limbo/issues/1607

Closes #1680
2025-06-11 09:52:02 +03:00
Jussi Saurio
b30ed90bea Merge 'sim/aws: fix vibecoding errors in logic' from Jussi Saurio
- Entire stdout+stderr was passed to both title and body for the github
issue, resulting in a failure due to github's validation
Fixes:
- Pass only the line containing "simulation failed:" as title
- Pass max 50 lines following title as body
- Truncate title and body to 255 and 65536 chars respectively before
posting github issue, just to be sure

Closes #1711
2025-06-11 09:45:58 +03:00
Jussi Saurio
0acce8d035 Merge 'Simulator: Better Shrinking' from Pedro Muniz
This PR attempts to get the specific query that failed in the simulator
and get the correct tables that were used in the Query. Also, implements
a fix where after clearing miscellaneous queries, we did not check again
if the the interaction still referenced any of the tables that were
involved in the failure.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1712
2025-06-11 09:45:48 +03:00
Jussi Saurio
4d45577c5a Merge 'Simulator integrity_check' from Pedro Muniz
Adds a Sqlite integrity check after the simulator completes a run. Also
changed error handling in the simulator to use `anyhow` to lazily add
context to error methods instead of eagerly using `.or` and losing the
original error.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1697
2025-06-11 09:45:38 +03:00
pedrocarlo
cf1983ccfe retain the last failing interaction + remove select properties 2025-06-11 03:14:31 -03:00
pedrocarlo
63cf648e2e filter for the tables that the failing query depended on + second pass after query clear 2025-06-11 02:52:26 -03:00
Jussi Saurio
f276ff0b72 sim/aws: fix vibecoding errors in logic
- Entire stdout+stderr was passed to both title and body for the github
  issue, resulting in a failure due to github's validation

Fixes:

- Pass only the line containing "simulation failed:" as title
- Pass max 50 lines following title as body
- Truncate title and body to 255 and 65536 chars respectively
  before posting github issue, just to be sure
2025-06-11 08:40:04 +03:00
Krishna Vishal
1c6a65ded4 Change seek op match from unit variants to struct variants. 2025-06-11 00:44:07 +05:30
Krishna Vishal
7db6e2dfea Decrease db rows and increase random values 2025-06-11 00:33:48 +05:30
Krishna Vishal
0d5cbc4f1d Add affinity check as a function as ast::Operator impl 2025-06-11 00:33:48 +05:30
Krishna Vishal
712c94537c Add affinity flags to IS and IS NOT opeartors 2025-06-11 00:33:48 +05:30
krishvishal
c8da564aeb smol edit 2025-06-11 00:33:48 +05:30
krishvishal
5a1da026e6 Unify comparison function to reduce code duplication 2025-06-11 00:33:47 +05:30
krishvishal
5837f7329f clean up 2025-06-11 00:33:47 +05:30
krishvishal
e01f4d55f7 Reduce fuzz iters 2025-06-11 00:33:47 +05:30
krishvishal
d13abad4b1 Handle Blob type together with Text type in op_seek 2025-06-11 00:33:47 +05:30
krishvishal
6c04c18f87 Add affinity flag to comparison opcodes 2025-06-11 00:33:47 +05:30