penberg / limbo

Limbo is a work-in-progress, in-process OLTP database management system, compatible with SQLite.
MIT License
960 stars 53 forks source link

Rowid is not supported in WHERE clause #241

Open penberg opened 1 month ago

penberg commented 1 month ago
sqlite> EXPLAIN SELECT rowid FROM users WHERE rowid = 1;
addr  opcode         p1    p2    p3    p4             p5  comment
----  -------------  ----  ----  ----  -------------  --  -------------
0     Init           0     7     0                    0   Start at 7
1     OpenRead       0     2     0     0              0   root=2 iDb=0; users
2     Integer        1     1     0                    0   r[1]=1
3     SeekRowid      0     6     1                    0   intkey=r[1]
4     Rowid          0     2     0                    0   r[2]=users.rowid
5     ResultRow      2     1     0                    0   output=r[2]
6     Halt           0     0     0                    0
7     Transaction    0     0     2     0              1   usesStmtJournal=0
8     Goto           0     1     0                    0
limbo> EXPLAIN SELECT rowid FROM users WHERE rowid = 1;
sonhmai commented 1 month ago

Thanks for the issue, let me take a stab at this.

I see that we haven't had SeekRowid so the plan is possibly to implement this opcode and then to integrate it into the where clause.