Commit graph

5298 commits

Author SHA1 Message Date
Jussi Saurio
efed4bc07d Merge 'Complete ALTER TABLE implementation' from Levy A.
Resolves #895
- [x] `ALTER TABLE _ ADD _`
- [x] `ALTER TABLE _ DROP _`
- [x] `ALTER TABLE _ RENAME _ TO _`

Reviewed-by: Preston Thorpe (@PThorpe92)
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1527
2025-06-13 10:23:43 +03:00
Jussi Saurio
3c1765cbde Merge 'Fix large inserts to unique indexes hanging' from Jussi Saurio
Some checks are pending
JavaScript / stable - x86_64-apple-darwin - node@20 (push) Waiting to run
JavaScript / stable - x86_64-pc-windows-msvc - node@20 (push) Waiting to run
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 / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
Python / lint (push) Waiting to run
Python / check-requirements (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ö / bench (push) Waiting to run
Rust Benchmarks+Nyrkiö / clickbench (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h-criterion (push) Waiting to run
Rust Benchmarks+Nyrkiö / tpc-h (push) Waiting to run
Closes #1717
We were incorrectly setting `moved_before` as `false` after checking for
unique constraint violation, but the reality is that after the
uniqueness check, we are already correctly positioned -- if no match was
found, the cursor is positioned at either:
a) no row, or
b) at the first entry that is greater than the key we are inserting.
This means we don't have to move anymore and can just insert.

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

Closes #1723
2025-06-12 13:12:56 +03:00
Jussi Saurio
04c590f5a6 Add comment about re-entrancy of op_idx_insert() 2025-06-12 12:36:53 +03:00
Jussi Saurio
bdbd021bbb Fix large inserts to unique indexes hanging
We were incorrectly setting `moved_before` as `false` after checking
for unique constraint violation, but the reality is that after the
uniqueness check, we are already correctly positioned -- if no match
was found, the cursor is positioned at either:

a) no row, or
b) at the first entry that is greater than the key we are inserting.

This means we don't have to move anymore and can just insert.
2025-06-12 12:25:17 +03:00
Jussi Saurio
b3b32417e7 Merge 'betters instrumentation for btree related operations + cleaner debug for RefValue' from Pedro Muniz
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 / lint (push) Waiting to run
Python / configure-strategy (push) Waiting to run
Python / test (push) Blocked by required conditions
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 / build-wasm (push) Waiting to run
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 / test-limbo (push) Waiting to run
Rust / test-sqlite (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
Rust Benchmarks+Nyrkiö / tpc-h (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
Adds an `#[instrument]` to many btree related functions. Also, when
debugging #1717 it would be impossible to debug as the 10Mb SeekKey
would be printed to my terminal making the experience miserable. The
debug implementation now truncates the Blobs and Strings when they are
too big to be useful.

Closes #1721
2025-06-12 10:39:13 +03:00
pedrocarlo
8dbf09bb42 betters instrumentation for btree operations 2025-06-11 23:34:32 -03:00
Krishna Vishal
3ff9af3320 Add .quit alias = .q, .qu, .qui
Add .exit alias = .ex, .exi
2025-06-12 00:07:07 +05:30
Levy A.
5d60d82499 fix: add default 2025-06-11 14:19:06 -03:00
Levy A.
43db84e6ea fix: broken rebase 2025-06-11 14:19:06 -03:00
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
Pere Diaz Bou
9edbfa436a fmt again 2025-06-11 19:12:19 +02:00
Pere Diaz Bou
3f3e91927f fmt 2025-06-11 19:02:23 +02:00
Pere Diaz Bou
c2541c0e52 fix order pragma integrity check 2025-06-11 18:59:25 +02:00
Pere Diaz Bou
81d566cd1c integrity test with tcl 2025-06-11 18:39:06 +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
83d72db901 better error messages + cleaner printing of file stats + tracing
instrumentation in `execute_interaction`
2025-06-11 11:32:45 -03:00
pedrocarlo
e19fa9f951 add additional cli options to disable other properties 2025-06-11 11:32:45 -03:00