Commit Graph

39 Commits

Author SHA1 Message Date
Nikita Sivukhin
86a95e813d Merge branch 'main' into quoting-fix-attempt-2 2025-09-29 10:58:51 +04:00
PThorpe92
30f80c2000 Correct spelling issue in ForeignKey ast node 2025-09-27 17:38:45 -04:00
Nikita Sivukhin
27c9506059 do not auto-lowercase Name identifiers
- this is complicated because column names must preserve case
2025-09-26 13:01:49 +04:00
Nikita Sivukhin
c4b3074575 format 2025-09-26 13:01:49 +04:00
Nikita Sivukhin
ae24d637a8 adjust edge-cases 2025-09-26 13:01:49 +04:00
Nikita Sivukhin
12b89fd2f1 do not use Name::new 2025-09-26 13:01:49 +04:00
Nikita Sivukhin
68fd940d73 small fix to make pragmas work 2025-09-26 13:01:49 +04:00
Nikita Sivukhin
f3f9219795 completely remove usage of enum variants 2025-09-26 13:01:49 +04:00
Nikita Sivukhin
fdf8ca88fd introduce exact(...) function - because enum variant will disappear 2025-09-26 13:01:49 +04:00
Nikita Sivukhin
57e52077be add link to the docs 2025-09-19 16:48:43 +04:00
Nikita Sivukhin
c63c820bb7 add busy_timeout pragma 2025-09-19 16:48:12 +04:00
Pekka Enberg
d8f07fe3da core: Panic on fsync() error by default
Retrying fsync() on error was historically not safe ("fsyncgate") and
Postgres still defaults to panicing on fsync(). Therefore, add a
"data_sync_retry" pragma (disabled by default) and use it to determine
whether to panic on fsync() error or not.
2025-09-13 10:21:12 +03:00
Pekka Enberg
433b60555f Add BEGIN CONCURRENT support for MVCC mode
Currently, when MVCC is enabled, every transaction mode supports
concurrent reads and writes, which makes it hard to adopt for existing
applications that use `BEGIN DEFERRED` or `BEGIN IMMEDIATE`.

Therefore, add support for `BEGIN CONCURRENT` transactions when MVCC is
enabled. The transaction mode allows multiple concurrent read/write
transactions that don't block each other, with conflicts resolved at
commit time. Furthermore, implement the correct semantics for `BEGIN
DEFERRED` and `BEGIN IMMEDIATE` by taking advantage of the pager level
write lock when transaction upgrades to write. This means that now
concurrent MVCC transactions are serialized against the legacy ones when
needed.

The implementation includes:

- Parser support for CONCURRENT keyword in BEGIN statements

- New Concurrent variant in TransactionMode to distinguish from regular
  read/write transactions

- MVCC store tracking of exclusive transactions to support IMMEDIATE and
  EXCLUSIVE modes alongside CONCURRENT

- Proper transaction state management for all transaction types in MVCC

This enables better concurrency for applications that can handle
optimistic concurrency control, while still supporting traditional
SQLite transaction semantics via IMMEDIATE and EXCLUSIVE modes.
2025-09-11 16:05:52 +03:00
TcMits
33a04fbaf7 resolve conflict 2025-09-02 17:30:10 +07:00
Levy A.
678ca8d33b feat(parser): add ALTER COLUMN 2025-08-30 03:10:39 -03:00
Pekka Enberg
44ed4d562f core: Initial pass on synchronous pragma
This adds support for "OFF" and "FULL" (default) synchronous modes. As
future work, we need to add NORMAL and EXTRA as well because
applications expect them.
2025-08-28 16:02:41 +03:00
TcMits
4ddfdb2a62 finish 2025-08-27 14:58:35 +07:00
TcMits
50bdaec6d0 merge main 2025-08-27 13:36:54 +07:00
pedrocarlo
aa025c9798 fix missing functions after revert 2025-08-26 10:13:45 -03:00
Pekka Enberg
26ba09c45f Revert "Merge 'Remove double indirection in the Parser' from Pedro Muniz"
This reverts commit 71c1b357e4, reversing
changes made to 6bc568ff69 because it
actually makes things slower.
2025-08-26 14:58:21 +03:00
Pekka Enberg
5dd1bca4d3 Merge 'Decouple SQL generation from Simulator crate' from Pedro Muniz
Decouple Sql generation code from simulator code, so that it can
potentially be reused for fuzzing on other crates and to create a
`GenerationContext` trait so that it becomes easier to create
`Simulation Profiles`. Ideally in further PRs, I want to expand the
`GenerationContext` trait so we can guide the generation with context
from the simulation profile.
Depends on #2789 .

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

Closes #2793
2025-08-26 09:41:58 +03:00
Pekka Enberg
8f11311473 Merge 'Improve encryption API' from Avinash Sajjanshetty
This patch brings a bunch of quality of life improvements to encryption:
1. Previously, we just let any string to be used as a key. I have
updated the `PRAGMA hexkey=''` to get the key in hex. I have also
renamed from `key`, because that will be used to get passphrase
2. Added `PRAGMA cipher` so that now users can select which cipher they
want to use (for now, either `aegis256` or `aes256gcm`)
3. We now set the encryption context when both cipher and key are set
I also updated tests to reflect this.

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

Closes #2779
2025-08-26 08:32:29 +03:00
pedrocarlo
0c1228b484 add Generation context trait to decouple Simulator specific code 2025-08-25 22:59:31 -03:00
pedrocarlo
642060f283 refactor sql_generation/model/query 2025-08-25 22:59:31 -03:00
pedrocarlo
5108c72a28 remove box from Vec<Box<Expr>> 2025-08-25 19:47:46 -03:00
Pekka Enberg
8eab179a53 parser/ast: Add Register AST node 2025-08-25 17:48:17 +03:00
Avinash Sajjanshetty
328c5edf4d Add PRAGMA cipher to allow setting cipher algo 2025-08-25 02:17:53 +05:30
Avinash Sajjanshetty
543025f57a rename encryption PRAGMA key to hexkey 2025-08-25 01:32:41 +05:30
TcMits
399f10fe9a refactor parser fmt 2025-08-23 19:16:26 +07:00
Levy A.
c6b032de63 feat: add AST formating and checking 2025-08-21 15:19:17 -03:00
Levy A.
dd39f47cda feat: add materialized view + implement essential methods for core 2025-08-21 15:19:16 -03:00
Levy A.
186e2f5d8e switch to new parser 2025-08-21 15:19:16 -03:00
TcMits
4d91f19ab2 rebase 2025-08-15 17:05:28 +07:00
TcMits
22f53d1fe6 clippy again 2025-08-15 16:45:18 +07:00
TcMits
1b925e4f92 finish CREATE TRIGGER without tests 2025-08-12 14:22:42 +07:00
TcMits
b428d0bd75 finish ALTER without tests 2025-08-09 17:50:51 +07:00
TcMits
2f851127cd finish PRAGMA 2025-08-08 15:24:05 +07:00
TcMits
a5041a685c replace Option<Vec<...>> with Vec<...> 2025-08-08 14:35:43 +07:00
TcMits
436d21c81d create turso_parser crate 2025-08-06 15:42:51 +07:00