Commit Graph

33 Commits

Author SHA1 Message Date
Jussi Saurio
38183d3b3b tcl: add regression test for large text keys 2025-07-15 18:48:06 +03:00
Pekka Enberg
9285d8b83b Merge 'Fix: OP_NewRowId to generate semi random rowid when largest rowid is i64::MAX' from Krishna Vishal
- `OP_NewRowId` now generates new rowid semi randomly when the largest
rowid in the table is `i64::MAX`.
- Introduced new `LimboError` variant `DatabaseFull` to signify that
database might be full (SQLite behaves this way returning
`SQLITE_FULL`).
Now:
```SQL
turso> CREATE TABLE q(x INTEGER PRIMARY KEY, y);
turso> INSERT INTO q VALUES (9223372036854775807, 1);
turso> INSERT INTO q(y) VALUES (2);
turso> INSERT INTO q(y) VALUES (3);
turso> SELECT * FROM q;
┌─────────────────────┬───┐
│ x                   │ y │
├─────────────────────┼───┤
│ 1841427626667347484 │ 2 │
├─────────────────────┼───┤
│ 4000338366725695791 │ 3 │
├─────────────────────┼───┤
│ 9223372036854775807 │ 1 │
└─────────────────────┴───┘
```
Fixes: https://github.com/tursodatabase/turso/issues/1977

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

Closes #1985
2025-07-14 11:56:09 +03:00
Krishna Vishal
7f2a6187fb Add regression test 2025-07-14 13:09:36 +05:30
Nikita Sivukhin
6d3bdf5b9e do not check rowid alias for null 2025-07-12 14:07:26 +04:00
meteorgan
6768f073c8 add tests for except operator 2025-07-08 22:57:20 +08:00
meteorgan
2c4847210f ajust code to accommodate index_experimental feature 2025-06-27 11:50:19 +08:00
meteorgan
41def8895f make intersect in compound work with insert 2025-06-27 11:50:19 +08:00
Pere Diaz Bou
814f68043d filter out sqlite3 executable too 2025-06-17 19:33:23 +02:00
Pere Diaz Bou
4b88d47aba disable last unique_insert tcl tests 2025-06-17 19:33:23 +02:00
Pere Diaz Bou
63b37ea6f2 re-enable tests that work with indexes 2025-06-17 19:33:23 +02:00
Anton Harniakou
f20e83eea1 Run tests in memory 2025-06-09 12:45:17 +03:00
Anton Harniakou
4b97d49f75 Rewrite tests using do_execsql_test_any_error
There's some kind of a bug unrelated to the feature
implemented,
which results in test different results between sqlite3 and limbo
if do_execsql_test_on_specific_db is used to get an error message content.

For example in limbo:
```sql
do_execsql_test_on_specific_db {:memory:} not_null_primary_key {
    CREATE TABLE t2 (y INT PRIMARY KEY NOT NULL);
    INSERT INTO t2 (y) VALUES (1);
    INSERT INTO t2 (y) VALUES (NULL);
    SELECT * FROM t2;
} {"Runtime error: NOT NULL constraint failed: t2.y (19)"
1} # notice the 1
```

And in sqlite3 we get
```sql
do_execsql_test_on_specific_db {:memory:} not_null_primary_key {
    CREATE TABLE t2 (y INT PRIMARY KEY NOT NULL);
    INSERT INTO t2 (y) VALUES (1);
    INSERT INTO t2 (y) VALUES (NULL);
    SELECT * FROM t2;
} {"Runtime error: NOT NULL constraint failed: t2.y (19)"} # notice the
absense of 1
```
therefore this commit rewrites tests to use do_execsql_test_any_error
instead.
2025-06-09 12:32:22 +03:00
Anton Harniakou
8d141e5e21 Another error message fix 2025-06-06 13:06:59 +03:00
Anton Harniakou
0e4007c941 Fix contents of the NOT NULL error in tests 2025-06-06 12:59:58 +03:00
Anton Harniakou
5cd0614ac2 Test INSERT INTO with SELECT and VALUES (...), (...) syntax 2025-06-06 11:43:33 +03:00
Anton Harniakou
32b6555c5d Add tests for not null constraint 2025-06-06 10:55:49 +03:00
Pere Diaz Bou
da4190a23e Convert u64 rowid to i64
Rowids can be negative, therefore let's swap to i64
2025-05-30 13:07:31 +02:00
Jussi Saurio
d18ab34193 Fix: dont pollute testing.db in insert tests 2025-05-29 20:51:29 +03:00
krishna sindhur
4b66bcb2a7 fix: stress test will ignore unique constraint violation 2025-05-29 15:11:43 +05:30
pedrocarlo
1410e57112 correct union result_row or yield emission + test 2025-05-26 01:06:26 -03:00
pedrocarlo
ee93316c46 fix num_values detection + emitting correct column for temp_table + tests 2025-05-25 19:15:28 -03:00
pedrocarlo
90e3c8483d tests with compound select 2025-05-25 19:15:28 -03:00
pedrocarlo
c86e7542ec simple smoke tests 2025-05-25 19:13:40 -03:00
pedrocarlo
c5f004c1d6 added test and adjustments 2025-05-14 11:34:39 -03:00
Jussi Saurio
44e282f630 Add multi-row insert regression test 2025-05-13 09:03:01 +03:00
Anton Harniakou
d907f95716 Add tests for INSERT with specified column-name list 2025-05-06 11:31:41 +03:00
Ihor Andrianov
ad91a2ae51 fix tests 2025-04-07 20:29:45 +03:00
Ihor Andrianov
3a97fd075f add tests 2025-04-07 20:02:14 +03:00
psvri
845de125db Align MustBeInt logic with sqlite 2025-01-16 00:09:45 +05:30
psvri
9cc9577c91 Run all statements from sql argument in cli 2025-01-15 18:19:39 +05:30
krishvishal
7e2928a5f1 Feature: last_insert_rowid()
- Changed `Cursor` trait to be able to get access to `root_page`
- SQLite only updates last_insert_rowid for non-schema inserts. So we check if the `InsertAwait` is not for `root_page` before
  updating rowid
2024-12-09 22:48:42 +05:30
Kim Seon Woo
9d878fda55 Remove failing test for now 2024-08-18 21:05:01 +02:00
Kim Seon Woo
c6402aa341 Add tcl 2024-08-18 21:00:36 +02:00