Commit graph

2962 commits

Author SHA1 Message Date
Pere Diaz Bou
3f3e91927f fmt 2025-06-11 19:02:23 +02:00
Pere Diaz Bou
3b0b3f1db9 clippy 2025-06-11 18:38:56 +02:00
Pere Diaz Bou
a24e1b775c check order of rowids 2025-06-11 17:56:19 +02:00
Pere Diaz Bou
d3c646378a Cell coverage checker
We check cells and freeblocks do not overlap and the fragmentation is
correct.
2025-06-11 16:50:30 +02:00
pedrocarlo
cf34e21ba9 fix for bug caught in simulator regarding exec_if 2025-06-11 11:32:45 -03:00
pedrocarlo
f230703279 move numeric file for NonNan visibility 2025-06-11 11:32:17 -03:00
Anton Harniakou
4673e38dcb Check if a column has a not null constraint 2025-06-11 14:14:06 +03:00
Anton Harniakou
b72e95dc05 Implement NOT NULL constraint check for UPDATE 2025-06-11 12:28:11 +03:00
Jussi Saurio
e9d1f0823b Disable index usage in DELETE because it does not work safely 2025-06-11 12:15:20 +03:00
Pere Diaz Bou
9383ba207d introduce integrity_check pragma 2025-06-11 11:14:29 +02:00
Krishna Vishal
1c6a65ded4 Change seek op match from unit variants to struct variants. 2025-06-11 00:44:07 +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
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
krishvishal
f0dda1702f Fix AFFINITY_MASK value 2025-06-11 00:33:47 +05:30
krishvishal
faa9aedbae Add affinity based type coercion to comparison ops 2025-06-11 00:33:47 +05:30
krishvishal
7bd1589615 Added affinity inference and conversion for comparison ops.
Added affinity helper function for `CmpInsFlags`
2025-06-11 00:33:44 +05:30
krishvishal
9130b25111 Add jump_if_null flag for rowid alias based seeks 2025-06-11 00:33:05 +05:30
krishvishal
3b2980c7c0 Fix op_seek to handle affinity coercion 2025-06-11 00:33:05 +05:30
krishvishal
e68293a1d1 Add affinity conversion to op_gt, op_le, op_lt, op_eq, op_ne 2025-06-11 00:33:05 +05:30
krishvishal
30ccbe46c7 Added apply_numeric_affinity function to handle string conversion
to integer. Exising functions' behavior is tailored to `CAST` ops.
SQLite has different behavior when it comes to handling string to
`integer` conversion in CAST vs predicate ops.
2025-06-11 00:33:05 +05:30
krishvishal
20e6e73057 Fix affinity in op_seek when there's string integer comparison 2025-06-11 00:33:03 +05:30
krishvishal
2171c5f4e1 Added apply_affinity_char to fix bugs in SeekRowId 2025-06-11 00:31:09 +05:30
Jussi Saurio
72058da9dc Merge 'bindings/javascript: Add pragma() support' from Anton Harniakou
Some checks failed
JavaScript / stable - x86_64-unknown-linux-gnu - node@20 (push) Waiting to run
JavaScript / Test bindings on x86_64-apple-darwin - node@18 (push) Blocked by required conditions
JavaScript / Test bindings on x86_64-apple-darwin - node@20 (push) Blocked by required conditions
JavaScript / Test bindings on Linux-x64-gnu - node@18 (push) Blocked by required conditions
JavaScript / Test bindings on Linux-x64-gnu - node@20 (push) Blocked by required conditions
JavaScript / Build universal macOS binary (push) Blocked by required conditions
JavaScript / Publish (push) Blocked by required conditions
Python / check-requirements (push) Waiting to run
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / linux (x86_64) (push) Waiting to run
Python / macos-x86_64 (x86_64) (push) Waiting to run
Python / macos-arm64 (aarch64) (push) Waiting to run
Python / sdist (push) Waiting to run
Python / Release (push) Blocked by required conditions
Rust / cargo-fmt-check (push) Waiting to run
Rust / build-native (blacksmith-4vcpu-ubuntu-2404) (push) Waiting to run
Rust / build-native (macos-latest) (push) Waiting to run
Rust / build-native (windows-latest) (push) Waiting to run
Rust / clippy (push) Waiting to run
Rust / build-wasm (push) Waiting to run
Rust / test-limbo (push) Waiting to run
Rust / test-sqlite (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Rust Benchmarks+Nyrkiö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Run long fuzz tests on Btree / run-long-tests (push) Has been cancelled
Run long fuzz tests on Btree / simple-stress-test (push) Has been cancelled
This PR adds column names to the ouput of js pragma function.

Reviewed-by: Diego Reis (@el-yawd)
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1608
2025-06-10 18:24:13 +03:00
Jussi Saurio
4794b022a5 Merge 'Fix incorrect handling of OR clauses in HAVING' from Jussi Saurio
thanks to @pedrocarlo for reminding me we have this old-ass bug I never
bothered to fix

Closes #1708
2025-06-10 18:14:39 +03:00
Jussi Saurio
3d50822284 Merge 'fix: Incorrect placeholder label in where clause translation' from Pedro Muniz
Closes #1705

Closes #1707
2025-06-10 18:14:04 +03:00
Jussi Saurio
85972fd744 Merge 'Fix rowid to_sql_string' from Pedro Muniz
Addresses the panic encountered here:
https://github.com/tursodatabase/limbo/pull/1690 . Sorry about that.

Closes #1693
2025-06-10 18:11:51 +03:00
Jussi Saurio
18dd87eff1 Fix incorrect handling of OR clauses in HAVING 2025-06-10 18:02:14 +03:00
pedrocarlo
80c480517a incorrect placeholder label in where clause translation 2025-06-10 12:00:19 -03:00
Jussi Saurio
ace1e02fc0 Remove leftover info trace 2025-06-10 16:51:34 +03:00
pedrocarlo
36f60e4dd1 Fix rowid to_sql_string printing 2025-06-10 10:48:05 -03:00
Jussi Saurio
547ca6cf2a Fix incorrect usage of indexes with non-contiguous columns
Due to the left-prefix rule of indexes, for an index key to be usable,
it needs to:

- Use the columns in contiguous order (0, 1, 2...)
  * eg if WHERE refers to cols 0 and 2, only 0 can be used
- Stop at the first range operator
  * eg if WHERE: col1 = 5 AND col2 > 5 AND col3 = 5, only col1 and col2
    can be used.

This wasn't properly tested, and resulted in simulator failures. Added
some regression tests for this behavior.
2025-06-10 15:21:26 +03:00
Jussi Saurio
f8df870fb7 Fix implementation of InteriorNodeReplacement(interior index cell being deleted)
Some checks failed
Run long fuzz tests on Btree / run-long-tests (push) Has been cancelled
Run long fuzz tests on Btree / simple-stress-test (push) Has been cancelled
2025-06-10 14:16:26 +03:00
Jussi Saurio
6d2ca58235 get_prev_record() small fixes 2025-06-10 14:16:26 +03:00
Jussi Saurio
07c947b47d use GE for idx delete seek, although it doesnt really matter 2025-06-10 14:16:26 +03:00
Jussi Saurio
9caa8334be add FIXME about balance after interior node replacement 2025-06-10 14:16:26 +03:00
Jussi Saurio
10caca25c9 advance in balance_non_root() if -1 idx 2025-06-10 14:16:26 +03:00
Jussi Saurio
d827eeade0 For now always calculate post-balance seek key 2025-06-10 14:16:26 +03:00
Jussi Saurio
976c2f72ef OpIdxDeleteState needs another state to be re-entrant 2025-06-10 14:16:26 +03:00
Jussi Saurio
58172641fd Use SeekOP:LT after post-deletebalancing to end up pointing to the left of the deleted row 2025-06-10 14:16:26 +03:00
Jussi Saurio
e1bc268a65 fix CREATE TABLE hang 2025-06-10 14:16:26 +03:00
Jussi Saurio
a5aeff9a3d Fix index insert accidentally double-inserting after balance 2025-06-10 14:16:26 +03:00
Jussi Saurio
04e89c0c4a actually fix drop table 2025-06-10 14:16:26 +03:00
Jussi Saurio
843eb18daf simplify cursor.exists() by using seek() 2025-06-10 14:16:26 +03:00
Jussi Saurio
844461d20b update and delete fixes 2025-06-10 14:16:26 +03:00
Jussi Saurio
d81f5f67bd insert spaghetti fixes 2025-06-10 14:16:26 +03:00