turso
turso copied to clipboard
feat: support keyword `rowid`
https://github.com/tursodatabase/limbo/issues/241
support keyword rowid
check if rowid exists when creating table
explain SELECT rowid FROM users WHERE rowid = 1;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 12 0 0 Start at 12
1 OpenReadAsync 0 2 0 0 table=users, root=2
2 OpenReadAwait 0 0 0 0
3 RewindAsync 0 0 0 0
4 RewindAwait 0 11 0 0 Rewind table users
5 RowId 0 2 0 0 r[2]=users.rowid
6 Ne 2 3 9 0 if r[2]!=r[3] goto 9
7 RowId 0 1 0 0 r[1]=users.rowid
8 ResultRow 1 1 0 0 output=r[1]
9 NextAsync 0 0 0 0
10 NextAwait 0 5 0 0
11 Halt 0 0 0 0
12 Transaction 0 0 0 0
13 Integer 1 3 0 0 r[3]=1
14 Goto 0 1 0 0
the problem in ci is similar to https://github.com/tursodatabase/limbo/pull/592#issuecomment-2567306343. executing make test-compat locally passes
Hey @KKould!
One of the join tests is not passing with SQLite:
limbo % sqlite3 --version
3.45.2 2024-03-12 11:06:23 d8cd6d49b46a395b13955387d05e9e1a2a47e54fb99f3c9b59835bbefad6af77 (64-bit)
limbo % SQLITE_EXEC=sqlite3 ./testing/join.test
Error: in prepare, near ".": syntax error
rowid from users u left join products as p using(p.rowid) where u.rowid >= 10
error here ---^
while executing
"exec {*}$command"
(procedure "evaluate_sql" line 3)
invoked from within
"evaluate_sql $sqlite_exec $db_name $sql"
(procedure "run_test" line 2)
invoked from within
"run_test $::sqlite_exec $db $combined_sql $combined_expected_output"
(procedure "do_execsql_test" line 6)
invoked from within
"do_execsql_test left-join-row-id-2 {
select u.rowid, p.rowid from users u left join products as p using(p.rowid) where u.rowid >= 10 limit 5;
} {1..."
(file "./testing/join.test" line 117)
Also, could you just rebase this against main, which hopefully fixes the CI failures