Commit Graph

9659 Commits

Author SHA1 Message Date
Nikita Sivukhin
759ffc1770 fix clippy 2025-09-30 14:03:25 +04:00
Nikita Sivukhin
ab92102cd8 remove parameter id assign logic from core 2025-09-30 13:58:59 +04:00
Nikita Sivukhin
30a9b2b860 auto-assign anonymous parameters directly in the Parser
- otherwise it will be easy to mess up with the traversal order
2025-09-30 13:58:59 +04:00
Nikita Sivukhin
264cfdd1c0 add smiple test 2025-09-30 13:58:59 +04:00
Pekka Enberg
1b991156f3 Merge 'core/vdbe: Fix BEGIN after BEGIN CONCURRENT check' from Pekka Enberg
We're supposed to error out only when "is_begin" is true.

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

Closes #3450
2025-09-30 11:34:40 +03:00
Pekka Enberg
9b83fe7abf core/vdbe: Fix BEGIN after BEGIN CONCURRENT check
We're supposed to error out only when "is_begin" is true.
2025-09-30 10:55:13 +03:00
Jussi Saurio
17826dc69b Merge 'small improvement of stress testing tool' from Nikita Sivukhin
Before, it omitted BEGIN/COMMIT/ROLLBACK statements which affects
reproducibility

Closes #3427
2025-09-30 10:41:43 +03:00
Nikita Sivukhin
9d7e28ac43 fix clippy 2025-09-30 11:39:17 +04:00
Jussi Saurio
9681377c51 Merge 'sum() can throw integer overflow' from Duy Dang
close #3311

Closes #3416
2025-09-30 10:38:37 +03:00
Nikita Sivukhin
f3a148b802 keep db file 2025-09-30 11:37:43 +04:00
Jussi Saurio
594bdce999 Merge 'sum should identify if there is num in strings/prefix of strings' from Pavan Nambi
closes #3285
maybe adding seperate func for it is stupid but i kept running into
issues with not closing some random `}` and it got annoying real quick
so i just moved tht into its own func. - and as i am using same logic in
3 places i think it's ok.

Closes #3412
2025-09-30 10:37:17 +03:00
Jussi Saurio
13ca94755e Merge 'correct span in ParseUnexpectedToken' from Lâm Hoàng Phúc
Closes #3447
2025-09-30 10:35:49 +03:00
Jussi Saurio
63906e8f44 Merge 'remove UnterminatedBlockComment error' from Lâm Hoàng Phúc
close #3425

Closes #3446
2025-09-30 10:35:23 +03:00
Jussi Saurio
e6a2e2a9cf Merge 'Remove double-quoted identifier assert' from Diego Reis
Closes #3301
Not every identifier should be double-quoted

Closes #3440
2025-09-30 10:34:49 +03:00
Jussi Saurio
568b0eeff3 Merge 'substr scalar should also work with non-text values' from Diego Reis
Closes #3306
Not only blobs, but numbers are also cast to text

Closes #3439
2025-09-30 10:33:40 +03:00
TcMits
04beead7fe correct span in ParseUnexpectedToken 2025-09-30 12:49:26 +07:00
TcMits
4211460ef3 fmt 2025-09-30 12:28:24 +07:00
TcMits
d3d6a015ec fix issue 3425 2025-09-30 12:25:20 +07:00
Pekka Enberg
2b59863447 Merge 'core/printf: Compatibility tests and fixes for printf()' from Luiz Gustavo
Addition of compatibilty tests for `printf()`.
While doing this I found some differences in the current implementation,
so this fixes those too.

Closes #3438
2025-09-30 07:44:35 +03:00
Pekka Enberg
57d8532dcc Merge 'add manual page about materialized views' from Glauber Costa
Closes #3435
2025-09-30 07:35:48 +03:00
Pekka Enberg
9a08fb9e43 core/translate: Remove useless comment from logical.rs 2025-09-30 07:35:12 +03:00
Pekka Enberg
6053bb6556 Merge 'Fix materialized views with complex expressions' from Glauber Costa
SQLite supports complex expressions in group by columns - because of
course it does...
So we need to make sure that a column is created for this expression if
it doesn't exist already, and compute it, the same way we compute pre-
projections in the filter operator.
Fixes #3363
Fixes #3366
Fixes #3365

Closes #3429
2025-09-30 07:34:51 +03:00
luizgfc
f1811794b9 core/testing: Basic sqlite compatibility tests for printf() 2025-09-30 01:02:12 -03:00
luizgfc
3093371f76 core/printf: Fix printf compatibility with %f, %x and %o substitutions 2025-09-30 01:02:09 -03:00
Diego Reis
8e60d64518 rename limbo -> turso 2025-09-29 22:33:39 -03:00
Diego Reis
90f4d69774 fix(3301): Remove identifier assert assumption
Not every identifier should be double-quoted
2025-09-29 22:33:21 -03:00
Diego Reis
c9421e034d fix(3306): substr scalar should also work with non-text values 2025-09-29 21:42:21 -03:00
luizgfc
5da6ed7499 core/printf: Fix null %s formatting behavior for sqlite compatibility 2025-09-29 21:26:47 -03:00
Glauber Costa
89956039be add manual page about materialized views 2025-09-29 15:49:37 -05:00
Pekka Enberg
75f088740d Merge 'core: Disallow CREATE INDEX when MVCC is enabled' from Pekka Enberg
MVCC does currently not support indexes. Therefore,
- Fail if a database with indexes is opened with MVCC
- Disallow `CREATE INDEX` when MVCC is enabled
Fixes: #3108

Closes #3426
2025-09-29 20:53:16 +03:00
Glauber Costa
2fde976605 Fix materialized views with complex expressions
SQLite supports complex expressions in group by columns - because of
course it does...

So we need to make sure that a column is created for this expression if
it doesn't exist already, and compute it, the same way we compute
pre-projections in the filter operator.

Fixes #3363
Fixes #3366
Fixes #3365
2025-09-29 11:56:21 -05:00
Pekka Enberg
05d8cca75c core: Disallow CREATE INDEX when MVCC is enabled
MVCC does currently not support indexes. Therefore,

- Fail if a database with indexes is opened with MVCC
- Disallow `CREATE INDEX` when MVCC is enabled

Fixes: #3108
2025-09-29 19:38:08 +03:00
Preston Thorpe
cdab174350 Merge 'Fix column fetch in joins' from Glauber Costa
In comparisons for joins, we were assuming that the left column belonged
to the left join (and vice-versa). That is incorrect, because you can
write the comparison condition in any order.
Fixes #3368

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

Closes #3400
2025-09-29 12:34:45 -04:00
Preston Thorpe
da599a1fb8 Merge 'quoting fix' from Nikita Sivukhin
This PR moves part of string normalization to the parser layer.
Now, we dequote and unescape values in the parser, but we still need to
lowercase them for proper ignore-case comparison logic in the planner.
The reason to not lowercase in the parser is following:
1. SQLite (and tursodb) have ident->string conversion rule and by
lowercasing value early we will loose original representation
2. Some things like column names are preserve the case right now and we
better to not change this behaviour.

Closes #3344
2025-09-29 12:33:42 -04:00
Nikita Sivukhin
5086480b28 small improvement of stress testing tool 2025-09-29 20:18:10 +04:00
Pekka Enberg
b0d27c90aa Turso 0.2.0-pre.11 2025-09-29 18:11:59 +03:00
Pekka Enberg
f4bf635129 Merge 'javascript: Rename "browser" packages to "wasm"' from Pekka Enberg
Closes #3417
2025-09-29 18:11:30 +03:00
Pekka Enberg
1f86400cec Merge 'core/vdbe: Wrap Program::n_change with AtomicI64' from Pekka Enberg
Closes #3424
2025-09-29 18:11:18 +03:00
Preston Thorpe
bbbcbf894e Merge 'translate/upsert: fix explicit conflict target of non-rowid primary key in UPSERT' from Preston Thorpe
closes #3384

Closes #3386
2025-09-29 11:09:29 -04:00
Preston Thorpe
1e974c1383 Merge 'Fix zero limit' from Nikita Sivukhin
Before, we validated that condition during program emit - which works
for fixed values of parameters but doesn't work with variables provided
externally to the prepared statement

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3421
2025-09-29 11:06:46 -04:00
Preston Thorpe
8d424d0ab2 Merge 'use explicit null if it set instead of column default value' from Nikita Sivukhin
Before, tursodb always used default value even if NULL was explicitly
set by the user

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3422
2025-09-29 11:05:14 -04:00
Preston Thorpe
8665d76c2e Merge 'Improve encryption module' from Avinash Sajjanshetty
This patch improves the encryption module:
1. Previously, we did not use the first 100 bytes in encryption. This
patch uses that portion as associated data, for protection against
tampering and corruption
2. Once the page 1 encrypted, on disk we store a special Turso header
(the first 16 bytes). During decryption we replace this with standard
SQLite's header (`"SQLite format 3\000"`). So that the upper layers (B
Tree or in Sync APIs) operate on the existing SQLite page expectations.
The format is:
```
///                    Turso Header (16 bytes)
///        ┌─────────┬───────┬────────┬──────────────────┐
///        │         │       │        │                  │
///        │  Turso  │Version│ Cipher │     Unused       │
///        │  (5)    │ (1)   │  (1)   │    (9 bytes)     │
///        │         │       │        │                  │
///        └─────────┴───────┴────────┴──────────────────┘
///         0-4      5       6        7-15
///
///        Standard SQLite Header: "SQLite format 3\0" (16 bytes)
///                            ↓
///        Turso Encrypted Header: "Turso" + Version + Cipher ID + Unused
```

Reviewed-by: Nikita Sivukhin (@sivukhin)
Reviewed-by: bit-aloo (@Shourya742)

Closes #3358
2025-09-29 11:04:31 -04:00
Pekka Enberg
82456cfbed scripts/publish-crates.sh: Remove sqlite3_parser 2025-09-29 17:35:45 +03:00
Pekka Enberg
97d21e0ff4 Merge 'Remove vendored parser now that we have our own' from Preston Thorpe
Closes #3423
2025-09-29 17:33:04 +03:00
Pekka Enberg
5f9287304b core/vdbe: Wrap Program::n_change with AtomicI64 2025-09-29 17:09:33 +03:00
Pekka Enberg
57c279e2b0 javascript: Rename "browser" packages to "wasm" 2025-09-29 17:02:34 +03:00
PThorpe92
76b25a3beb Remove references to vendored parser in Cargo.toml and dockerfiles 2025-09-29 09:46:29 -04:00
PThorpe92
bd89554cad Remove vendored parser now that we have our own 2025-09-29 09:44:38 -04:00
Pekka Enberg
121e8898cd Merge 'core/storage: Wrap Pager::commit_info with RwLock' from Pekka Enberg
Also remove RefCells from CommitInfo because they're not only redundant,
but cause CommitInfo not to be Send.

Closes #3420
2025-09-29 16:42:44 +03:00
Nikita Sivukhin
0910483522 fix clippy 2025-09-29 16:30:07 +04:00