turso icon indicating copy to clipboard operation
turso copied to clipboard

Don't output real affinity when translating conditions

Open benclmnt opened this issue 1 year ago • 0 comments

Related #159

Main branch

> explain select * from products where price < 30;
addr  opcode             p1    p2    p3    p4             p5  comment
----  -----------------  ----  ----  ----  -------------  --  -------
0     Init               0     17    0                    0   Start at 17
1     OpenReadAsync      0     3     0                    0   root=3
2     OpenReadAwait      0     0     0                    0   
3     RewindAsync        0     0     0                    0   
4     RewindAwait        0     16    0                    0   
5       Column           0     2     1                    0   r[1]=products.price
6       RealAffinity     1     0     0                    0   
7       Integer          30    2     0                    0   r[2]=30
8       Ge               1     2     14                   0   if r[1]>=r[2] goto 14
9       RowId            0     3     0                    0   r[3]=products.rowid
10      Column           0     1     4                    0   r[4]=products.name
11      Column           0     2     5                    0   r[5]=products.price
12      RealAffinity     5     0     0                    0   
13      ResultRow        3     3     0                    0   output=r[3..5]
14    NextAsync          0     0     0                    0   
15    NextAwait          0     4     0                    0   
16    Halt               0     0     0                    0   
17    Transaction        0     0     0                    0   
18    Goto               0     1     0                    0   

See line 6. SQLite don't output RealAffinity in these simple condition clauses

benclmnt avatar Jul 16 '24 05:07 benclmnt