Commit Graph

9600 Commits

Author SHA1 Message Date
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
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
Nikita Sivukhin
a142c59de4 use explicit null if it set instead of column default value 2025-09-29 16:28:09 +04:00
Nikita Sivukhin
12863b35c4 fix compound select 2025-09-29 16:21:35 +04:00
Nikita Sivukhin
49a5617a95 fix limit for compount select 2025-09-29 15:51:39 +04:00
Nikita Sivukhin
4d8ef6c63f extend integration test 2025-09-29 15:32:36 +04:00
Nikita Sivukhin
70e18ce3f7 validate zero limit at the beginning in the VDBE program
- 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
2025-09-29 15:32:36 +04:00
Pekka Enberg
f247b1a2bb core/storage: Wrap Pager::commit_info with RwLock
Also remove RefCells from CommitInfo because they're not only redundant,
but cause CommitInfo not to be Send.
2025-09-29 13:54:28 +03:00
Avinash Sajjanshetty
ec1bf8888c refactor to adress review comments 2025-09-28 22:03:47 +05:30
Pekka Enberg
fda1b89540 Merge 'core/storage: Wrap WalFile::{max,min}_frame with AtomicU64' from Pekka Enberg
Closes #3414
2025-09-28 17:42:10 +03:00
Pekka Enberg
d3abeb6281 core/storage: Wrap WalFile::{max,min}_frame with AtomicU64 2025-09-28 16:47:54 +03:00
Pekka Enberg
2da6206c0b Merge 'core/storage: Wrap WalFile::max_frame_read_lock_index with AtomicUsize' from Pekka Enberg
Closes #3411
2025-09-28 14:16:49 +03:00
Pekka Enberg
250ac66c36 github: Increase tpc-h-criterion timeout to 60 minutes 2025-09-28 14:16:18 +03:00
Pekka Enberg
aba596441c core/storage: Wrap WalFile::max_frame_read_lock_index with AtomicUsize 2025-09-28 13:42:32 +03:00
Jussi Saurio
959165eed1 Merge 'core/storage: Mark Page as Send and Sync' from Pekka Enberg
Closes #3399
2025-09-28 08:08:46 +03:00
Jussi Saurio
02ca451c67 Merge 'Correct spelling issue in ForeignKey ast node' from Preston Thorpe
`deref_clause` -> `defer_clause`
(Yes I'm implementing foreign keys)

Closes #3407
2025-09-28 08:08:13 +03:00
Jussi Saurio
2d06375003 Merge 'Move turso.png image to assets directory' from Preston Thorpe
not the first time I deleted this file on accident earlier, it belongs
in `assets`

Closes #3405
2025-09-28 08:07:49 +03:00
Jussi Saurio
618cf2a4e7 Merge 'core/translate: rewrite default column value from identifier to string literal' from Preston Thorpe
closes #3390
closes #3389

Closes #3403
2025-09-28 08:07:11 +03:00
PThorpe92
30f80c2000 Correct spelling issue in ForeignKey ast node 2025-09-27 17:38:45 -04:00
Preston Thorpe
1bacd7ff64 Merge 'core/translate: Persist NOT NULL column constraint to schema table' from Preston Thorpe
closes #3391

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

Closes #3402
2025-09-27 14:34:53 -04:00
PThorpe92
4315a34939 Move png image to assets director 2025-09-27 14:13:45 -04:00
PThorpe92
ace2ac632a Remove semicolon from test 2025-09-27 13:59:51 -04:00
PThorpe92
03046faccb Translate default value Expr::Id to Literal to allow for identifier in col def 2025-09-27 13:56:04 -04:00
PThorpe92
6e3c30623c Fix regression test to not use dot command 2025-09-27 13:17:50 -04:00
PThorpe92
bd17c5d5df Add regression test for alter table with notnull constraint 2025-09-27 13:15:48 -04:00
PThorpe92
b7fc9fef40 Persist NOT NULL column constraint to schema table 2025-09-27 13:12:19 -04:00
Pekka Enberg
2f38d2ef04 Turso 0.2.0-pre.10 2025-09-27 16:52:35 +03:00
Pekka Enberg
9eb6f4b51e Merge 'Sqlean fuzzy string ' from Danawan Bimantoro
Add implementations of string distance and phonetics functions:
fuzzy_damlev
fuzzy_hamming
fuzzy_jarowin
fuzzy_leven
fuzzy_osadist
fuzzy_editdist
fuzzy_soundex
fuzzy_rsoundex
fuzzy_phonetic
fuzzy_caver
fuzzy_translit
This implementation follows sqlean-fuzzy

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

Closes #3262
2025-09-27 16:51:49 +03:00
Pekka Enberg
3d3e39a958 Merge 'Make Sorter Send and Sync' from Pekka Enberg
Closes #3398
2025-09-27 16:51:27 +03:00
Pekka Enberg
d7a0a3db56 Merge 'core/translate: allow creating column called 'rowid'' from Preston Thorpe
closes #3282
includes minor refactor, removing `column_is_rowid_alias`, which is only
checking the public field of the argument Column.

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

Closes #3385
2025-09-27 16:51:09 +03:00
Pekka Enberg
5ff0044961 Merge 'length shall not count when it sees nullc' from Pavan Nambi
fixes #3317

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

Closes #3356
2025-09-27 16:50:50 +03:00
Pekka Enberg
e34a935e0a Merge 'resolve column alias after rewritting column access in the expression in returning insert clause' from Nikita Sivukhin
Fixes https://github.com/tursodatabase/turso/issues/3295

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

Closes #3355
2025-09-27 16:50:42 +03:00
Avinash Sajjanshetty
c2453046fa clippy fixes 2025-09-27 18:16:51 +05:30
Avinash Sajjanshetty
a2df313ad5 Add documentation for the encryption module 2025-09-27 18:11:27 +05:30
Avinash Sajjanshetty
a7237b80ea add tests for checking encryption tampering 2025-09-27 17:49:42 +05:30
Pekka Enberg
2a8a0729c7 Merge 'core/storage: Wrap WalFile::syncing with AtomicBool' from Pekka Enberg
Closes #3397
2025-09-27 15:18:32 +03:00
Pekka Enberg
ce76aa11b2 core/storage: Mark Page as Send and Sync 2025-09-27 15:16:38 +03:00
Avinash Sajjanshetty
dc3d1fa36d Use the SQLite header as associated data for protection
against tampering and corruption.

Previously, we did not use the first 100 bytes in encryption
machinery. This patch changes that and uses that data as
associated data. So in case the header is corrupted or
tampered with, the decryption will fail.
2025-09-27 17:34:51 +05:30
PThorpe92
16d1e7e6a9 Rename function and update comment to match behavior 2025-09-27 07:52:21 -04:00
PThorpe92
8517355c0c make clippy happy 2025-09-27 07:52:21 -04:00
PThorpe92
2e186ce8fa Add regression test for upsert explict non-rowid alias PK 2025-09-27 07:52:20 -04:00
PThorpe92
5ad3e5244b Fix explicit ON CONFLICT target of non-rowid alias primary keys in UPSERT 2025-09-27 07:52:20 -04:00