Commit Graph

25 Commits

Author SHA1 Message Date
PThorpe92
9d4dee01fb Add regression test for explicit rowid update 2025-09-25 19:16:20 -04:00
Jussi Saurio
22be35e790 Add regression test 2025-08-21 16:31:12 +03:00
Jussi Saurio
86b1232268 chore: enable indexes by default 2025-08-01 15:44:56 +03:00
Diego Reis
31c73f3c9a Add basic support for row values in UPDATE .. SET statements
e.g `.. SET (a, b) = (1, 2)` is equivalent to `.. SET a = 1, b = 2`.

Alongside, to repeated lhs values, `(a, a)`, the last rhs prevail; so
`.. SET (a, a) = (1, 2)` is equivalent to `.. SET a = 2`
2025-07-31 00:08:15 -03:00
Pekka Enberg
6bf6cc28e4 Merge 'Implement the Returning statement for inserts and updates' from Glauber Costa
They are very similar. DELETE is very different, so that one we'll do it
later.

Closes #2276
2025-07-27 09:11:16 +03:00
Glauber Costa
5d8d08d1b6 Implement the Returning statement for inserts and updates
They are very similar. DELETE is very different, so that one we'll
do it later.
2025-07-26 09:01:09 -05:00
Iaroslav Zeigerman
f13b9105b9 Fix error handling when binding column references while translating the UPDATE statement 2025-07-26 04:51:42 -07:00
Jussi Saurio
022f679fab chore: make every CREATE TABLE stmt in entire repo have 1 space after tbl name
`BTreeTable::to_sql` makes us incompatible with SQLite by losing e.g. the original whitespace provided during the CREATE TABLE command.

For now let's fix our tests by regex-replacing every CREATE TABLE in
the entire repo to have exactly 1 space after the table name in the
CREATE TABLE statement.
2025-07-22 11:35:21 +03:00
AdrianAcala
7ca902979d Fix: Correctly update indexes when INTEGER PRIMARY KEY (rowid alias) changes (Issue #1897)
When an `UPDATE` statement modifies a table's `INTEGER PRIMARY KEY` (which acts as a `rowid` alias) alongside other indexed columns, the index entries were incorrectly retaining the old `rowid`. This led to stale index references, causing subsequent queries to return incorrect results.

This change ensures that when the `rowid` alias is part of the `SET` clause in an `UPDATE` statement, the new `rowid` value is used for generating and updating index records. This guarantees that all index entries correctly point to the updated row, resolving the data inconsistency.
2025-07-01 16:03:27 +00:00
Pekka Enberg
b87ce6d178 Merge 'Fix deleting previous rowid when rowid is in the Set Clause' from Pedro Muniz
Closes #1888 . This PR fixes UPDATE translation by not emitting an
ephemeral plan when we are doing a `RowIdEq` search. Also, we should
delete the previous rowid when the rowid is in the set clause.

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

Closes #1891
2025-06-30 11:58:05 +03:00
Pekka Enberg
9c1b7897ac Fix URLs to point to github.com/tursodatabase/turso 2025-06-30 11:23:53 +03:00
pedrocarlo
ae569fbd7d add test 2025-06-29 17:13:53 -03:00
pedrocarlo
b3351dc709 tests + adjustment to halt error message 2025-06-20 16:29:10 -03:00
pedrocarlo
eda9d20a0b tests 2025-06-20 16:28:10 -03:00
Pere Diaz Bou
814f68043d filter out sqlite3 executable too 2025-06-17 19:33:23 +02:00
Pere Diaz Bou
032337745b disable more tests without index 2025-06-17 19:33:23 +02:00
Jussi Saurio
30e4511d62 Merge 'NOT NULL constraint' from Anton Harniakou
Implements basic support for `NOT NULL` contraint check.

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

Closes #1675
2025-06-13 14:25:24 +03:00
Anton Harniakou
4b0b119f70 Add UPDATE tests 2025-06-11 14:24:35 +03:00
pedrocarlo
0da9d65d3e test 2025-06-10 12:07:38 -03:00
Jussi Saurio
51abeca896 Add regression test for updating indexes 2025-06-09 08:51:23 +03:00
pedrocarlo
39434fd20f return_io when restoring context 2025-06-01 03:07:16 -03:00
PThorpe92
2dec7b7255 Add more test cases for update 2025-03-23 20:12:10 -04:00
PThorpe92
4067c98848 Adjust update tests, remove unsupported syntax 2025-03-23 19:20:45 -04:00
PThorpe92
8f469f26b6 Add some additional tcl tests for update support 2025-03-23 17:08:15 -04:00
PThorpe92
dbfe94d677 Add initial tests for update support 2025-03-23 17:08:15 -04:00