Commit Graph

3059 Commits

Author SHA1 Message Date
Zaid Humayun
2ff27834ff fix: addresses comment https://github.com/tursodatabase/limbo/pull/897#discussion_r1948154297 by @pereman2
this commit adds the final touches to the state machine for btree_destroy and also introduces a state machine for clear_overflow_pages
this addresses the issue of IO interrupting an operation in progress and solves the following problems:
* performance issues with repeating an operation
* missing page issues with clear overflow pages
2025-02-19 21:46:26 +05:30
Zaid Humayun
8ce305ad44 fixed compiler errors after rebase 2025-02-19 21:46:26 +05:30
Zaid Humayun
f7dc0d42df btree_destroy: implemented functionality with state machine 2025-02-19 21:46:26 +05:30
Zaid Humayun
07efc9b902 DROP TABLE: index drop
added missing instructions to drop the indices for a table physically from btree pages in a loop
2025-02-19 21:46:26 +05:30
Zaid Humayun
34f390abc9 cleanup: removed commented code 2025-02-19 21:46:26 +05:30
Zaid Humayun
e57e0cb497 tcl tests: added DROP TABLE tcl tests 2025-02-19 21:46:26 +05:30
Zaid Humayun
e0105398a6 btree: modified the btree_destroy subroutine
modified the btree_destroy subroutine to do an iterative DFS and use the stack cell counters to keep track of whether children have been removed. adds a unit test.
2025-02-19 21:46:26 +05:30
Zaid Humayun
dc2bb7cb9b DropTable: implementation complete
added helper methods to Schema to remove table and indices from in-memory structures
completed the implementation for DropTable using that
2025-02-19 21:46:26 +05:30
Zaid Humayun
40b08c559c vdbe: modified instruction DropTable
the instruction DropTable has been modified to correctly match SQLite semantics
2025-02-19 21:46:26 +05:30
Zaid Humayun
fbc8cd7e70 vdbe: modified the Null instruction
modified the Null instruction to more closely match SQLite semantics. Allows passing in a second register and all registers from r1..r2 area set to null
2025-02-19 21:46:26 +05:30
Zaid Humayun
97d87955cc DROP TABLE: renamed BTreeCusor::btree_drop to BTreeCursor::btree_destroy
this more closely matches semantics
2025-02-19 21:46:26 +05:30
Zaid Humayun
508dad77ab DROP TABLE: modified program instructions
correctly emitting constant instructions and also calling Destroy instead of DropTable instruction for removing btree pages
2025-02-19 21:46:25 +05:30
Zaid Humayun
713465c592 instruction: added destroy instruction
added required functionality for destroy. minor cleanup of print statements
2025-02-19 21:46:25 +05:30
Zaid Humayun
caab612901 resolved all conflicts after rebase from upstream/main 2025-02-19 21:46:25 +05:30
Zaid Humayun
b8bebf3fa3 translate: updated the command to more closely match SQLite semantics
the command for drop table translation has been updated so that it more closely matches the semantics of SQLite's drop table command.

there are a few more things missing like ephemeral tables, destroy etc.
2025-02-19 21:46:25 +05:30
Zaid Humayun
76e2d98381 drop table: addresses issue https://github.com/tursodatabase/limbo/issues/894 which requires DROP TABLE to be implemented
this is the initial commit is for the implementation of DROP TABLE. It adds support for the DROP TABLE instruction and adds a DropBTree instruction. It also implements the btree_drop method in btree.rs which makes use of free_page method which will be implemented via PR https://github.com/tursodatabase/limbo/pull/785
2025-02-19 21:46:25 +05:30
Pekka Enberg
8ac09b73bf extensions/uuid: Fix mimalloc version 2025-02-18 20:08:30 +02:00
Pekka Enberg
a783a4d17c extensions/time: Fix mimalloc version 2025-02-18 20:08:17 +02:00
Pekka Enberg
11a93900e3 extensions/core: Fix mimalloc version in README.md 2025-02-18 20:07:45 +02:00
Pekka Enberg
25f0694dfc extensions/series: Fix mimalloc version 2025-02-18 20:07:09 +02:00
Pekka Enberg
bd6083c66d extensions/regexp: Fix mimalloc version 2025-02-18 20:06:43 +02:00
Pekka Enberg
89202f0be3 extensions/percentile: Fix mimalloc version 2025-02-18 20:05:51 +02:00
Pekka Enberg
45a015f5c2 extensions/crypto: Fix mimalloc version 2025-02-18 20:05:10 +02:00
Pekka Enberg
9973c22137 core: Specify mimalloc version
The "*" version is not allowed on crates.io.
2025-02-18 19:40:00 +02:00
Pekka Enberg
f76d059aa2 scripts/publish-crates.sh: Remove dry run option 2025-02-18 19:38:47 +02:00
Pekka Enberg
185826f9f9 bindings/rust: Add description to Cargo.toml 2025-02-18 19:38:36 +02:00
Pekka Enberg
19903bbe5f extensions/uuid: Add description to Cargo.toml 2025-02-18 19:38:25 +02:00
Pekka Enberg
6cb6f6308f extensions/time: Add description to Cargo.toml 2025-02-18 19:38:04 +02:00
Pekka Enberg
e8d98250c2 extensions/series: Add description to Cargo.toml 2025-02-18 19:37:42 +02:00
Pekka Enberg
215fc66360 extensions/regexp: Add description to Cargo.toml 2025-02-18 19:36:36 +02:00
Pekka Enberg
38c76f1831 extensions/percentile: Add description to Cargo.toml 2025-02-18 19:36:10 +02:00
Pekka Enberg
237246b3ca extensions/crypto: Add description to Cargo.toml 2025-02-18 19:35:42 +02:00
Pekka Enberg
9b84e7e919 extensions/core: Add description to Cargo.toml 2025-02-18 19:34:32 +02:00
Pekka Enberg
c983888d33 Revert "Merge 'build: Update cargo-dist to latest' from Pekka Enberg"
This reverts commit 248a369afc, reversing
changes made to e464f99234. This is an
attempt to fix release process.
2025-02-18 19:06:36 +02:00
Pekka Enberg
d0b5aca0b5 build: Don't publish some bindings crates
...attempt to fix "cargo dist" failure.
2025-02-18 19:00:11 +02:00
Pekka Enberg
6bd7d6752e Limbo 0.0.15 2025-02-18 18:51:39 +02:00
Pekka Enberg
98010517d5 Merge 'Add affinity() function to Column' from Jussi Saurio
This is a first step to supporting [sqlite column
affinity](https://www.sqlite.org/datatype3.html) properly in limbo --
just adds an `affinity()` function to `Column` that can then be used
elsewhere

Closes #1030
2025-02-18 17:44:38 +02:00
Pekka Enberg
28a85edbc8 Merge 'Fix incorrect CAST text->numeric if valid prefix is 1 char long' from Jussi Saurio
Closes #1031
2025-02-18 17:44:01 +02:00
Pekka Enberg
48e705fb53 Merge 'Fix invalid text columns generated by dump' from Kingsley Yung
Fix #1012
In the INSERT statement generated by dump function, if the type affinity
of the value is TEXT, replace each single quotation mark with two single
quotation marks, and wrap it with single quotation marks.
Example:
```plaintext
limbo> CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(100));
INSERT INTO users (id, name) VALUES
(1, 'Alice'),
(2, 'Bob'),
(3, 'Char''lie');
SELECT * FROM users;

1|Alice
2|Bob
3|Char'lie
limbo> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR (100));
INSERT INTO users VALUES(1,'Alice');
INSERT INTO users VALUES(2,'Bob');
INSERT INTO users VALUES(3,'Char''lie');
COMMIT;
```

Closes #1034
2025-02-18 17:43:25 +02:00
Kingsley Yung
67ff5c4ae1 Fix invalid text columns generated by dump
In the INSERT statement generated by dump function, if the type affinity
of the value is TEXT, replace each single quotation mark with two single
quotation marks, and wrap it with single quotation marks.
2025-02-18 23:26:56 +08:00
Jussi Saurio
baf2aec3e9 Fix incorrect CAST text->numeric if valid prefix is 1 char long 2025-02-18 15:07:36 +02:00
Jussi Saurio
89e48a16db Add affinity() function to Column 2025-02-18 10:56:30 +02:00
Pekka Enberg
899ba8367e Merge 'Fix remainder panic on zero right-hand-side' from Jussi Saurio
Closes #1025
2025-02-18 10:08:23 +02:00
Pekka Enberg
76ca4c7b01 Merge 'Fix not evaling constant conditions when no tables in query' from Jussi Saurio
This PR is extracted from the sqlite fuzzing exploration effort in
https://github.com/tursodatabase/limbo/pull/1021
---
We were not evaluating constant conditions (e.g '1 IS NULL') when there
were no tables referenced in the query, because our WHERE term
evaluation was based on "during which loop" to evaluate them. However,
when there are no tables, there are no loops, so they were never
evaluated.

Closes #1023
2025-02-18 10:07:04 +02:00
Pekka Enberg
b25429d5a5 Merge 'Fix cli test for new output name' from Preston Thorpe
fixes CI failing for CLI tests after `raw` was renamed to output

Closes #1028
2025-02-18 08:56:01 +02:00
Pekka Enberg
e82aea6b8f Merge 'removing dangling limbo_output.txt file and setting rule in gitignore' from Pedro Muniz
When testing with `test-shell` the test may error and the error file
will be tracked in git. Added gitignore rule to always not track
`limbo_output.txt`

Closes #1027
2025-02-18 08:55:55 +02:00
PThorpe92
6a1f9ed773 Fix cli test for new output name 2025-02-17 22:33:55 -05:00
pedrocarlo
95246dec80 removing dangling limbo_output.txt file and setting rule in gitignore to prevent this issue in the future 2025-02-18 00:30:16 -03:00
Pekka Enberg
caa83b347e cli: Rename "raw" output mode to "list"
Change the name of the output mode to match SQLite.
2025-02-17 21:26:15 +02:00
Pekka Enberg
97601658a9 scripts: Add "publish-crates.sh" helper 2025-02-17 21:19:08 +02:00