Commit Graph

5687 Commits

Author SHA1 Message Date
Jussi Saurio
f5ee4807da Properly differentiate between source and target in UPDATE
- Encode information about ephemeral source table in OperationMode::UPDATE
  if present
- Use OperationMode information to correctly resolve cursors in UPDATE
2025-10-14 14:17:28 +03:00
Jussi Saurio
691dce6b8a Make decision about UpdatePlan::ephemeral_plan _after_ optimizer
An ephemeral table is required if the b-tree key of the table (rowid)
or the index (index key) is affected by the UPDATE.
2025-10-14 14:17:28 +03:00
Jussi Saurio
c2fe13ad4f Update documentation of UpdatePlan::ephemeral_plan
It now better reflects when it is used.
2025-10-14 12:18:53 +03:00
Jussi Saurio
bc80ac1754 require &mut ProgramBuilder argument in optimize_plan()
this will be used for ephemeral plan construction for UPDATE in
a later commit.
2025-10-14 12:18:13 +03:00
Jussi Saurio
29770382f9 temporarily remove ephemeral plan construction from prepare_update_plan
the decision to use an ephemeral table in UPDATE will be made after
the optimizer has made the decision about which index to use. this will
be implemented in a later commit.
2025-10-14 12:14:15 +03:00
Jussi Saurio
4e34c6be51 Merge 'names shall not be shared between tables,indexs,vtabs,views' from Pavan Nambi
closes #3675

Closes #3681
2025-10-14 07:30:37 +03:00
Jussi Saurio
bd15fee1f8 Merge 'Get aliases to where shall they be used' from Pavan Nambi
closes #3678

Closes #3680
2025-10-14 07:28:09 +03:00
Jussi Saurio
1aed9c9694 Merge 'remove cfg for MAP_ANONYMOUS' from Pedro Muniz
Related to #2587

Reviewed-by: Preston Thorpe <preston@turso.tech>
Reviewed-by: bit-aloo (@Shourya742)

Closes #3721
2025-10-14 07:26:09 +03:00
Jussi Saurio
61109963fc Merge 'fix backwards compatible rowid alias behaviour' from Pedro Muniz
Closes #3665

Closes #3723
2025-10-14 07:24:42 +03:00
pedrocarlo
83dde9b55c fix backwards compatible rowid alias behaviour 2025-10-13 20:41:45 -03:00
pedrocarlo
0ef5ec007c remove cfg for MAP_ANONYMOUS 2025-10-13 18:05:18 -03:00
Pekka Enberg
1c9eaa3d95 Merge 'Restrict joins to max 63 tables and allow arbitrary number of table columns' from Jussi Saurio
Closes #2076
Closes #2075

Closes #3705
2025-10-13 18:23:11 +03:00
Pavan-Nambi
57a06835bf add test and fmt and clippy
i was stupid

remove comment
2025-10-13 18:07:51 +05:30
Jussi Saurio
c54e150a52 Merge 'Fix: Table entry is not removed from sqlite_schema when a table is dropped' from
Fixes #3682 .
Ignore case of table name when dropping table.

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

Closes #3683
2025-10-13 15:02:29 +03:00
Jussi Saurio
3669437482 Add vibecoded tests for ColumnUsedMask 2025-10-13 14:03:34 +03:00
Jussi Saurio
e055ed9a8d Allow arbitrarily many columns in a table
Use roaring bitmaps because ColumnUsedMask is likely to be
sparsely populated.
2025-10-13 13:30:26 +03:00
Jussi Saurio
59a1c2ae2e Disallow joining more than 63 tables
Returns an error instead of panicing
2025-10-13 13:30:03 +03:00
Pekka Enberg
77492641db Merge 'Move all checksum tests behind the feature flag' from Avinash Sajjanshetty
Closes #3704
2025-10-13 11:46:56 +03:00
Avinash Sajjanshetty
4a29694475 rename checksums tests appropriately 2025-10-13 13:48:07 +05:30
Avinash Sajjanshetty
ee479d2e52 Move all checksum tests behind the feature flag 2025-10-13 13:47:25 +05:30
Pekka Enberg
2a02cafc73 core/vdbe: Improve IdxDelete error messages with context
We currently return the exact same error from two different IdxDelete
paths. Improve the messages with context about what we're doing to make
this error more debuggable.
2025-10-13 09:42:04 +03:00
Pavan-Nambi
e1f23aeb2c fmt and add tests 2025-10-12 22:23:04 +05:30
Pavan-Nambi
3491e1f42e add if alais and allow iff to have more arguments 2025-10-12 22:17:35 +05:30
Pekka Enberg
7221f79a2f Merge 'Stop ignoring table's max value incase of a manual update in autoincrement.' from Pavan Nambi
closes https://github.com/tursodatabase/turso/issues/3664

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

Closes #3668
2025-10-12 18:38:13 +03:00
Pavan-Nambi
36bf88119f add tests
clippy

expect err to make clippy happy

cleanup
2025-10-12 16:38:12 +05:30
Pavan-Nambi
c59b0ffa65 fix(core/vdbe):pass largest value from table to op_new_rowid 2025-10-12 15:57:29 +05:30
rajajisai
6c082660ca convert table name to lower case 2025-10-11 21:39:41 -04:00
Pavan-Nambi
88d5ee0cf1 names shall not be shared between tables,index,vtabs,views 2025-10-12 05:45:59 +05:30
Pavan-Nambi
ae00542755 get em aliases shall they be used 2025-10-12 05:25:22 +05:30
ultraman
5153e2aa32 Fix disallow reserved prefixes in ALTER TABLE RENAME TO 2025-10-11 16:30:25 +08:00
Pekka Enberg
4af61d8049 Merge 'core/btree: try to introduce trait for cursors' from Pere Diaz Bou
I've added a trait called `CursorTrait`. I know it's not a good name for
now, but I didn't know what tto change then enum `Cursor` to. This trait
wraps all common functionality, and some functionality that is yet too
specific that needs to be fixed.
This is needed in order to have layered cursors where for example,
MvccCursor will need a fallback BTreeCursor.

Closes #3660
2025-10-10 19:25:39 +03:00
Pere Diaz Bou
160a84250e core: add CursorTrait imports where needed 2025-10-10 15:04:15 +02:00
Pere Diaz Bou
b3ab51d66a core/vdbe: store cursor as a dyn CursorTrait 2025-10-10 15:04:15 +02:00
Pere Diaz Bou
d0d6db301b core/btree: CursorTrait 2025-10-10 15:04:15 +02:00
Jussi Saurio
7725f336b8 Merge 'Fix incorrectly using an equality constraint twice for index seek' from Jussi Saurio
Prevents something like `WHERE x = 5 AND x = 5` from becoming a two
component index key.
Closes #3656

Reviewed-by: Nikita Sivukhin (@sivukhin)

Closes #3658
2025-10-10 13:33:43 +03:00
Jussi Saurio
74e04634aa Fix incorrectly using an equality constraint twice for index seek
Prevents something like `WHERE x = 5 AND x = 5` from becoming a two
component index key.

Closes #3656
2025-10-10 13:19:19 +03:00
Pekka Enberg
e727b8e0dc Merge 'Vector improvements' from Nikita Sivukhin
This PR introduces sparse vectors support and jaccard distance
implementation.
Also, this PR restructure the code to have all vector operations in
separate files (they grow pretty quickly as new vector representations
added to the DB).

Closes #3647
2025-10-10 13:08:46 +03:00
Pekka Enberg
77924c6c71 Merge 'Optimize sorter' from Jussi Saurio
Various little fixes to `Sorter` that reduce unnecessary work.
Makes TPC-H query 1 roughly 2x faster, which is a lot because it
originally took 30-40 seconds depending on the CI run

Closes #3645
2025-10-10 13:06:53 +03:00
Pekka Enberg
cf22819817 Merge 'Make sqlite_version() compatible with SQLite' from Glauber Costa
I found an application in the open that expects sqlite_version() to
return a specific string (higher than 3.8...).
We had tons of those issues at Scylla, and the lesson was that you tell
your kids not to lie, but when life hits, well... you lie.
We'll add a new function, turso_version, that tells the truth.

Closes #3635
2025-10-10 13:06:36 +03:00
Nikita Sivukhin
51122d3e9c fix clippy 2025-10-10 11:39:06 +04:00
Nikita Sivukhin
7e727d07af fix bugs add tests 2025-10-09 23:23:16 +04:00
Nikita Sivukhin
10c51c8da0 add test for convert operation 2025-10-09 22:14:38 +04:00
Nikita Sivukhin
e18f26a1f1 fix bug after refactoring 2025-10-09 21:28:46 +04:00
Nikita Sivukhin
ac9a25a417 fix clippy 2025-10-09 21:19:35 +04:00
Nikita Sivukhin
5336801574 add jaccard distance 2025-10-09 21:15:39 +04:00
Nikita Sivukhin
585d11b736 implement operations for sparse vectors 2025-10-09 20:52:58 +04:00
Jussi Saurio
edf40cc65b clippy 2025-10-09 19:00:40 +03:00
Jussi Saurio
27a88b86dc Reuse a single RecordCursor per PseudoCursor 2025-10-09 18:56:49 +03:00
Jussi Saurio
812709cf8e inline collation comparison functions 2025-10-09 18:56:49 +03:00
Nikita Sivukhin
84643dc4f2 implement sparse vector operations 2025-10-09 19:19:33 +04:00