Commit Graph

8990 Commits

Author SHA1 Message Date
PThorpe92
dde8a49f4e normalize identifier for creating autoindex to prevent e.g. sqlite_autoindextable_2 2025-09-17 13:25:33 -04:00
PThorpe92
4e71524e42 normalize identifier for ID::Name in upsert expr rewriting 2025-09-17 13:24:06 -04:00
Preston Thorpe
8c53d7f024 Merge 'translation: rewrite expressions and properly handle quoted identifiers in UPSERT' from Preston Thorpe
This PR fixes bugs found in the [turso-
go](https://github.com/tursodatabase/turso-go) driver with UPSERT clause
earlier, where `Gorm` will (obviously) use Expr::Variable's as well as
use quotes for `Expr::Qualified` in the tail end of an UPSERT statement.
Example:
```sql
INSERT INTO users (a,b,c) VALUES (?,?,?) ON CONFLICT (`users`.`a`) DO UPDATE SET b = `excluded`.`b`, a = ?;
```
and previously we were not properly calling `rewrite_expr`, which was
not properly setting the anonymous `Expr::Variable` to `__param_N` named
parameter, so it would ignore it completely, then return the wrong # of
parameters.
Also, we didn't handle quoted "`excluded`.`x`", so it would panic in the
optimizer that Qualified should have been rewritten earlier.

Closes #3157
2025-09-17 11:25:13 -04:00
Jussi Saurio
8bf52de94b Merge 'Remove serialization of normal write/commit path' from Preston Thorpe
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3089
2025-09-17 17:30:45 +03:00
Pekka Enberg
f9db3e97fd Merge 'core/vtab: Wrap InternalVirtualTable with RwLock' from Pekka Enberg
Closes #3180
2025-09-17 16:40:20 +03:00
Pekka Enberg
617adf8eba Merge 'Clean up encryption feature flag usage' from Avinash Sajjanshetty
Closes #3178
2025-09-17 16:40:08 +03:00
Pekka Enberg
5ebf6cd128 core/vtab: Wrap InternalVirtualTable with RwLock 2025-09-17 15:43:33 +03:00
Pekka Enberg
b98e1efb17 Merge 'core/storage: Wrap Pager::checkpoint_state in RwLock' from Pekka Enberg
Closes #3176
2025-09-17 14:41:18 +03:00
Avinash Sajjanshetty
4eaee0fd81 clean up encryption feature flag usage 2025-09-17 16:30:51 +05:30
Preston Thorpe
bcafb288ad Merge 'Fix is_nonnull returns true on 1 / 0' from Lâm Hoàng Phúc
turso:
```sh
turso> CREATE TABLE t (x PRIMARY KEY, y, z);
turso> INSERT INTO t VALUES (37, -70, -196792117);
turso> SELECT * FROM t WHERE  (1 / 0) >= -3289742039 < t.x;
┌────┬─────┬────────────┐
│ x  │ y   │ z          │
├────┼─────┼────────────┤
│ 37 │ -70 │ -196792117 │
└────┴─────┴────────────┘
turso>
```
sqlite:
```sh
sqlite> CREATE TABLE t (x PRIMARY KEY, y, z);
sqlite> INSERT INTO t VALUES (37, -70, -196792117);
sqlite> SELECT * FROM t WHERE  (1 / 0) >= -3289742039 < t.x;
sqlite>
```
related: https://github.com/tursodatabase/turso/actions/runs/17765571409
/job/50488042583?pr=3147#step:8:855

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3167
2025-09-17 06:55:55 -04:00
PThorpe92
97c11898fe Minor refactor in translate/insert 2025-09-17 06:44:10 -04:00
PThorpe92
8dd1cf11eb Add some more specific tests for upsert 2025-09-17 06:44:10 -04:00
PThorpe92
5dd466941e Handle upsert even in inserting_multiple_rows case 2025-09-17 06:44:09 -04:00
PThorpe92
85eee42bf1 Support quoted qualified identifiers in UPSERT excluded.x clauses 2025-09-17 06:44:08 -04:00
PThorpe92
d2cd833b86 Rewrite exprs in set + where clause for UPSERT 2025-09-17 06:38:25 -04:00
Pekka Enberg
2b89dd4ea8 Merge 'core: Wrap Pager dirty_pages in RwLock' from Pekka Enberg
Make it Sync and Send.

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

Closes #3175
2025-09-17 13:34:47 +03:00
Pekka Enberg
58b0e8665d Merge 'core: Wrap MvCursor in Arc<RwLock<>>' from Pekka Enberg
Make it Send and Sync.

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

Closes #3174
2025-09-17 13:34:34 +03:00
Pekka Enberg
cb68c953e1 Merge 'core/incremental: Wrap ViewTransactionState in Arc' from Pekka Enberg
Make it Send.

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

Closes #3173
2025-09-17 13:07:54 +03:00
Pekka Enberg
a2f6ff819a Merge 'core/function: Wrap ExtFunc in Arc' from Pekka Enberg
Make it Send.

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

Closes #3172
2025-09-17 13:07:43 +03:00
Pekka Enberg
d3185d2f72 core/storage: Wrap Pager::checkpoint_state in RwLock 2025-09-17 13:04:37 +03:00
Pekka Enberg
bede1229a9 core: Wrap Pager dirty_pages in RwLock
Make it Sync and Send.
2025-09-17 12:55:26 +03:00
Pekka Enberg
182565fe0c core: Wrap MvCursor in Arc<RwLock<>>
Make it Send and Sync.
2025-09-17 12:46:55 +03:00
Pekka Enberg
e6822d26ab Merge 'core/vtab: Mark VTabModuleImpl as Send and Sync' from Pekka Enberg
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3171
2025-09-17 12:25:12 +03:00
Pekka Enberg
c2b8bb0a2f core/incremental: Wrap ViewTransactionState in Arc
Make it Send.
2025-09-17 12:23:29 +03:00
Pekka Enberg
dcb92f0b50 Merge 'core/vtab: Use AtomicPtr for table_ptr' from Pekka Enberg
Make it Send.

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

Closes #3169
2025-09-17 12:13:18 +03:00
Jussi Saurio
9a2797963a Merge 'Remove LimboResult enum and InsnFunctionStepResult::Busy variant' from Jussi Saurio
We can just use `LimboError::Busy` for both of these.

Reviewed-by: Pekka Enberg <penberg@iki.fi>

Closes #3170
2025-09-17 12:06:54 +03:00
Pekka Enberg
d113c3ac6b core/function: Wrap ExtFunc in Arc
Make it Send.
2025-09-17 11:57:23 +03:00
Pekka Enberg
d7977c25a8 core/vtab: Mark VTabModuleImpl as Send and Sync 2025-09-17 11:48:42 +03:00
Pekka Enberg
6472a71ae7 Merge 'core: Wrap symbol table with RwLock' from Pekka Enberg
Make it Send.

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

Closes #3168
2025-09-17 11:47:40 +03:00
Jussi Saurio
4cda0d5d99 mvcc fuzz: fix tx startpoint as BEGIN CONCURRENT can fail 2025-09-17 11:43:20 +03:00
Jussi Saurio
e066e4f747 clippy 2025-09-17 11:25:50 +03:00
Jussi Saurio
b9ceacc356 Remove InsnFunctionStepResult::Busy
we don't need all these busy variants, let's just handle
LimboError::Busy
2025-09-17 11:22:49 +03:00
Pekka Enberg
e21959d80e core/vtab: Use AtomicPtr for table_ptr
Make it Send.
2025-09-17 11:22:40 +03:00
Pekka Enberg
602c247f87 Merge 'core/ext: Switch vtab_modules from Rc to Arc' from Pekka Enberg
Closes #3166
2025-09-17 11:19:27 +03:00
Pekka Enberg
d7158262ab Merge 'core/storage: Clean up unused import warning in encryption.rs' from Pekka Enberg
...happens when encryption feature is disabled.

Closes #3165
2025-09-17 11:19:20 +03:00
Jussi Saurio
dc103da2ed Remove LimboResult
this is only used for returning LimboResult::Busy, and we already
have LimboError::Busy, so it only adds confusion.

Moreover, the current busy handler was not handling LimboError::Busy,
because it's returned as an error, not as Ok. So this may fix the
"busy handler not working" issue in the perf thrpt benchmark.
2025-09-17 11:04:44 +03:00
Pekka Enberg
50653258cf core: Wrap symbol table with RwLock
Make it Send.
2025-09-17 10:58:32 +03:00
TcMits
6606bf12d3 is_nonnull returns true on 1 / 0 2025-09-17 14:50:15 +07:00
Pekka Enberg
06d869ea5e core/ext: Switch vtab_modules from Rc to Arc 2025-09-17 10:36:12 +03:00
Pekka Enberg
6cfd803dad Merge 'core: Convert Rc<Pager> to Arc<Pager>' from Pekka Enberg
Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3154
2025-09-17 10:23:15 +03:00
Pekka Enberg
1e90572e7a core/storage: Clean up unused import warning in encryption.rs
...happens when encryption feature is disabled.
2025-09-17 10:22:36 +03:00
Pekka Enberg
17e9f05ea4 core: Convert Rc<Pager> to Arc<Pager> 2025-09-17 09:32:49 +03:00
Jussi Saurio
104b8dd083 Merge 'Encrypt page 1' from
This PR extends the existing encryption support to include the database
header page (page 1).

Reviewed-by: Avinash Sajjanshetty (@avinassh)

Closes #3040
2025-09-17 09:26:06 +03:00
Jussi Saurio
fad8d0c8b8 fix build 2025-09-17 08:45:13 +03:00
Jussi Saurio
cae234818b Merge 'Inital support for window functions' from Piotr Rżysko
This adds basic support for window functions. For now:
* Only existing aggregate functions can be used as window functions.
* Specialized window-specific functions (`rank`, `row_number`, etc.) are
not yet supported.
* Only the default frame definition is implemented:
`RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE NO OTHERS`.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3079
2025-09-17 08:29:16 +03:00
Pekka Enberg
5680fe3903 Merge 'whopper: Handle write-write conflict' from Pekka Enberg
Write-write conflict is not an error that stops the simulation.

Closes #3149
2025-09-16 20:34:04 +03:00
Pekka Enberg
cf0480e469 whopper: Handle write-write conflict
Write-write conflict is not an error that stops the simulation. Note
that the transaction is rolled back automatically.
2025-09-16 17:58:33 +03:00
Pekka Enberg
8bf4105bca Fix Antithesis Dockerfile some more 2025-09-16 17:14:16 +03:00
Pekka Enberg
709b6d9579 Fix simulator and Antithesis Dockerfiles 2025-09-16 17:09:49 +03:00
rajajisai
e605aff31b Merge branch 'main' into enc-page-1 2025-09-16 10:06:00 -04:00