Egor Shalashnikov wrote:
> create table t(n number, v varchar2(10));
> insert into t values (1, 'one')
> explain select * from t where 0 < n;

If you omit the EXPLAIN, is the code executed correctly?

> addr  opcode         p1    p2    p3    p4             p5  comment
> ----  -------------  ----  ----  ----  -------------  --  -------------
> 13    Integer        0     2     0                    00  r[2]=0
> ...
> 2     Rewind         0     9     0                    00
> 3       Column         0     0     1                    00  r[1]=t.n
> 4       Le             2     8     1     (BINARY)       53  if r[2]<=r[1] 
> goto 8
> 5       Copy           1     3     0                    00  r[3]=r[1]
> 6       Column         0     1     4                    00  r[4]=t.v
> 7       ResultRow      3     2     0                    00  output=r[3..4]
> 8     Next           0     3     0                    01
> ...
> The line 4 seems wrong for me, because t.n(r[1]) should be <= than
> 0(r[2]) to be ignored (goto 8).

The synopsis of OP_Le would be "if r[P3]<=r[P1] goto P2".

There is indeed something wrong in your EXPLAIN output.  But my 3.21.0
correctly shows "r[1]<=r[2]".


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to