Pekka Enberg
2d3fd01f91
Merge 'Support Create Index' from Preston Thorpe
...
Closes #1193
```console
│limbo> explain create index idxp on products(price);
│addr opcode p1 p2 p3 p4 p5 comment
│---- ----------------- ---- ---- ---- ------------- -- -------
│0 Init 0 39 0 0 Start at 39
│1 CreateBtree 0 1 2 0 r[1]=root iDb=0 flags=2
│2 OpenWriteAsync 0 1 0 0
│3 OpenWriteAwait 0 0 0 0
│4 NewRowId 0 2 0 0
│5 String8 0 3 0 index 0 r[3]='index'
│6 String8 0 4 0 idxp 0 r[4]='idxp'
│7 String8 0 5 0 products 0 r[5]='products'
│8 Copy 1 6 1 0 r[6]=r[1]
│9 String8 0 7 0 CREATE INDEX idxp ON products (price) 0 r[7]='CREATE INDEX idxp ON products (price)'
│10 MakeRecord 3 5 8 0 r[8]=mkrec(r[3..7])
│11 InsertAsync 0 8 2 0
│12 InsertAwait 0 0 0 0
│13 SorterOpen 3 1 0 k(1,B) 0 cursor=3
│14 OpenPseudo 4 9 2 0 2 columns in r[9]
│15 OpenReadAsync 2 273 0 0 table=products, root=273
│16 OpenReadAwait 0 0 0 0
│17 RewindAsync 2 0 0 0
│18 RewindAwait 2 25 0 0 Rewind table products
│19 Column 2 2 10 0 r[10]=products.price
│20 RowId 2 11 0 0 r[11]=products.rowid
│21 MakeRecord 10 2 12 0 r[12]=mkrec(r[10..11])
│22 SorterInsert 3 12 0 0 0 key=r[12]
│23 NextAsync 2 0 0 0
│24 NextAwait 2 19 0 0
│25 OpenWriteAsync 1 1 0 0
│26 OpenWriteAwait 0 0 0 0
│27 SorterSort 3 33 0 0
│28 SorterData 3 13 4 0 r[13]=data
│29 SeekEnd 1 0 0 0
│30 IdxInsertAsync 1 13 0 0 key=r[13]
│31 IdxInsertAwait 1 0 0 0
│32 SorterNext 3 28 0 0
│33 Close 3 0 0 0
│34 Close 2 0 0 0
│35 Close 1 0 0 0
│36 ParseSchema 0 0 0 name = 'idxp' AND type = 'index' 0 name = 'idxp' AND type = 'index'
│37 Close 0 0 0 0
│38 Halt 0 0 0 0
│39 Transaction 0 1 0 0 write=true
│40 Goto 0 1 0 0
```
This will create the initial index btree and insert whatever relevant
records that need to be inserted, it doesn't handle the case of
inserting new index keys when normal records are created afterwards.
That will prob be added in next PR to keep this one concise.
Limbo will properly use the index in a subsequent query:

Creating a unique index on a column that has 2 existing identical rows:

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com >
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #1199
2025-04-06 19:32:36 +03:00
Pekka Enberg
e3c064fc47
Merge 'Allow reading altered tables by defaulting to null in Column insn' from Preston Thorpe
...
Closes #1259
Closes #1260
2025-04-06 13:33:16 +03:00
Pekka Enberg
c04ce28070
Merge 'Support insert default values syntax' from Preston Thorpe
...
`INSERT INTO products DEFAULT VALUES` previously wasn't supported. Quick
and easy
Closes #1262
2025-04-06 10:23:21 +03:00
PThorpe92
ff482fc753
Add test case for insert default values
2025-04-05 21:34:27 -04:00
PThorpe92
c9edf71fb8
Support insert default values syntax
2025-04-05 21:27:21 -04:00
PThorpe92
67eda10453
Allow reading altered tables by defaulting to null in Column insn
2025-04-05 16:19:56 -04:00
PThorpe92
83af71f140
Return accidentally deleted comment on SeekGE insn from merge conflict
2025-04-05 11:30:57 -04:00
PThorpe92
399994bf66
Fix ext tests start with no default schema
2025-04-05 11:19:40 -04:00
PThorpe92
bd04b10f17
Fix btree tests to adapt to new type for BTreeKey
2025-04-05 11:19:10 -04:00
PThorpe92
abc97c8774
Add doc comments to new btree key enum and remove unused lifetimes
2025-04-05 11:19:10 -04:00
PThorpe92
6b42808f1a
Dont re-seek if we are inserting a new unique index
2025-04-05 11:19:10 -04:00
PThorpe92
a2b9d8d371
Use Correct flag on idx insert to prevent seeking
2025-04-05 11:19:09 -04:00
PThorpe92
068ab4ab27
Refactor btree to reuse existing insert and seek with idx keys
2025-04-05 11:19:09 -04:00
PThorpe92
007fbe8cc7
Fix unique index issue and prealloc in sql string for schema
2025-04-05 11:19:09 -04:00
PThorpe92
2c3fd509fe
Remove unused imports and consolidate ordering comparison
2025-04-05 11:19:09 -04:00
PThorpe92
e020ba3dfe
Add enum for interpreting a value as a register or literal for insns
2025-04-05 11:19:07 -04:00
PThorpe92
b0016a0ee2
Support create index with SeekEnd and IdxCreate opcode functionality
2025-04-05 11:15:36 -04:00
PThorpe92
45a8e5e226
Add close_cursors helper method to program builder
2025-04-05 11:06:18 -04:00
PThorpe92
20adedff4c
Remove Order enum in place of ast::SortOrder
2025-04-05 11:06:18 -04:00
PThorpe92
7567b30d00
Add SeekEnd to compat.md
2025-04-05 11:06:18 -04:00
PThorpe92
4741544dfd
Add query translation for create index
2025-04-05 11:06:18 -04:00
PThorpe92
293974e692
Update COMPAT.md
2025-04-05 11:06:11 -04:00
Pekka Enberg
ed7271a08c
Merge 'Implement Clone and Debug for Rust binding's Database' from Isaiah Gamble
...
Derive `Clone` for the Rust binding's `Database` and implement `Debug`.
Closes #1238
Closes #1257
2025-04-05 08:37:23 +03:00
Pekka Enberg
883d183471
Merge 'Update cargo-dist and switch to Astral's version' from Hiroaki Yutani
...
Close #1250
This pull request switches `cargo-dist` to Astral's "unofficial fork"
version. In addition, this updates `cargo-dist` to version 0.28.3, so
the diff, which I generated just by `dist init`, contains the updates
since version 0.21.0.
- `cargo-dist` command was renamed to `dist`
- As of [version 0.23.0](https://github.com/axodotdev/cargo-
dist/releases/tag/v0.23.0), cargo-dist uses a dedicated config file
`dist-workspace.toml` instead of the field of `Cargo.toml`
Closes #1256
2025-04-05 08:35:47 +03:00
Hiroaki Yutani
3fa1cb56a5
Update cargo-dist and switch to Astral's version
2025-04-05 09:10:48 +09:00
Pekka Enberg
c3eaf47180
Merge 'Add support for default values in INSERT statements' from Diego Reis
...
While working on #494 I noticed that default values defined in schemas
weren't being applied.
Before:

Now:

Closes #1249
2025-04-04 08:59:44 +03:00
Pekka Enberg
a90cbe4b62
Merge 'Fix virtual table translation issues' from Preston Thorpe
...
closes #1240
some idiot (read: me) had the init label of `CREATE VIRTUAL TABLE`
translation completely in the wrong place 🤔
Closes #1247
2025-04-04 08:58:02 +03:00
Diego Reis
43daba9942
core/translate: Add support for default values in INSERT statements
2025-04-04 01:32:13 -03:00
Diego Reis
38d842d675
docs/insn: Standardizes comments for insn to doc comments
2025-04-04 00:56:54 -03:00
PThorpe92
97c68f905a
Move test back to original setup to ensure issue is solved
2025-04-03 20:22:47 -04:00
PThorpe92
ae2be30204
Move init label to proper place in create vtab translation
2025-04-03 20:22:14 -04:00
PThorpe92
22fd3e9781
Fix cli tests
2025-04-03 15:23:49 -04:00
Pekka Enberg
73a35329d0
Merge 'Fix overflow position in write_page()' from Lâm Hoàng Phúc
...
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com >
Closes #1241
2025-04-03 16:33:20 +03:00
Pekka Enberg
ccbea57a4d
Merge 'docs(readme): update discord link' from Jamie Barton
...
Closes #1242
Closes #1243
2025-04-03 15:35:16 +03:00
Jamie Barton
83ec159b0c
docs(readme): update discord link
2025-04-03 13:09:24 +01:00
Pekka Enberg
67627e18c8
Limbo 0.0.19-pre.4
2025-04-03 13:36:01 +03:00
Pekka Enberg
4392193856
bindings/javascript: Fix package repository URLs
2025-04-03 13:34:30 +03:00
Pekka Enberg
4f34373392
Limbo 0.0.19-pre.3
2025-04-03 12:39:17 +03:00
Pekka Enberg
64bd0c141a
github: Fix JavaScript publish workflow permissions
...
The workflow enables npm's provenance feature, which requires write
permissions to the "id-token" on Github actions:
https://tsmx.net/npmjs-built-and-signed-on-github-actions/
2025-04-03 12:38:01 +03:00
TcMits
56fa9049c3
fix: overflow pos in write_page
2025-04-03 15:02:53 +07:00
Pekka Enberg
a5ee6493c0
Limbo 0.0.19-pre.2
2025-04-03 10:43:36 +03:00
Pekka Enberg
4342438801
scripts: Add more npm packages to update-version.py
2025-04-03 10:43:28 +03:00
Pekka Enberg
a279056e88
bindings/javascript: Drop pre-publish step
...
We don't want napi creating releases.
2025-04-03 10:41:15 +03:00
Pekka Enberg
7075c75b24
Limbo 0.0.19-pre.1
2025-04-03 10:03:01 +03:00
Pekka Enberg
c61063c697
github: Fix JavaScript workflow release parsing
2025-04-03 10:03:01 +03:00
Pekka Enberg
16bc28b0af
sqlite3-parser: Change debug logging to trace level
...
SQL scanner at debug level spams the logs pretty hard when debugging...
2025-04-03 07:46:07 +03:00
tsar-boomba
89c0b0b862
Implement Clone and Debug for rust binding's Database
2025-04-02 18:22:57 -07:00
Pekka Enberg
7b9c0e9231
Merge 'More VDBE cleanups' from Pekka Enberg
...
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com >
Closes #1237
2025-04-02 19:25:41 +03:00
Pekka Enberg
24063bd9c0
core/vdbe: Add newline between op functions
2025-04-02 18:57:07 +03:00
Pekka Enberg
c592e27dca
core/vdbe: Move explain() to last method in Program
...
...it's the least interesting one and we should have `step()` at the top.
2025-04-02 18:55:35 +03:00