Commit Graph

10673 Commits

Author SHA1 Message Date
Jussi Saurio
0bb87b060a Fix existing table btree backwards iteration logic 2025-04-09 10:14:29 +03:00
Jussi Saurio
d9bae633c0 Add rowid_seek_fuzz() test 2025-04-09 10:14:29 +03:00
Jussi Saurio
f5220d281d Fix off-by-one logic in btree table traversal 2025-04-09 10:14:29 +03:00
Jussi Saurio
fa295af635 Fix insert fuzz test by bypassing internal invariant 2025-04-09 10:14:29 +03:00
Jussi Saurio
024c63f808 optimizer: remove ORDER BY if index can be used to satisfy the order 2025-04-09 10:14:29 +03:00
Jussi Saurio
a706b7160a planner: support index backwards seeks and iteration 2025-04-09 10:14:29 +03:00
Jussi Saurio
c9190236f0 btree: support backwards index seeks and iteration 2025-04-09 10:14:29 +03:00
Jussi Saurio
3e42a62cd0 Add SeekLE/SeekLT operations to VDBE 2025-04-09 10:14:29 +03:00
Jussi Saurio
431ef2fa6a Add TCL/differential fuzz tests for verifying index scan behavior 2025-04-09 10:14:29 +03:00
Jussi Saurio
ed929d2a0a Merge 'Properly handle insertion of indexed columns' from Preston Thorpe
```console
limbo> create index p on products(price);
limbo> explain insert into products (name,price) values ('huh',32);
addr  opcode             p1    p2    p3    p4             p5  comment
----  -----------------  ----  ----  ----  -------------  --  -------
0     Init               0     17    0                    0   Start at 17
1     OpenWriteAsync     0     273   0                    0
2     OpenWriteAwait     0     0     0                    0
3     String8            0     3     0     huh            0   r[3]='huh'
4     Integer            32    4     0                    0   r[4]=32
5     OpenWriteAsync     1     297   0                    0
6     OpenWriteAwait     0     0     0                    0
7     NewRowId           0     1     0                    0
8     MakeRecord         2     3     5                    0   r[5]=mkrec(r[2..4])
9     InsertAsync        0     5     1                    0
10    InsertAwait        0     0     0                    0
11    Copy               4     6     0                    0   r[6]=r[4]
12    Copy               1     7     0                    0   r[7]=r[1]
13    MakeRecord         6     2     8                    0   r[8]=mkrec(r[6..7])
14    IdxInsertAsync     1     8     6                    0   key=r[8]
15    IdxInsertAwait     1     0     0                    0
16    Halt               0     0     0                    0
17    Transaction        0     1     0                    0   write=true
18    Null               0     2     0                    0   r[2]=NULL
19    Goto               0     1     0                    0
```
When an insert happens, we need to be sure to insert into the index
btree as well.

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

Closes #1265
2025-04-09 10:13:59 +03:00
Jussi Saurio
08b352cd81 Merge 'VTabs: Proper handling of re-opened db files without the relevant extensions loaded' from Preston Thorpe
closes #1239
![image](https://github.com/user-
attachments/assets/69b9f370-f622-45db-9c61-301991176da9)
warns the user if a .db file is opened that contains a schema entry of a
vtab created with a module that is no longer loaded.
If the module is loaded for that connection, the user can properly query
the table.

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

Closes #1244
2025-04-09 09:36:26 +03:00
PThorpe92
9b1e60a29c Fix typo in ext library lock err message 2025-04-08 20:10:50 -04:00
PThorpe92
41ac91f14f Add tests for parsing vtab creation sql in ParseSchema 2025-04-08 20:10:49 -04:00
PThorpe92
3a7f1e4056 Add comments explaining flow of reloading vtabs from schema tbl 2025-04-08 20:10:49 -04:00
PThorpe92
6b5ec1f07b Remove mut borrow from sym table in parse schema fn 2025-04-08 20:10:49 -04:00
PThorpe92
a0f71e27be Fix cli tests 2025-04-08 20:10:49 -04:00
PThorpe92
c15035caf8 Add module and vtab to schema after table is reopened with proper ext 2025-04-08 20:10:48 -04:00
PThorpe92
4b9b6c969b Parse schema rows after extensions are loaded 2025-04-08 20:10:47 -04:00
PThorpe92
3ad7d194cb Prevent panic on loading non-existent vtab module 2025-04-08 20:09:27 -04:00
PThorpe92
4b3c14369d Add testing.md document 2025-04-08 19:41:28 -04:00
PThorpe92
01184ec1d7 Add tracing-appender to log traces to file asyncronously 2025-04-08 19:36:38 -04:00
PThorpe92
570253b29f Adjust limbo run script to log to file during tests if RUST_LOG set 2025-04-08 19:32:51 -04:00
PThorpe92
2af447128f Add tracing log file to gitignore 2025-04-08 19:32:03 -04:00
alpaylan
c2411dbd64 Merge branch 'main' of https://github.com/tursodatabase/limbo 2025-04-08 17:48:20 -04:00
alpaylan
64c2917e81 add bug base, refactor 2025-04-08 17:48:16 -04:00
Pere Diaz Bou
ce7e0188f6 bring back i64 page sizes while balancing 2025-04-08 17:57:39 +02:00
Pere Diaz Bou
cf62099bf5 allow insertion of multiple overflow cells 2025-04-08 16:43:15 +02:00
Pere Diaz Bou
029da5c81c Improve readability of balance_non_root with comments and validation extraction 2025-04-08 16:43:15 +02:00
Pere Diaz Bou
e368cd1499 Merge 'Account divider cell in size while distributing cells' from Pere Diaz Bou
~~Moving cells from right to left involves moving cell that are from any
page in the right, from left to right, this means we update the size of
page of adjacent one only but not the last one. This is kinda weird but
it works. I might change it if it feels to weird.~~
Update: my previous analysis was obviously incorrect. Underflowing is
undesired behaviour and accounting for divider cell avoided it.

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

Closes #1269
2025-04-08 16:42:16 +02:00
Pekka Enberg
0ec12b0192 Merge 'Format infinite float as "Inf"/"-Inf"' from jachewz
## Issue
Numeric values outside the range of what f64 can represent are formatted
to strings as "Inf" or "-Inf" in sqlite, but they are "inf" and "-inf"
in limbo.
```
sqlite> SELECT 1.7976931348623157E+309;
Inf
```
```
limbo> SELECT 1.7976931348623157E+309;
┌─────────────────────────┐
│ 1.7976931348623157E+309 │
├─────────────────────────┤
│                     inf │
└─────────────────────────┘
```
closes #1248

Closes #1272
2025-04-08 16:52:36 +03:00
jachewz
12ae07874e fmt inf float str as "Inf"/"-Inf" 2025-04-08 23:33:34 +10:00
PThorpe92
224f913ae7 Handle composite key indexes on insert 2025-04-08 08:55:14 -04:00
PThorpe92
878c987026 Remove is_null check from create index translation 2025-04-08 08:55:14 -04:00
PThorpe92
1f29307fe8 Support proper index handling when doing insertions 2025-04-08 08:55:14 -04:00
Pere Diaz Bou
fded6ccaf3 rever iterations fuzz test 2025-04-08 14:09:17 +02:00
Pere Diaz Bou
c0c66bf8af remove wrong comment 2025-04-08 14:06:48 +02:00
Pere Diaz Bou
8c4003908f bring back usize, it shouldn't underflow 2025-04-08 14:05:30 +02:00
Pere Diaz Bou
40f8bbe132 clippy 2025-04-08 11:31:38 +02:00
Pere Diaz Bou
8e88b0cd14 new_page_sizes as Vec<i64> 2025-04-08 11:31:38 +02:00
Pere Diaz Bou
3950ab1e52 account for divider cell size in page size 2025-04-08 11:31:38 +02:00
Pere Diaz Bou
f7de575873 Merge 'update sqlite download version to 2025 + remove www.' from Pere Diaz Bou
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1271
2025-04-08 11:30:53 +02:00
Pere Diaz Bou
b83b51e973 remove www. prefix 2025-04-08 11:16:32 +02:00
Pere Diaz Bou
03f531417c update sqlite download version to 2025 2025-04-08 11:12:20 +02:00
Ihor Andrianov
ad91a2ae51 fix tests 2025-04-07 20:29:45 +03:00
Ihor Andrianov
7c15465118 add TypeCheck insn to update 2025-04-07 20:02:14 +03:00
Ihor Andrianov
3a97fd075f add tests 2025-04-07 20:02:14 +03:00
Ihor Andrianov
4a08b98bab implemented strict table 2025-04-07 20:01:39 +03:00
Pekka Enberg
33afc7cef3 Merge 'Improve validation of btree balancing' from Pere Diaz Bou
This pr sprinkles debug compile check to ensure things stay in a
reliable state.

Closes #1261
2025-04-07 19:35:00 +03:00
Pere Diaz Bou
6086284613 fix debug imports 2025-04-07 18:06:52 +02:00
Pere Diaz Bou
83f13596a4 decrease fuzz test steps again 2025-04-07 18:01:08 +02:00