Commit Graph

3454 Commits

Author SHA1 Message Date
PThorpe92
3597b32e4b Resolve ambiguous columns in expr translator 2025-03-23 19:19:35 -04:00
PThorpe92
8455f612bd Possibly translate both sides of expr in update 2025-03-23 17:08:15 -04:00
PThorpe92
8f469f26b6 Add some additional tcl tests for update support 2025-03-23 17:08:15 -04:00
PThorpe92
a1d5797f90 Update COMPAT.md 2025-03-23 17:08:15 -04:00
PThorpe92
dbfe94d677 Add initial tests for update support 2025-03-23 17:08:15 -04:00
PThorpe92
c83cc6dff2 Small nits/clippy errors in vdbe 2025-03-23 17:08:15 -04:00
PThorpe92
676ddd4fb6 Add logic to handle overwrite cell if insert to same rowid to support update 2025-03-23 17:08:14 -04:00
PThorpe92
ef878a2e20 Begin update implementation, add translation 2025-03-23 17:08:14 -04:00
Pekka Enberg
63630ff956 Merge 'Enable pretty mode in shell by default' from Pekka Enberg
Fixes #929

Closes #932
2025-03-22 08:20:09 +02:00
Pekka Enberg
7832ae22df Enable pretty mode in shell by default
Fixes #929
2025-03-22 08:10:26 +02:00
Pekka Enberg
669317c11e Limbo 0.18.0-pre.3 2025-03-21 20:13:00 +02:00
Pekka Enberg
2a257b4f9c Merge 'Improve CLI color scheme' from Pekka Enberg
...let's aim for a green color scheme that is easy on the eyes.

Closes #1153
2025-03-21 19:36:24 +02:00
Pekka Enberg
95abf0a9b2 Improve CLI color scheme
...let's aim for a green color scheme that is easy on the eyes.
2025-03-21 19:21:25 +02:00
Pekka Enberg
52ccc36061 Merge 'Impl Copy on some types in the pager to prevent explicit clones' from Preston Thorpe
Tried to keep this as small and focused as possible, just a few that I
ran into while debugging the page cache

Closes #1107
2025-03-21 18:40:14 +02:00
Pekka Enberg
26a9f24e2f Merge 'Syntax highlighting and hinting' from Pedro Muniz
Start of syntax highlighting and hinting. Still need to figure out how
to sublime-syntax works to produce good highlights.
Edit:
Personally, I believe there are more interesting syntax highlighting
possibilities with `reedline` crate, but currently, we cannot use it as
the our DB `Connection` would have to be `Send`. This PR is an
introduction and quality of life changes for the users of the CLI and
for us developers, as we now won't have to look at black and white text
only. I want to have a config file to personalize the color pallets,
that will be made in a following PR.

Closes #1101
2025-03-21 18:17:47 +02:00
Pekka Enberg
5f8f80fb13 Merge 'bindings/python: Fix flaky tests' from Diego Reis
Just following best practices and making each test idempotent and
independent of each other.

Closes #1152
2025-03-21 18:07:08 +02:00
Diego Reis
2ee934577f ext/python: Close connection after each test 2025-03-21 12:02:27 -03:00
Diego Reis
3c2bb6c3a8 ext/python: Fix flaky tests by creating a new db for each test and removing it after the test 2025-03-21 11:33:24 -03:00
Pekka Enberg
c77210aa63 Update COMPAT.md 2025-03-21 13:08:48 +02:00
Pekka Enberg
974205af74 Merge 'chore: gitignore files with an extension *.db' from Anton Harniakou
For example the commmand `cargo run --package limbo_cli --bin limbo
database.db` will generate a `database.db` file, and it's unlikely we'll
ever need to track such files **if they are placed inside the root of
the project**.

Closes #1150
2025-03-21 12:11:04 +02:00
Pekka Enberg
f039ffe5c5 Merge 'Add commit() and placeholding insert to Python binding' from Diego Reis
It is a Minimal Valuable Close (MVC) to #494 and #1146 , so probably
there are some corner cases to handle, if so, just point it out and I'll
be happy to fix it :)

Closes #1148
2025-03-21 12:10:34 +02:00
Anton Harniakou
4f34d8dbed chore: gitignore files with an extension *.db
For example the commmand `cargo run --package limbo_cli --bin limbo database.db`
will generate a `database.db` file, and it's unlikely we'll ever need to
track such files if they are placed inside the root of the project.
2025-03-21 12:33:28 +03:00
Diego Reis
f966f7ad0e ext/python: Makes Linter happy 2025-03-20 17:40:31 -03:00
Diego Reis
16b9325830 ext/python: Basic support for placeholding insert 2025-03-20 17:10:12 -03:00
Diego Reis
2481d73d70 ext/python: Partially implements commit()
It was based on https://docs.python.org/3/library/sqlite3.html but some more work is needed specially in LEGACY_TRANSACTION_CONTROL and isolation levels.

See: https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.autocommit
2025-03-20 17:09:55 -03:00
Pekka Enberg
16bad90eee Merge 'Fix io_uring WAL write corruption by ensuring buffer lifetime' from Daniel Boll
### Problem
When using the `io_uring` backend, WAL file writes were corrupted: the
submitted buffer data (e.g., WAL header magic `37 7f 06 82`) was correct
in logs, but the file on disk showed incorrect data (e.g., `00 18 27
xx`). This occurred because the `Arc<RefCell<Buffer>>` was dropped
before the asynchronous `io_uring` write completed, allowing the kernel
to write stale or freed memory.
### Root Cause
In `UringFile::pwrite`, the `buffer` was passed to `io_uring` via an
`iovec`, but the `Arc<RefCell<Buffer>>` wasn’t guaranteed to live until
the write finished. Unlike synchronous `UnixIO`, where the buffer
persists during the `pwrite` call, `io_uring`’s async nature exposed
this lifetime issue.
### Fix
Modified `UringFile::pwrite` to hold a reference to the `buffer` in the
completion callback by calling `buffer.borrow()`. This ensures the
`Buffer` remains alive until `io_uring` completes the write, preventing
memory corruption.
### Changes
- Updated `core/io/io_uring.rs`:
  - Added `WriteCompletion` import.
  - Wrapped the original `Completion` in a new `WriteCompletion` closure
that references the `buffer`, extending its lifetime until the write
completes.
### Validation
- Tested with `limbo -v io_uring`:
  - `.open limbo.db`
  - `CREATE TABLE users (id INT PRIMARY KEY, username TEXT);`
  - `INSERT INTO users VALUES (1, 'alice');`
  - `INSERT INTO users VALUES (2, 'bob');`
  - `SELECT * FROM users;`
- Verified WAL file with `xxd -l 16 limbo.db-wal`:
  - Before: `0018 2734 ...`
  - After: `377f 0682 ...` (correct WAL magic).
- `wal-browser limbo.db-wal` confirms the header is written correctly,
**though frame checksums still need separate fixing** (tracked in a
follow-up issue).
### Follow-Up
- Frame checksum mismatches persist in `wal-browser` output (e.g.,
`00000000-00000000 != 14d64367-7b77a5a0`). This is a separate issue in
`begin_write_wal_frame` or WAL frame initialization, to be addressed in
a subsequent PR.
Closes: #1137

Closes #1143
2025-03-20 08:46:51 +02:00
Pekka Enberg
d45521a70e Limbo 0.0.18-pre.2 2025-03-20 08:45:34 +02:00
Pekka Enberg
b24a8c875b github: Fix Python release workflow 2025-03-20 08:43:38 +02:00
Daniel Boll
fc50609491 Fix io_uring WAL write corruption by ensuring buffer lifetime
Ensure the Arc<RefCell<Buffer>> in UringFile::pwrite remains alive until
the io_uring write completes by referencing it in the completion callback.
This prevents WAL file corruption where the correct buffer data was
overwritten with stale memory (e.g., 00 18 27 xx instead of 37 7f 06 82).

Validation:
- Tested with limbo -v io_uring and WAL operations.
- Verified with xxd and wal-browser.

Signed-off-by: Daniel Boll <danielboll.academico@gmail.com>
2025-03-19 23:55:43 -03:00
Pekka Enberg
1adbb2a462 Limbo 0.0.18-pre.1 2025-03-19 20:39:17 +02:00
Pekka Enberg
38d2afc8dd bindings/wasm: Don't depend on specific version 2025-03-19 19:12:40 +02:00
Pekka Enberg
8d73fefacb Clean up Cargo.toml a bit 2025-03-19 19:11:25 +02:00
Pekka Enberg
4142f4f4cb Merge 'Organize extension library and feature gate VFS' from Preston Thorpe
I keep having 3+ PR's in at the same time and always deal with crazy
conflicts because everything in the `ext` library is together in one
file.
This PR moves each category of extension into its own file, and
separates the `vfs` functionality in Core into the `ext/dynamic` module,
so that it can be more easily separated from wasm (or non feature =
"fs") targets to prevent build issues.
The only semantic changes made in this PR is the feature gating of vfs,
the rest is simply organizing and cleaning up imports.
Was unsure if `vfs` should be a feature on the `core` side too, or to
just enable it with the `fs` feature which seemed reasonable, as that
was already the current behavior. But let me know if we want it entirely
behind it's own feature.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1124
2025-03-19 19:08:13 +02:00
Pekka Enberg
9ffc4767bb Merge 'fragment bench functions' from Pere Diaz Bou
Easier to run now with:
```
cargo bench -- "execute_select_rows/50"
```

Closes #1142
2025-03-19 19:01:46 +02:00
Pekka Enberg
52b546ff64 Add limbo_ext_tests to crates 2025-03-19 19:00:12 +02:00
Pekka Enberg
4a3cbd6fa3 Add limbo_completion to crates 2025-03-19 18:58:21 +02:00
Pere Diaz Bou
13d518d086 fragment bench functions 2025-03-19 17:55:24 +01:00
Pekka Enberg
d0deff2d8b github: Attempt to fix Python release workflow 2025-03-19 18:46:48 +02:00
Pekka Enberg
ddb39d2493 Limbo 0.0.17 2025-03-19 17:29:17 +02:00
Pekka Enberg
d4db5eb4c1 Merge 'Various JSON and JSONB function improvements' from Ihor Andrianov
Added jsonb_remove, jsonb_replace, json_replace.
Updated json_remove to use jsonb under the hood.
Fixed json function big numbers serialization.
Add tests for new functions.

Closes #1140
2025-03-19 17:21:44 +02:00
PThorpe92
ad88a50b6b Add docs to ext readme about vfs feature gate 2025-03-19 10:19:19 -04:00
PThorpe92
57d4aa7216 Reorganize ext library and feature gate vfs to more easily prevent wasm build issues 2025-03-19 10:17:11 -04:00
Ihor Andrianov
f42b62f43c update compat for json functions 2025-03-19 13:00:55 +02:00
Ihor Andrianov
ca0be110ec fix big number parsing for json functions 2025-03-19 12:53:34 +02:00
Ihor Andrianov
62916f3a97 cargo clippy 2025-03-19 11:59:20 +02:00
Ihor Andrianov
32ea972151 make tests pass 2025-03-19 11:29:46 +02:00
Ihor Andrianov
bf649f98be add tests 2025-03-19 11:29:23 +02:00
Ihor Andrianov
b5e86a9e36 remove and replace functions defenitions 2025-03-18 21:43:48 +02:00
Ihor Andrianov
779e2c9e97 high order functions for remove and replace 2025-03-18 21:43:14 +02:00
Ihor Andrianov
403d0e8c21 implemented remove and replace in jsonb struct 2025-03-18 21:42:27 +02:00