Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for rowid keyword #596

Merged
merged 2 commits into from
Jan 14, 2025
Merged

Conversation

KKould
Copy link
Contributor

@KKould KKould commented Jan 2, 2025

#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   

@KKould
Copy link
Contributor Author

KKould commented Jan 2, 2025

the problem in ci is similar to #592 (comment). executing make test-compat locally passes

@penberg penberg requested a review from jussisaurio January 14, 2025 07:34
@penberg
Copy link
Collaborator

penberg commented Jan 14, 2025

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

@penberg penberg changed the title feat: support keyword rowid Add support for rowid keyword Jan 14, 2025
@KKould KKould force-pushed the feat/keyword_rowid branch from b5362cc to 5305a9d Compare January 14, 2025 14:42
@penberg penberg closed this in 256c0d4 Jan 14, 2025
@penberg penberg merged commit 256c0d4 into tursodatabase:main Jan 14, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants