Commit Graph

31 Commits

Author SHA1 Message Date
Pekka Enberg
e3ec4f7ea2 sql_generation: Add support for predefined columns 2025-10-17 10:47:07 +03:00
Jussi Saurio
0d8a3dda8c Merge 'sql_generation: Fix implementation of LTValue and GTValue for Text types' from Jussi Saurio
## Background
Simulator wants to create predicates that it knows will be Greater or
Less than some known value. It uses `LTValue` and `GTValue` for
generating these.
## Problem
Current implementation simply decrements or increments a random char by
1, and can thus generate strings with control characters like null
terminators that result in parse errors, as seen in e.g. this CI run htt
ps://github.com/tursodatabase/turso/actions/runs/18459131141/job/5258630
5749?pr=3702 of PR #3702
EDIT: I realized the _actual_ problem is in `GTValue` when it decides to
make the string longer, it uses a random char value from `0..255` which
can include null terminators etc. Fixed that too. I think in general
this PR's approach is a bit more predictable so let's keep it.
## Solution
Restrict string mutations to ascii string characters so that the
mutation always results in another ascii string character.

Closes #3708
2025-10-15 09:25:17 +03:00
pedrocarlo
294f842e62 DROP INDEX sql generation 2025-10-13 13:23:44 -03:00
Jussi Saurio
9d6066381e sql_generation: Fix implementation of LTValue and GTValue
Current implementation can generate strings with control characters
like null terminators that result in parse errors.
2025-10-13 17:32:52 +03:00
pedrocarlo
c0f35cc17d disable ALTER COLUMN due to incompatibility with SQLITE INTEGRITY CHECK 2025-10-13 02:34:43 -03:00
pedrocarlo
49e96afd39 generate ALTER COLUMN 2025-10-13 02:34:43 -03:00
pedrocarlo
a18a472685 add option to disable alter column for differential testing 2025-10-13 02:34:43 -03:00
pedrocarlo
a149e55209 fix Drop Column to only be generated if no columns conflict in Indexes 2025-10-13 02:34:43 -03:00
pedrocarlo
9c2edbb8b7 create separate Index struct for sql generation 2025-10-13 02:04:15 -03:00
pedrocarlo
ab152890dd adjust generation of GTValue and LTValue to accomodate for Null Values 2025-10-13 02:04:15 -03:00
pedrocarlo
2cc7947107 define alter table in sql_generation 2025-10-10 11:08:04 -03:00
pedrocarlo
642ec3032d use parser's ColumnDefinition for Sql Generation Column struct 2025-10-09 17:25:04 -03:00
pedrocarlo
fb6c5ffcff move SimValue generation to separate files to facilitate generation of new types of values in the future 2025-10-09 17:25:04 -03:00
bit-aloo
7f8c139638 make clippy happy 2025-10-07 18:27:02 +05:30
bit-aloo
73efe5d853 make table name not repeat in simulator 2025-10-07 17:49:15 +05:30
pedrocarlo
aec6668725 add ?Sized to Arbitrary traits 2025-10-07 02:36:13 -03:00
Nikita Sivukhin
c4b3074575 format 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
fdf8ca88fd introduce exact(...) function - because enum variant will disappear 2025-09-26 13:01:49 +04:00
Pekka Enberg
9f6c11a74f sql_generation: Fix predicate column indexing
The number of columns in the row can be less than the number of columns in the
table so fix out of bounds error in indexing.
2025-09-08 11:59:45 +03:00
pedrocarlo
5f24ff6e45 fix non determinism by using IndexSet for order preserving iteration 2025-09-05 02:00:18 -03:00
pedrocarlo
961c0cd282 script to save JsonSchema for editor integration 2025-08-30 12:17:50 -03:00
pedrocarlo
a1407869d4 add serde, schemars and garde to profiles and options 2025-08-30 11:31:52 -03:00
pedrocarlo
faa943fc76 reduce cloning for pick_unique 2025-08-30 11:31:52 -03:00
pedrocarlo
bc6976fd33 add Select and Insert generation options 2025-08-30 11:31:52 -03:00
pedrocarlo
9bc8bdb279 all Arbitrary traits need to pass a GenerationContext 2025-08-30 11:31:52 -03:00
pedrocarlo
1a8b78afd8 create ArbitraryContext and ArbitraryContextFrom traits to pass generation context + start implementing them in Table + FromClause 2025-08-30 11:31:52 -03:00
pedrocarlo
e0552629e3 create Generation Options structs 2025-08-30 11:31:52 -03:00
pedrocarlo
8010b7d0c7 make simulator use sql_generation crate as dependency 2025-08-25 22:59:31 -03:00
pedrocarlo
0c1228b484 add Generation context trait to decouple Simulator specific code 2025-08-25 22:59:31 -03:00
pedrocarlo
0285bdd72c copy generation code from simulator 2025-08-25 22:59:31 -03:00