Home | History | Annotate | Download | only in test
      1 # 2008 December 11
      2 #
      3 # The author disclaims copyright to this source code.  In place of
      4 # a legal notice, here is a blessing:
      5 #
      6 #    May you do good and not evil.
      7 #    May you find forgiveness for yourself and forgive others.
      8 #    May you share freely, never taking more than you give.
      9 #
     10 #***********************************************************************
     11 # This file implements regression tests for SQLite library.
     12 #
     13 # This file is automatically generated from a separate TCL script.
     14 # This file seeks to exercise integer boundary values.
     15 #
     16 # $Id: boundary3.test,v 1.2 2009/01/02 15:45:48 shane Exp $
     17 
     18 set testdir [file dirname $argv0]
     19 source $testdir/tester.tcl
     20 
     21 # Many of the boundary tests depend on a working 64-bit implementation.
     22 if {![working_64bit_int]} { finish_test; return }
     23 
     24 do_test boundary3-1.1 {
     25   db eval {
     26     CREATE TABLE t1(a,x);
     27     INSERT INTO t1(oid,a,x) VALUES(-8388609,1,'ffffffffff7fffff');
     28     INSERT INTO t1(oid,a,x) VALUES(-36028797018963969,2,'ff7fffffffffffff');
     29     INSERT INTO t1(oid,a,x) VALUES(9223372036854775807,3,'7fffffffffffffff');
     30     INSERT INTO t1(oid,a,x) VALUES(127,4,'000000000000007f');
     31     INSERT INTO t1(oid,a,x) VALUES(3,5,'0000000000000003');
     32     INSERT INTO t1(oid,a,x) VALUES(16777216,6,'0000000001000000');
     33     INSERT INTO t1(oid,a,x) VALUES(4398046511103,7,'000003ffffffffff');
     34     INSERT INTO t1(oid,a,x) VALUES(16383,8,'0000000000003fff');
     35     INSERT INTO t1(oid,a,x) VALUES(16777215,9,'0000000000ffffff');
     36     INSERT INTO t1(oid,a,x) VALUES(281474976710655,10,'0000ffffffffffff');
     37     INSERT INTO t1(oid,a,x) VALUES(-2147483648,11,'ffffffff80000000');
     38     INSERT INTO t1(oid,a,x) VALUES(268435455,12,'000000000fffffff');
     39     INSERT INTO t1(oid,a,x) VALUES(562949953421311,13,'0001ffffffffffff');
     40     INSERT INTO t1(oid,a,x) VALUES(4294967295,14,'00000000ffffffff');
     41     INSERT INTO t1(oid,a,x) VALUES(2097151,15,'00000000001fffff');
     42     INSERT INTO t1(oid,a,x) VALUES(16384,16,'0000000000004000');
     43     INSERT INTO t1(oid,a,x) VALUES(72057594037927935,17,'00ffffffffffffff');
     44     INSERT INTO t1(oid,a,x) VALUES(8388607,18,'00000000007fffff');
     45     INSERT INTO t1(oid,a,x) VALUES(1099511627776,19,'0000010000000000');
     46     INSERT INTO t1(oid,a,x) VALUES(2147483647,20,'000000007fffffff');
     47     INSERT INTO t1(oid,a,x) VALUES(-140737488355329,21,'ffff7fffffffffff');
     48     INSERT INTO t1(oid,a,x) VALUES(34359738368,22,'0000000800000000');
     49     INSERT INTO t1(oid,a,x) VALUES(32767,23,'0000000000007fff');
     50     INSERT INTO t1(oid,a,x) VALUES(8388608,24,'0000000000800000');
     51     INSERT INTO t1(oid,a,x) VALUES(140737488355327,25,'00007fffffffffff');
     52     INSERT INTO t1(oid,a,x) VALUES(281474976710656,26,'0001000000000000');
     53     INSERT INTO t1(oid,a,x) VALUES(36028797018963967,27,'007fffffffffffff');
     54     INSERT INTO t1(oid,a,x) VALUES(72057594037927936,28,'0100000000000000');
     55     INSERT INTO t1(oid,a,x) VALUES(-32769,29,'ffffffffffff7fff');
     56     INSERT INTO t1(oid,a,x) VALUES(255,30,'00000000000000ff');
     57     INSERT INTO t1(oid,a,x) VALUES(4,31,'0000000000000004');
     58     INSERT INTO t1(oid,a,x) VALUES(-32768,32,'ffffffffffff8000');
     59     INSERT INTO t1(oid,a,x) VALUES(-2,33,'fffffffffffffffe');
     60     INSERT INTO t1(oid,a,x) VALUES(140737488355328,34,'0000800000000000');
     61     INSERT INTO t1(oid,a,x) VALUES(549755813888,35,'0000008000000000');
     62     INSERT INTO t1(oid,a,x) VALUES(4294967296,36,'0000000100000000');
     63     INSERT INTO t1(oid,a,x) VALUES(-8388608,37,'ffffffffff800000');
     64     INSERT INTO t1(oid,a,x) VALUES(-1,38,'ffffffffffffffff');
     65     INSERT INTO t1(oid,a,x) VALUES(34359738367,39,'00000007ffffffff');
     66     INSERT INTO t1(oid,a,x) VALUES(268435456,40,'0000000010000000');
     67     INSERT INTO t1(oid,a,x) VALUES(2,41,'0000000000000002');
     68     INSERT INTO t1(oid,a,x) VALUES(2097152,42,'0000000000200000');
     69     INSERT INTO t1(oid,a,x) VALUES(562949953421312,43,'0002000000000000');
     70     INSERT INTO t1(oid,a,x) VALUES(-140737488355328,44,'ffff800000000000');
     71     INSERT INTO t1(oid,a,x) VALUES(36028797018963968,45,'0080000000000000');
     72     INSERT INTO t1(oid,a,x) VALUES(549755813887,46,'0000007fffffffff');
     73     INSERT INTO t1(oid,a,x) VALUES(-2147483649,47,'ffffffff7fffffff');
     74     INSERT INTO t1(oid,a,x) VALUES(65535,48,'000000000000ffff');
     75     INSERT INTO t1(oid,a,x) VALUES(128,49,'0000000000000080');
     76     INSERT INTO t1(oid,a,x) VALUES(32768,50,'0000000000008000');
     77     INSERT INTO t1(oid,a,x) VALUES(2147483648,51,'0000000080000000');
     78     INSERT INTO t1(oid,a,x) VALUES(-3,52,'fffffffffffffffd');
     79     INSERT INTO t1(oid,a,x) VALUES(-128,53,'ffffffffffffff80');
     80     INSERT INTO t1(oid,a,x) VALUES(-129,54,'ffffffffffffff7f');
     81     INSERT INTO t1(oid,a,x) VALUES(-9223372036854775808,55,'8000000000000000');
     82     INSERT INTO t1(oid,a,x) VALUES(4398046511104,56,'0000040000000000');
     83     INSERT INTO t1(oid,a,x) VALUES(1099511627775,57,'000000ffffffffff');
     84     INSERT INTO t1(oid,a,x) VALUES(-549755813889,58,'ffffff7fffffffff');
     85     INSERT INTO t1(oid,a,x) VALUES(0,59,'0000000000000000');
     86     INSERT INTO t1(oid,a,x) VALUES(1,60,'0000000000000001');
     87     INSERT INTO t1(oid,a,x) VALUES(256,61,'0000000000000100');
     88     INSERT INTO t1(oid,a,x) VALUES(65536,62,'0000000000010000');
     89     INSERT INTO t1(oid,a,x) VALUES(-549755813888,63,'ffffff8000000000');
     90     INSERT INTO t1(oid,a,x) VALUES(-36028797018963968,64,'ff80000000000000');
     91     CREATE INDEX t1i1 ON t1(a);
     92     CREATE INDEX t1i2 ON t1(x);
     93   }
     94 } {}
     95 do_test boundary3-1.2 {
     96   db eval {
     97     SELECT count(*) FROM t1
     98   }
     99 } {64}
    100 do_test boundary3-1.3 {
    101   db eval {
    102     CREATE TABLE t2(r,a);
    103     INSERT INTO t2 SELECT rowid, a FROM t1;
    104     CREATE INDEX t2i1 ON t2(r);
    105     CREATE INDEX t2i2 ON t2(a);
    106     INSERT INTO t2 VALUES(9.22337303685477580800e+18,65);
    107     INSERT INTO t2 VALUES(-9.22337303685477580800e+18,66);
    108     SELECT count(*) FROM t2;
    109   }
    110 } {66}
    111 do_test boundary3-2.1.1 {
    112   db eval {
    113     SELECT t1.* FROM t1, t2 WHERE t1.rowid=72057594037927935 AND t2.a=t1.a
    114   }
    115 } {17 00ffffffffffffff}
    116 do_test boundary3-2.1.2 {
    117   db eval {
    118     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00ffffffffffffff'
    119   }
    120 } {72057594037927935 17}
    121 do_test boundary3-2.1.3 {
    122   db eval {
    123     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=17
    124   }
    125 } {72057594037927935 00ffffffffffffff}
    126 do_test boundary3-2.1.gt.1 {
    127   db eval {
    128     SELECT t2.a FROM t1 JOIN t2 USING(a)
    129      WHERE t1.rowid > 72057594037927935 ORDER BY t2.a
    130   }
    131 } {3 28}
    132 do_test boundary3-2.1.gt.2 {
    133   db eval {
    134     SELECT t2.a FROM t2 NATURAL JOIN t1
    135      WHERE t1.rowid > 72057594037927935 ORDER BY t1.a DESC
    136   }
    137 } {28 3}
    138 do_test boundary3-2.1.gt.3 {
    139   db eval {
    140     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    141      WHERE t2.a=17
    142      ORDER BY t1.rowid
    143   }
    144 } {28 3}
    145 do_test boundary3-2.1.gt.4 {
    146   db eval {
    147     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    148      WHERE t2.a=17
    149      ORDER BY t1.rowid DESC
    150   }
    151 } {3 28}
    152 do_test boundary3-2.1.gt.5 {
    153   db eval {
    154     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    155      WHERE t2.a=17
    156      ORDER BY x
    157   }
    158 } {28 3}
    159 do_test boundary3-2.1.ge.1 {
    160   db eval {
    161     SELECT t2.a FROM t1 JOIN t2 USING(a)
    162      WHERE t1.rowid >= 72057594037927935 ORDER BY t2.a
    163   }
    164 } {3 17 28}
    165 do_test boundary3-2.1.ge.2 {
    166   db eval {
    167     SELECT t2.a FROM t2 NATURAL JOIN t1
    168      WHERE t1.rowid >= 72057594037927935 ORDER BY t1.a DESC
    169   }
    170 } {28 17 3}
    171 do_test boundary3-2.1.ge.3 {
    172   db eval {
    173     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    174      WHERE t2.a=17
    175      ORDER BY t1.rowid
    176   }
    177 } {17 28 3}
    178 do_test boundary3-2.1.ge.4 {
    179   db eval {
    180     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    181      WHERE t2.a=17
    182      ORDER BY t1.rowid DESC
    183   }
    184 } {3 28 17}
    185 do_test boundary3-2.1.ge.5 {
    186   db eval {
    187     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    188      WHERE t2.a=17
    189      ORDER BY x
    190   }
    191 } {17 28 3}
    192 do_test boundary3-2.1.lt.1 {
    193   db eval {
    194     SELECT t2.a FROM t1 JOIN t2 USING(a)
    195      WHERE t1.rowid < 72057594037927935 ORDER BY t2.a
    196   }
    197 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
    198 do_test boundary3-2.1.lt.2 {
    199   db eval {
    200     SELECT t2.a FROM t2 NATURAL JOIN t1
    201      WHERE t1.rowid < 72057594037927935 ORDER BY t1.a DESC
    202   }
    203 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 27 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
    204 do_test boundary3-2.1.lt.3 {
    205   db eval {
    206     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    207      WHERE t2.a=17
    208      ORDER BY t1.rowid
    209   }
    210 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45}
    211 do_test boundary3-2.1.lt.4 {
    212   db eval {
    213     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    214      WHERE t2.a=17
    215      ORDER BY t1.rowid DESC
    216   }
    217 } {45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    218 do_test boundary3-2.1.lt.5 {
    219   db eval {
    220     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    221      WHERE t2.a=17
    222      ORDER BY x
    223   }
    224 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    225 do_test boundary3-2.1.le.1 {
    226   db eval {
    227     SELECT t2.a FROM t1 JOIN t2 USING(a)
    228      WHERE t1.rowid <= 72057594037927935 ORDER BY t2.a
    229   }
    230 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
    231 do_test boundary3-2.1.le.2 {
    232   db eval {
    233     SELECT t2.a FROM t2 NATURAL JOIN t1
    234      WHERE t1.rowid <= 72057594037927935 ORDER BY t1.a DESC
    235   }
    236 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
    237 do_test boundary3-2.1.le.3 {
    238   db eval {
    239     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    240      WHERE t2.a=17
    241      ORDER BY t1.rowid
    242   }
    243 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17}
    244 do_test boundary3-2.1.le.4 {
    245   db eval {
    246     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    247      WHERE t2.a=17
    248      ORDER BY t1.rowid DESC
    249   }
    250 } {17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    251 do_test boundary3-2.1.le.5 {
    252   db eval {
    253     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    254      WHERE t2.a=17
    255      ORDER BY x
    256   }
    257 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    258 do_test boundary3-2.2.1 {
    259   db eval {
    260     SELECT t1.* FROM t1, t2 WHERE t1.rowid=16384 AND t2.a=t1.a
    261   }
    262 } {16 0000000000004000}
    263 do_test boundary3-2.2.2 {
    264   db eval {
    265     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000004000'
    266   }
    267 } {16384 16}
    268 do_test boundary3-2.2.3 {
    269   db eval {
    270     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=16
    271   }
    272 } {16384 0000000000004000}
    273 do_test boundary3-2.2.gt.1 {
    274   db eval {
    275     SELECT t2.a FROM t1 JOIN t2 USING(a)
    276      WHERE t1.rowid > 16384 ORDER BY t2.a
    277   }
    278 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
    279 do_test boundary3-2.2.gt.2 {
    280   db eval {
    281     SELECT t2.a FROM t2 NATURAL JOIN t1
    282      WHERE t1.rowid > 16384 ORDER BY t1.a DESC
    283   }
    284 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
    285 do_test boundary3-2.2.gt.3 {
    286   db eval {
    287     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    288      WHERE t2.a=16
    289      ORDER BY t1.rowid
    290   }
    291 } {23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    292 do_test boundary3-2.2.gt.4 {
    293   db eval {
    294     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    295      WHERE t2.a=16
    296      ORDER BY t1.rowid DESC
    297   }
    298 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23}
    299 do_test boundary3-2.2.gt.5 {
    300   db eval {
    301     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    302      WHERE t2.a=16
    303      ORDER BY x
    304   }
    305 } {23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    306 do_test boundary3-2.2.gt.10 {
    307   db eval {
    308     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    309      WHERE t2.a=16
    310      ORDER BY t1.rowid
    311   }
    312 } {23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    313 do_test boundary3-2.2.gt.11 {
    314   db eval {
    315     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    316      WHERE t2.a=16
    317      ORDER BY t1.rowid DESC
    318   }
    319 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23}
    320 do_test boundary3-2.2.ge.1 {
    321   db eval {
    322     SELECT t2.a FROM t1 JOIN t2 USING(a)
    323      WHERE t1.rowid >= 16384 ORDER BY t2.a
    324   }
    325 } {3 6 7 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
    326 do_test boundary3-2.2.ge.2 {
    327   db eval {
    328     SELECT t2.a FROM t2 NATURAL JOIN t1
    329      WHERE t1.rowid >= 16384 ORDER BY t1.a DESC
    330   }
    331 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 7 6 3}
    332 do_test boundary3-2.2.ge.3 {
    333   db eval {
    334     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    335      WHERE t2.a=16
    336      ORDER BY t1.rowid
    337   }
    338 } {16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    339 do_test boundary3-2.2.ge.4 {
    340   db eval {
    341     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    342      WHERE t2.a=16
    343      ORDER BY t1.rowid DESC
    344   }
    345 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16}
    346 do_test boundary3-2.2.ge.5 {
    347   db eval {
    348     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    349      WHERE t2.a=16
    350      ORDER BY x
    351   }
    352 } {16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    353 do_test boundary3-2.2.ge.10 {
    354   db eval {
    355     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    356      WHERE t2.a=16
    357      ORDER BY t1.rowid
    358   }
    359 } {16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    360 do_test boundary3-2.2.ge.11 {
    361   db eval {
    362     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    363      WHERE t2.a=16
    364      ORDER BY t1.rowid DESC
    365   }
    366 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16}
    367 do_test boundary3-2.2.lt.1 {
    368   db eval {
    369     SELECT t2.a FROM t1 JOIN t2 USING(a)
    370      WHERE t1.rowid < 16384 ORDER BY t2.a
    371   }
    372 } {1 2 4 5 8 11 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
    373 do_test boundary3-2.2.lt.2 {
    374   db eval {
    375     SELECT t2.a FROM t2 NATURAL JOIN t1
    376      WHERE t1.rowid < 16384 ORDER BY t1.a DESC
    377   }
    378 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 11 8 5 4 2 1}
    379 do_test boundary3-2.2.lt.3 {
    380   db eval {
    381     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    382      WHERE t2.a=16
    383      ORDER BY t1.rowid
    384   }
    385 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8}
    386 do_test boundary3-2.2.lt.4 {
    387   db eval {
    388     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    389      WHERE t2.a=16
    390      ORDER BY t1.rowid DESC
    391   }
    392 } {8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    393 do_test boundary3-2.2.lt.5 {
    394   db eval {
    395     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    396      WHERE t2.a=16
    397      ORDER BY x
    398   }
    399 } {59 60 41 5 31 4 49 30 61 8 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    400 do_test boundary3-2.2.lt.10 {
    401   db eval {
    402     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
    403      WHERE t2.a=16
    404      ORDER BY t1.rowid
    405   }
    406 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8}
    407 do_test boundary3-2.2.lt.11 {
    408   db eval {
    409     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
    410      WHERE t2.a=16
    411      ORDER BY t1.rowid DESC
    412   }
    413 } {8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    414 do_test boundary3-2.2.le.1 {
    415   db eval {
    416     SELECT t2.a FROM t1 JOIN t2 USING(a)
    417      WHERE t1.rowid <= 16384 ORDER BY t2.a
    418   }
    419 } {1 2 4 5 8 11 16 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
    420 do_test boundary3-2.2.le.2 {
    421   db eval {
    422     SELECT t2.a FROM t2 NATURAL JOIN t1
    423      WHERE t1.rowid <= 16384 ORDER BY t1.a DESC
    424   }
    425 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 16 11 8 5 4 2 1}
    426 do_test boundary3-2.2.le.3 {
    427   db eval {
    428     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    429      WHERE t2.a=16
    430      ORDER BY t1.rowid
    431   }
    432 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16}
    433 do_test boundary3-2.2.le.4 {
    434   db eval {
    435     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    436      WHERE t2.a=16
    437      ORDER BY t1.rowid DESC
    438   }
    439 } {16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    440 do_test boundary3-2.2.le.5 {
    441   db eval {
    442     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    443      WHERE t2.a=16
    444      ORDER BY x
    445   }
    446 } {59 60 41 5 31 4 49 30 61 8 16 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    447 do_test boundary3-2.2.le.10 {
    448   db eval {
    449     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
    450      WHERE t2.a=16
    451      ORDER BY t1.rowid
    452   }
    453 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16}
    454 do_test boundary3-2.2.le.11 {
    455   db eval {
    456     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
    457      WHERE t2.a=16
    458      ORDER BY t1.rowid DESC
    459   }
    460 } {16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    461 do_test boundary3-2.3.1 {
    462   db eval {
    463     SELECT t1.* FROM t1, t2 WHERE t1.rowid=4294967296 AND t2.a=t1.a
    464   }
    465 } {36 0000000100000000}
    466 do_test boundary3-2.3.2 {
    467   db eval {
    468     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000100000000'
    469   }
    470 } {4294967296 36}
    471 do_test boundary3-2.3.3 {
    472   db eval {
    473     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=36
    474   }
    475 } {4294967296 0000000100000000}
    476 do_test boundary3-2.3.gt.1 {
    477   db eval {
    478     SELECT t2.a FROM t1 JOIN t2 USING(a)
    479      WHERE t1.rowid > 4294967296 ORDER BY t2.a
    480   }
    481 } {3 7 10 13 17 19 22 25 26 27 28 34 35 39 43 45 46 56 57}
    482 do_test boundary3-2.3.gt.2 {
    483   db eval {
    484     SELECT t2.a FROM t2 NATURAL JOIN t1
    485      WHERE t1.rowid > 4294967296 ORDER BY t1.a DESC
    486   }
    487 } {57 56 46 45 43 39 35 34 28 27 26 25 22 19 17 13 10 7 3}
    488 do_test boundary3-2.3.gt.3 {
    489   db eval {
    490     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    491      WHERE t2.a=36
    492      ORDER BY t1.rowid
    493   }
    494 } {39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    495 do_test boundary3-2.3.gt.4 {
    496   db eval {
    497     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    498      WHERE t2.a=36
    499      ORDER BY t1.rowid DESC
    500   }
    501 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39}
    502 do_test boundary3-2.3.gt.5 {
    503   db eval {
    504     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    505      WHERE t2.a=36
    506      ORDER BY x
    507   }
    508 } {39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    509 do_test boundary3-2.3.gt.10 {
    510   db eval {
    511     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    512      WHERE t2.a=36
    513      ORDER BY t1.rowid
    514   }
    515 } {39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    516 do_test boundary3-2.3.gt.11 {
    517   db eval {
    518     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    519      WHERE t2.a=36
    520      ORDER BY t1.rowid DESC
    521   }
    522 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39}
    523 do_test boundary3-2.3.ge.1 {
    524   db eval {
    525     SELECT t2.a FROM t1 JOIN t2 USING(a)
    526      WHERE t1.rowid >= 4294967296 ORDER BY t2.a
    527   }
    528 } {3 7 10 13 17 19 22 25 26 27 28 34 35 36 39 43 45 46 56 57}
    529 do_test boundary3-2.3.ge.2 {
    530   db eval {
    531     SELECT t2.a FROM t2 NATURAL JOIN t1
    532      WHERE t1.rowid >= 4294967296 ORDER BY t1.a DESC
    533   }
    534 } {57 56 46 45 43 39 36 35 34 28 27 26 25 22 19 17 13 10 7 3}
    535 do_test boundary3-2.3.ge.3 {
    536   db eval {
    537     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    538      WHERE t2.a=36
    539      ORDER BY t1.rowid
    540   }
    541 } {36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    542 do_test boundary3-2.3.ge.4 {
    543   db eval {
    544     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    545      WHERE t2.a=36
    546      ORDER BY t1.rowid DESC
    547   }
    548 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36}
    549 do_test boundary3-2.3.ge.5 {
    550   db eval {
    551     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    552      WHERE t2.a=36
    553      ORDER BY x
    554   }
    555 } {36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    556 do_test boundary3-2.3.ge.10 {
    557   db eval {
    558     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    559      WHERE t2.a=36
    560      ORDER BY t1.rowid
    561   }
    562 } {36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    563 do_test boundary3-2.3.ge.11 {
    564   db eval {
    565     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    566      WHERE t2.a=36
    567      ORDER BY t1.rowid DESC
    568   }
    569 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36}
    570 do_test boundary3-2.3.lt.1 {
    571   db eval {
    572     SELECT t2.a FROM t1 JOIN t2 USING(a)
    573      WHERE t1.rowid < 4294967296 ORDER BY t2.a
    574   }
    575 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
    576 do_test boundary3-2.3.lt.2 {
    577   db eval {
    578     SELECT t2.a FROM t2 NATURAL JOIN t1
    579      WHERE t1.rowid < 4294967296 ORDER BY t1.a DESC
    580   }
    581 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
    582 do_test boundary3-2.3.lt.3 {
    583   db eval {
    584     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    585      WHERE t2.a=36
    586      ORDER BY t1.rowid
    587   }
    588 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14}
    589 do_test boundary3-2.3.lt.4 {
    590   db eval {
    591     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    592      WHERE t2.a=36
    593      ORDER BY t1.rowid DESC
    594   }
    595 } {14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    596 do_test boundary3-2.3.lt.5 {
    597   db eval {
    598     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    599      WHERE t2.a=36
    600      ORDER BY x
    601   }
    602 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    603 do_test boundary3-2.3.lt.10 {
    604   db eval {
    605     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
    606      WHERE t2.a=36
    607      ORDER BY t1.rowid
    608   }
    609 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14}
    610 do_test boundary3-2.3.lt.11 {
    611   db eval {
    612     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
    613      WHERE t2.a=36
    614      ORDER BY t1.rowid DESC
    615   }
    616 } {14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    617 do_test boundary3-2.3.le.1 {
    618   db eval {
    619     SELECT t2.a FROM t1 JOIN t2 USING(a)
    620      WHERE t1.rowid <= 4294967296 ORDER BY t2.a
    621   }
    622 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 23 24 29 30 31 32 33 36 37 38 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
    623 do_test boundary3-2.3.le.2 {
    624   db eval {
    625     SELECT t2.a FROM t2 NATURAL JOIN t1
    626      WHERE t1.rowid <= 4294967296 ORDER BY t1.a DESC
    627   }
    628 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 38 37 36 33 32 31 30 29 24 23 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
    629 do_test boundary3-2.3.le.3 {
    630   db eval {
    631     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    632      WHERE t2.a=36
    633      ORDER BY t1.rowid
    634   }
    635 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36}
    636 do_test boundary3-2.3.le.4 {
    637   db eval {
    638     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    639      WHERE t2.a=36
    640      ORDER BY t1.rowid DESC
    641   }
    642 } {36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    643 do_test boundary3-2.3.le.5 {
    644   db eval {
    645     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    646      WHERE t2.a=36
    647      ORDER BY x
    648   }
    649 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    650 do_test boundary3-2.3.le.10 {
    651   db eval {
    652     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
    653      WHERE t2.a=36
    654      ORDER BY t1.rowid
    655   }
    656 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36}
    657 do_test boundary3-2.3.le.11 {
    658   db eval {
    659     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
    660      WHERE t2.a=36
    661      ORDER BY t1.rowid DESC
    662   }
    663 } {36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    664 do_test boundary3-2.4.1 {
    665   db eval {
    666     SELECT t1.* FROM t1, t2 WHERE t1.rowid=16777216 AND t2.a=t1.a
    667   }
    668 } {6 0000000001000000}
    669 do_test boundary3-2.4.2 {
    670   db eval {
    671     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000001000000'
    672   }
    673 } {16777216 6}
    674 do_test boundary3-2.4.3 {
    675   db eval {
    676     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=6
    677   }
    678 } {16777216 0000000001000000}
    679 do_test boundary3-2.4.gt.1 {
    680   db eval {
    681     SELECT t2.a FROM t1 JOIN t2 USING(a)
    682      WHERE t1.rowid > 16777216 ORDER BY t2.a
    683   }
    684 } {3 7 10 12 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
    685 do_test boundary3-2.4.gt.2 {
    686   db eval {
    687     SELECT t2.a FROM t2 NATURAL JOIN t1
    688      WHERE t1.rowid > 16777216 ORDER BY t1.a DESC
    689   }
    690 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 12 10 7 3}
    691 do_test boundary3-2.4.gt.3 {
    692   db eval {
    693     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    694      WHERE t2.a=6
    695      ORDER BY t1.rowid
    696   }
    697 } {12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    698 do_test boundary3-2.4.gt.4 {
    699   db eval {
    700     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    701      WHERE t2.a=6
    702      ORDER BY t1.rowid DESC
    703   }
    704 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12}
    705 do_test boundary3-2.4.gt.5 {
    706   db eval {
    707     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    708      WHERE t2.a=6
    709      ORDER BY x
    710   }
    711 } {12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    712 do_test boundary3-2.4.gt.10 {
    713   db eval {
    714     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    715      WHERE t2.a=6
    716      ORDER BY t1.rowid
    717   }
    718 } {12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    719 do_test boundary3-2.4.gt.11 {
    720   db eval {
    721     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    722      WHERE t2.a=6
    723      ORDER BY t1.rowid DESC
    724   }
    725 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12}
    726 do_test boundary3-2.4.ge.1 {
    727   db eval {
    728     SELECT t2.a FROM t1 JOIN t2 USING(a)
    729      WHERE t1.rowid >= 16777216 ORDER BY t2.a
    730   }
    731 } {3 6 7 10 12 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
    732 do_test boundary3-2.4.ge.2 {
    733   db eval {
    734     SELECT t2.a FROM t2 NATURAL JOIN t1
    735      WHERE t1.rowid >= 16777216 ORDER BY t1.a DESC
    736   }
    737 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 12 10 7 6 3}
    738 do_test boundary3-2.4.ge.3 {
    739   db eval {
    740     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    741      WHERE t2.a=6
    742      ORDER BY t1.rowid
    743   }
    744 } {6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    745 do_test boundary3-2.4.ge.4 {
    746   db eval {
    747     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    748      WHERE t2.a=6
    749      ORDER BY t1.rowid DESC
    750   }
    751 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6}
    752 do_test boundary3-2.4.ge.5 {
    753   db eval {
    754     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    755      WHERE t2.a=6
    756      ORDER BY x
    757   }
    758 } {6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    759 do_test boundary3-2.4.ge.10 {
    760   db eval {
    761     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    762      WHERE t2.a=6
    763      ORDER BY t1.rowid
    764   }
    765 } {6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    766 do_test boundary3-2.4.ge.11 {
    767   db eval {
    768     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    769      WHERE t2.a=6
    770      ORDER BY t1.rowid DESC
    771   }
    772 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6}
    773 do_test boundary3-2.4.lt.1 {
    774   db eval {
    775     SELECT t2.a FROM t1 JOIN t2 USING(a)
    776      WHERE t1.rowid < 16777216 ORDER BY t2.a
    777   }
    778 } {1 2 4 5 8 9 11 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
    779 do_test boundary3-2.4.lt.2 {
    780   db eval {
    781     SELECT t2.a FROM t2 NATURAL JOIN t1
    782      WHERE t1.rowid < 16777216 ORDER BY t1.a DESC
    783   }
    784 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 11 9 8 5 4 2 1}
    785 do_test boundary3-2.4.lt.3 {
    786   db eval {
    787     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    788      WHERE t2.a=6
    789      ORDER BY t1.rowid
    790   }
    791 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9}
    792 do_test boundary3-2.4.lt.4 {
    793   db eval {
    794     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    795      WHERE t2.a=6
    796      ORDER BY t1.rowid DESC
    797   }
    798 } {9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    799 do_test boundary3-2.4.lt.5 {
    800   db eval {
    801     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    802      WHERE t2.a=6
    803      ORDER BY x
    804   }
    805 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    806 do_test boundary3-2.4.lt.10 {
    807   db eval {
    808     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
    809      WHERE t2.a=6
    810      ORDER BY t1.rowid
    811   }
    812 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9}
    813 do_test boundary3-2.4.lt.11 {
    814   db eval {
    815     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
    816      WHERE t2.a=6
    817      ORDER BY t1.rowid DESC
    818   }
    819 } {9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    820 do_test boundary3-2.4.le.1 {
    821   db eval {
    822     SELECT t2.a FROM t1 JOIN t2 USING(a)
    823      WHERE t1.rowid <= 16777216 ORDER BY t2.a
    824   }
    825 } {1 2 4 5 6 8 9 11 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
    826 do_test boundary3-2.4.le.2 {
    827   db eval {
    828     SELECT t2.a FROM t2 NATURAL JOIN t1
    829      WHERE t1.rowid <= 16777216 ORDER BY t1.a DESC
    830   }
    831 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 11 9 8 6 5 4 2 1}
    832 do_test boundary3-2.4.le.3 {
    833   db eval {
    834     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    835      WHERE t2.a=6
    836      ORDER BY t1.rowid
    837   }
    838 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6}
    839 do_test boundary3-2.4.le.4 {
    840   db eval {
    841     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    842      WHERE t2.a=6
    843      ORDER BY t1.rowid DESC
    844   }
    845 } {6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    846 do_test boundary3-2.4.le.5 {
    847   db eval {
    848     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
    849      WHERE t2.a=6
    850      ORDER BY x
    851   }
    852 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
    853 do_test boundary3-2.4.le.10 {
    854   db eval {
    855     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
    856      WHERE t2.a=6
    857      ORDER BY t1.rowid
    858   }
    859 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6}
    860 do_test boundary3-2.4.le.11 {
    861   db eval {
    862     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
    863      WHERE t2.a=6
    864      ORDER BY t1.rowid DESC
    865   }
    866 } {6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
    867 do_test boundary3-2.5.1 {
    868   db eval {
    869     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-32769 AND t2.a=t1.a
    870   }
    871 } {29 ffffffffffff7fff}
    872 do_test boundary3-2.5.2 {
    873   db eval {
    874     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffffff7fff'
    875   }
    876 } {-32769 29}
    877 do_test boundary3-2.5.3 {
    878   db eval {
    879     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=29
    880   }
    881 } {-32769 ffffffffffff7fff}
    882 do_test boundary3-2.5.gt.1 {
    883   db eval {
    884     SELECT t2.a FROM t1 JOIN t2 USING(a)
    885      WHERE t1.rowid > -32769 ORDER BY t2.a
    886   }
    887 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 32 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
    888 do_test boundary3-2.5.gt.2 {
    889   db eval {
    890     SELECT t2.a FROM t2 NATURAL JOIN t1
    891      WHERE t1.rowid > -32769 ORDER BY t1.a DESC
    892   }
    893 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 32 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
    894 do_test boundary3-2.5.gt.3 {
    895   db eval {
    896     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    897      WHERE t2.a=29
    898      ORDER BY t1.rowid
    899   }
    900 } {32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    901 do_test boundary3-2.5.gt.4 {
    902   db eval {
    903     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    904      WHERE t2.a=29
    905      ORDER BY t1.rowid DESC
    906   }
    907 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32}
    908 do_test boundary3-2.5.gt.5 {
    909   db eval {
    910     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
    911      WHERE t2.a=29
    912      ORDER BY x
    913   }
    914 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 32 54 53 52 33 38}
    915 do_test boundary3-2.5.gt.10 {
    916   db eval {
    917     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    918      WHERE t2.a=29
    919      ORDER BY t1.rowid
    920   }
    921 } {32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    922 do_test boundary3-2.5.gt.11 {
    923   db eval {
    924     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
    925      WHERE t2.a=29
    926      ORDER BY t1.rowid DESC
    927   }
    928 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32}
    929 do_test boundary3-2.5.ge.1 {
    930   db eval {
    931     SELECT t2.a FROM t1 JOIN t2 USING(a)
    932      WHERE t1.rowid >= -32769 ORDER BY t2.a
    933   }
    934 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
    935 do_test boundary3-2.5.ge.2 {
    936   db eval {
    937     SELECT t2.a FROM t2 NATURAL JOIN t1
    938      WHERE t1.rowid >= -32769 ORDER BY t1.a DESC
    939   }
    940 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
    941 do_test boundary3-2.5.ge.3 {
    942   db eval {
    943     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    944      WHERE t2.a=29
    945      ORDER BY t1.rowid
    946   }
    947 } {29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    948 do_test boundary3-2.5.ge.4 {
    949   db eval {
    950     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    951      WHERE t2.a=29
    952      ORDER BY t1.rowid DESC
    953   }
    954 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29}
    955 do_test boundary3-2.5.ge.5 {
    956   db eval {
    957     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
    958      WHERE t2.a=29
    959      ORDER BY x
    960   }
    961 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 29 32 54 53 52 33 38}
    962 do_test boundary3-2.5.ge.10 {
    963   db eval {
    964     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    965      WHERE t2.a=29
    966      ORDER BY t1.rowid
    967   }
    968 } {29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
    969 do_test boundary3-2.5.ge.11 {
    970   db eval {
    971     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
    972      WHERE t2.a=29
    973      ORDER BY t1.rowid DESC
    974   }
    975 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29}
    976 do_test boundary3-2.5.lt.1 {
    977   db eval {
    978     SELECT t2.a FROM t1 JOIN t2 USING(a)
    979      WHERE t1.rowid < -32769 ORDER BY t2.a
    980   }
    981 } {1 2 11 21 37 44 47 55 58 63 64}
    982 do_test boundary3-2.5.lt.2 {
    983   db eval {
    984     SELECT t2.a FROM t2 NATURAL JOIN t1
    985      WHERE t1.rowid < -32769 ORDER BY t1.a DESC
    986   }
    987 } {64 63 58 55 47 44 37 21 11 2 1}
    988 do_test boundary3-2.5.lt.3 {
    989   db eval {
    990     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    991      WHERE t2.a=29
    992      ORDER BY t1.rowid
    993   }
    994 } {55 2 64 21 44 58 63 47 11 1 37}
    995 do_test boundary3-2.5.lt.4 {
    996   db eval {
    997     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
    998      WHERE t2.a=29
    999      ORDER BY t1.rowid DESC
   1000   }
   1001 } {37 1 11 47 63 58 44 21 64 2 55}
   1002 do_test boundary3-2.5.lt.5 {
   1003   db eval {
   1004     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1005      WHERE t2.a=29
   1006      ORDER BY x
   1007   }
   1008 } {55 2 64 21 44 58 63 47 11 1 37}
   1009 do_test boundary3-2.5.lt.10 {
   1010   db eval {
   1011     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1012      WHERE t2.a=29
   1013      ORDER BY t1.rowid
   1014   }
   1015 } {55 2 64 21 44 58 63 47 11 1 37}
   1016 do_test boundary3-2.5.lt.11 {
   1017   db eval {
   1018     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1019      WHERE t2.a=29
   1020      ORDER BY t1.rowid DESC
   1021   }
   1022 } {37 1 11 47 63 58 44 21 64 2 55}
   1023 do_test boundary3-2.5.le.1 {
   1024   db eval {
   1025     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1026      WHERE t1.rowid <= -32769 ORDER BY t2.a
   1027   }
   1028 } {1 2 11 21 29 37 44 47 55 58 63 64}
   1029 do_test boundary3-2.5.le.2 {
   1030   db eval {
   1031     SELECT t2.a FROM t2 NATURAL JOIN t1
   1032      WHERE t1.rowid <= -32769 ORDER BY t1.a DESC
   1033   }
   1034 } {64 63 58 55 47 44 37 29 21 11 2 1}
   1035 do_test boundary3-2.5.le.3 {
   1036   db eval {
   1037     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1038      WHERE t2.a=29
   1039      ORDER BY t1.rowid
   1040   }
   1041 } {55 2 64 21 44 58 63 47 11 1 37 29}
   1042 do_test boundary3-2.5.le.4 {
   1043   db eval {
   1044     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1045      WHERE t2.a=29
   1046      ORDER BY t1.rowid DESC
   1047   }
   1048 } {29 37 1 11 47 63 58 44 21 64 2 55}
   1049 do_test boundary3-2.5.le.5 {
   1050   db eval {
   1051     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1052      WHERE t2.a=29
   1053      ORDER BY x
   1054   }
   1055 } {55 2 64 21 44 58 63 47 11 1 37 29}
   1056 do_test boundary3-2.5.le.10 {
   1057   db eval {
   1058     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1059      WHERE t2.a=29
   1060      ORDER BY t1.rowid
   1061   }
   1062 } {55 2 64 21 44 58 63 47 11 1 37 29}
   1063 do_test boundary3-2.5.le.11 {
   1064   db eval {
   1065     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1066      WHERE t2.a=29
   1067      ORDER BY t1.rowid DESC
   1068   }
   1069 } {29 37 1 11 47 63 58 44 21 64 2 55}
   1070 do_test boundary3-2.6.1 {
   1071   db eval {
   1072     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-140737488355329 AND t2.a=t1.a
   1073   }
   1074 } {21 ffff7fffffffffff}
   1075 do_test boundary3-2.6.2 {
   1076   db eval {
   1077     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffff7fffffffffff'
   1078   }
   1079 } {-140737488355329 21}
   1080 do_test boundary3-2.6.3 {
   1081   db eval {
   1082     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=21
   1083   }
   1084 } {-140737488355329 ffff7fffffffffff}
   1085 do_test boundary3-2.6.gt.1 {
   1086   db eval {
   1087     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1088      WHERE t1.rowid > -140737488355329 ORDER BY t2.a
   1089   }
   1090 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63}
   1091 do_test boundary3-2.6.gt.2 {
   1092   db eval {
   1093     SELECT t2.a FROM t2 NATURAL JOIN t1
   1094      WHERE t1.rowid > -140737488355329 ORDER BY t1.a DESC
   1095   }
   1096 } {63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   1097 do_test boundary3-2.6.gt.3 {
   1098   db eval {
   1099     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1100      WHERE t2.a=21
   1101      ORDER BY t1.rowid
   1102   }
   1103 } {44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1104 do_test boundary3-2.6.gt.4 {
   1105   db eval {
   1106     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1107      WHERE t2.a=21
   1108      ORDER BY t1.rowid DESC
   1109   }
   1110 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44}
   1111 do_test boundary3-2.6.gt.5 {
   1112   db eval {
   1113     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1114      WHERE t2.a=21
   1115      ORDER BY x
   1116   }
   1117 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1118 do_test boundary3-2.6.ge.1 {
   1119   db eval {
   1120     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1121      WHERE t1.rowid >= -140737488355329 ORDER BY t2.a
   1122   }
   1123 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63}
   1124 do_test boundary3-2.6.ge.2 {
   1125   db eval {
   1126     SELECT t2.a FROM t2 NATURAL JOIN t1
   1127      WHERE t1.rowid >= -140737488355329 ORDER BY t1.a DESC
   1128   }
   1129 } {63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   1130 do_test boundary3-2.6.ge.3 {
   1131   db eval {
   1132     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1133      WHERE t2.a=21
   1134      ORDER BY t1.rowid
   1135   }
   1136 } {21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1137 do_test boundary3-2.6.ge.4 {
   1138   db eval {
   1139     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1140      WHERE t2.a=21
   1141      ORDER BY t1.rowid DESC
   1142   }
   1143 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21}
   1144 do_test boundary3-2.6.ge.5 {
   1145   db eval {
   1146     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1147      WHERE t2.a=21
   1148      ORDER BY x
   1149   }
   1150 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1151 do_test boundary3-2.6.lt.1 {
   1152   db eval {
   1153     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1154      WHERE t1.rowid < -140737488355329 ORDER BY t2.a
   1155   }
   1156 } {2 55 64}
   1157 do_test boundary3-2.6.lt.2 {
   1158   db eval {
   1159     SELECT t2.a FROM t2 NATURAL JOIN t1
   1160      WHERE t1.rowid < -140737488355329 ORDER BY t1.a DESC
   1161   }
   1162 } {64 55 2}
   1163 do_test boundary3-2.6.lt.3 {
   1164   db eval {
   1165     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1166      WHERE t2.a=21
   1167      ORDER BY t1.rowid
   1168   }
   1169 } {55 2 64}
   1170 do_test boundary3-2.6.lt.4 {
   1171   db eval {
   1172     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1173      WHERE t2.a=21
   1174      ORDER BY t1.rowid DESC
   1175   }
   1176 } {64 2 55}
   1177 do_test boundary3-2.6.lt.5 {
   1178   db eval {
   1179     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1180      WHERE t2.a=21
   1181      ORDER BY x
   1182   }
   1183 } {55 2 64}
   1184 do_test boundary3-2.6.le.1 {
   1185   db eval {
   1186     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1187      WHERE t1.rowid <= -140737488355329 ORDER BY t2.a
   1188   }
   1189 } {2 21 55 64}
   1190 do_test boundary3-2.6.le.2 {
   1191   db eval {
   1192     SELECT t2.a FROM t2 NATURAL JOIN t1
   1193      WHERE t1.rowid <= -140737488355329 ORDER BY t1.a DESC
   1194   }
   1195 } {64 55 21 2}
   1196 do_test boundary3-2.6.le.3 {
   1197   db eval {
   1198     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1199      WHERE t2.a=21
   1200      ORDER BY t1.rowid
   1201   }
   1202 } {55 2 64 21}
   1203 do_test boundary3-2.6.le.4 {
   1204   db eval {
   1205     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1206      WHERE t2.a=21
   1207      ORDER BY t1.rowid DESC
   1208   }
   1209 } {21 64 2 55}
   1210 do_test boundary3-2.6.le.5 {
   1211   db eval {
   1212     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1213      WHERE t2.a=21
   1214      ORDER BY x
   1215   }
   1216 } {55 2 64 21}
   1217 do_test boundary3-2.7.1 {
   1218   db eval {
   1219     SELECT t1.* FROM t1, t2 WHERE t1.rowid=2 AND t2.a=t1.a
   1220   }
   1221 } {41 0000000000000002}
   1222 do_test boundary3-2.7.2 {
   1223   db eval {
   1224     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000002'
   1225   }
   1226 } {2 41}
   1227 do_test boundary3-2.7.3 {
   1228   db eval {
   1229     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=41
   1230   }
   1231 } {2 0000000000000002}
   1232 do_test boundary3-2.7.gt.1 {
   1233   db eval {
   1234     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1235      WHERE t1.rowid > 2 ORDER BY t2.a
   1236   }
   1237 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   1238 do_test boundary3-2.7.gt.2 {
   1239   db eval {
   1240     SELECT t2.a FROM t2 NATURAL JOIN t1
   1241      WHERE t1.rowid > 2 ORDER BY t1.a DESC
   1242   }
   1243 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   1244 do_test boundary3-2.7.gt.3 {
   1245   db eval {
   1246     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1247      WHERE t2.a=41
   1248      ORDER BY t1.rowid
   1249   }
   1250 } {5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1251 do_test boundary3-2.7.gt.4 {
   1252   db eval {
   1253     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1254      WHERE t2.a=41
   1255      ORDER BY t1.rowid DESC
   1256   }
   1257 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5}
   1258 do_test boundary3-2.7.gt.5 {
   1259   db eval {
   1260     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1261      WHERE t2.a=41
   1262      ORDER BY x
   1263   }
   1264 } {5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1265 do_test boundary3-2.7.gt.10 {
   1266   db eval {
   1267     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   1268      WHERE t2.a=41
   1269      ORDER BY t1.rowid
   1270   }
   1271 } {5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1272 do_test boundary3-2.7.gt.11 {
   1273   db eval {
   1274     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   1275      WHERE t2.a=41
   1276      ORDER BY t1.rowid DESC
   1277   }
   1278 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5}
   1279 do_test boundary3-2.7.ge.1 {
   1280   db eval {
   1281     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1282      WHERE t1.rowid >= 2 ORDER BY t2.a
   1283   }
   1284 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 41 42 43 45 46 48 49 50 51 56 57 61 62}
   1285 do_test boundary3-2.7.ge.2 {
   1286   db eval {
   1287     SELECT t2.a FROM t2 NATURAL JOIN t1
   1288      WHERE t1.rowid >= 2 ORDER BY t1.a DESC
   1289   }
   1290 } {62 61 57 56 51 50 49 48 46 45 43 42 41 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   1291 do_test boundary3-2.7.ge.3 {
   1292   db eval {
   1293     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1294      WHERE t2.a=41
   1295      ORDER BY t1.rowid
   1296   }
   1297 } {41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1298 do_test boundary3-2.7.ge.4 {
   1299   db eval {
   1300     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1301      WHERE t2.a=41
   1302      ORDER BY t1.rowid DESC
   1303   }
   1304 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41}
   1305 do_test boundary3-2.7.ge.5 {
   1306   db eval {
   1307     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1308      WHERE t2.a=41
   1309      ORDER BY x
   1310   }
   1311 } {41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1312 do_test boundary3-2.7.ge.10 {
   1313   db eval {
   1314     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   1315      WHERE t2.a=41
   1316      ORDER BY t1.rowid
   1317   }
   1318 } {41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1319 do_test boundary3-2.7.ge.11 {
   1320   db eval {
   1321     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   1322      WHERE t2.a=41
   1323      ORDER BY t1.rowid DESC
   1324   }
   1325 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41}
   1326 do_test boundary3-2.7.lt.1 {
   1327   db eval {
   1328     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1329      WHERE t1.rowid < 2 ORDER BY t2.a
   1330   }
   1331 } {1 2 11 21 29 32 33 37 38 44 47 52 53 54 55 58 59 60 63 64}
   1332 do_test boundary3-2.7.lt.2 {
   1333   db eval {
   1334     SELECT t2.a FROM t2 NATURAL JOIN t1
   1335      WHERE t1.rowid < 2 ORDER BY t1.a DESC
   1336   }
   1337 } {64 63 60 59 58 55 54 53 52 47 44 38 37 33 32 29 21 11 2 1}
   1338 do_test boundary3-2.7.lt.3 {
   1339   db eval {
   1340     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1341      WHERE t2.a=41
   1342      ORDER BY t1.rowid
   1343   }
   1344 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60}
   1345 do_test boundary3-2.7.lt.4 {
   1346   db eval {
   1347     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1348      WHERE t2.a=41
   1349      ORDER BY t1.rowid DESC
   1350   }
   1351 } {60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1352 do_test boundary3-2.7.lt.5 {
   1353   db eval {
   1354     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1355      WHERE t2.a=41
   1356      ORDER BY x
   1357   }
   1358 } {59 60 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1359 do_test boundary3-2.7.lt.10 {
   1360   db eval {
   1361     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1362      WHERE t2.a=41
   1363      ORDER BY t1.rowid
   1364   }
   1365 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60}
   1366 do_test boundary3-2.7.lt.11 {
   1367   db eval {
   1368     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1369      WHERE t2.a=41
   1370      ORDER BY t1.rowid DESC
   1371   }
   1372 } {60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1373 do_test boundary3-2.7.le.1 {
   1374   db eval {
   1375     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1376      WHERE t1.rowid <= 2 ORDER BY t2.a
   1377   }
   1378 } {1 2 11 21 29 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   1379 do_test boundary3-2.7.le.2 {
   1380   db eval {
   1381     SELECT t2.a FROM t2 NATURAL JOIN t1
   1382      WHERE t1.rowid <= 2 ORDER BY t1.a DESC
   1383   }
   1384 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 29 21 11 2 1}
   1385 do_test boundary3-2.7.le.3 {
   1386   db eval {
   1387     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1388      WHERE t2.a=41
   1389      ORDER BY t1.rowid
   1390   }
   1391 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41}
   1392 do_test boundary3-2.7.le.4 {
   1393   db eval {
   1394     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1395      WHERE t2.a=41
   1396      ORDER BY t1.rowid DESC
   1397   }
   1398 } {41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1399 do_test boundary3-2.7.le.5 {
   1400   db eval {
   1401     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1402      WHERE t2.a=41
   1403      ORDER BY x
   1404   }
   1405 } {59 60 41 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1406 do_test boundary3-2.7.le.10 {
   1407   db eval {
   1408     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1409      WHERE t2.a=41
   1410      ORDER BY t1.rowid
   1411   }
   1412 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41}
   1413 do_test boundary3-2.7.le.11 {
   1414   db eval {
   1415     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1416      WHERE t2.a=41
   1417      ORDER BY t1.rowid DESC
   1418   }
   1419 } {41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1420 do_test boundary3-2.8.1 {
   1421   db eval {
   1422     SELECT t1.* FROM t1, t2 WHERE t1.rowid=4 AND t2.a=t1.a
   1423   }
   1424 } {31 0000000000000004}
   1425 do_test boundary3-2.8.2 {
   1426   db eval {
   1427     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000004'
   1428   }
   1429 } {4 31}
   1430 do_test boundary3-2.8.3 {
   1431   db eval {
   1432     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=31
   1433   }
   1434 } {4 0000000000000004}
   1435 do_test boundary3-2.8.gt.1 {
   1436   db eval {
   1437     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1438      WHERE t1.rowid > 4 ORDER BY t2.a
   1439   }
   1440 } {3 4 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   1441 do_test boundary3-2.8.gt.2 {
   1442   db eval {
   1443     SELECT t2.a FROM t2 NATURAL JOIN t1
   1444      WHERE t1.rowid > 4 ORDER BY t1.a DESC
   1445   }
   1446 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 4 3}
   1447 do_test boundary3-2.8.gt.3 {
   1448   db eval {
   1449     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1450      WHERE t2.a=31
   1451      ORDER BY t1.rowid
   1452   }
   1453 } {4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1454 do_test boundary3-2.8.gt.4 {
   1455   db eval {
   1456     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1457      WHERE t2.a=31
   1458      ORDER BY t1.rowid DESC
   1459   }
   1460 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4}
   1461 do_test boundary3-2.8.gt.5 {
   1462   db eval {
   1463     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1464      WHERE t2.a=31
   1465      ORDER BY x
   1466   }
   1467 } {4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1468 do_test boundary3-2.8.gt.10 {
   1469   db eval {
   1470     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   1471      WHERE t2.a=31
   1472      ORDER BY t1.rowid
   1473   }
   1474 } {4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1475 do_test boundary3-2.8.gt.11 {
   1476   db eval {
   1477     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   1478      WHERE t2.a=31
   1479      ORDER BY t1.rowid DESC
   1480   }
   1481 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4}
   1482 do_test boundary3-2.8.ge.1 {
   1483   db eval {
   1484     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1485      WHERE t1.rowid >= 4 ORDER BY t2.a
   1486   }
   1487 } {3 4 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   1488 do_test boundary3-2.8.ge.2 {
   1489   db eval {
   1490     SELECT t2.a FROM t2 NATURAL JOIN t1
   1491      WHERE t1.rowid >= 4 ORDER BY t1.a DESC
   1492   }
   1493 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 4 3}
   1494 do_test boundary3-2.8.ge.3 {
   1495   db eval {
   1496     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1497      WHERE t2.a=31
   1498      ORDER BY t1.rowid
   1499   }
   1500 } {31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1501 do_test boundary3-2.8.ge.4 {
   1502   db eval {
   1503     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1504      WHERE t2.a=31
   1505      ORDER BY t1.rowid DESC
   1506   }
   1507 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31}
   1508 do_test boundary3-2.8.ge.5 {
   1509   db eval {
   1510     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1511      WHERE t2.a=31
   1512      ORDER BY x
   1513   }
   1514 } {31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1515 do_test boundary3-2.8.ge.10 {
   1516   db eval {
   1517     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   1518      WHERE t2.a=31
   1519      ORDER BY t1.rowid
   1520   }
   1521 } {31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1522 do_test boundary3-2.8.ge.11 {
   1523   db eval {
   1524     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   1525      WHERE t2.a=31
   1526      ORDER BY t1.rowid DESC
   1527   }
   1528 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31}
   1529 do_test boundary3-2.8.lt.1 {
   1530   db eval {
   1531     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1532      WHERE t1.rowid < 4 ORDER BY t2.a
   1533   }
   1534 } {1 2 5 11 21 29 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   1535 do_test boundary3-2.8.lt.2 {
   1536   db eval {
   1537     SELECT t2.a FROM t2 NATURAL JOIN t1
   1538      WHERE t1.rowid < 4 ORDER BY t1.a DESC
   1539   }
   1540 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 29 21 11 5 2 1}
   1541 do_test boundary3-2.8.lt.3 {
   1542   db eval {
   1543     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1544      WHERE t2.a=31
   1545      ORDER BY t1.rowid
   1546   }
   1547 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5}
   1548 do_test boundary3-2.8.lt.4 {
   1549   db eval {
   1550     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1551      WHERE t2.a=31
   1552      ORDER BY t1.rowid DESC
   1553   }
   1554 } {5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1555 do_test boundary3-2.8.lt.5 {
   1556   db eval {
   1557     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1558      WHERE t2.a=31
   1559      ORDER BY x
   1560   }
   1561 } {59 60 41 5 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1562 do_test boundary3-2.8.lt.10 {
   1563   db eval {
   1564     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1565      WHERE t2.a=31
   1566      ORDER BY t1.rowid
   1567   }
   1568 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5}
   1569 do_test boundary3-2.8.lt.11 {
   1570   db eval {
   1571     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1572      WHERE t2.a=31
   1573      ORDER BY t1.rowid DESC
   1574   }
   1575 } {5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1576 do_test boundary3-2.8.le.1 {
   1577   db eval {
   1578     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1579      WHERE t1.rowid <= 4 ORDER BY t2.a
   1580   }
   1581 } {1 2 5 11 21 29 31 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   1582 do_test boundary3-2.8.le.2 {
   1583   db eval {
   1584     SELECT t2.a FROM t2 NATURAL JOIN t1
   1585      WHERE t1.rowid <= 4 ORDER BY t1.a DESC
   1586   }
   1587 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 31 29 21 11 5 2 1}
   1588 do_test boundary3-2.8.le.3 {
   1589   db eval {
   1590     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1591      WHERE t2.a=31
   1592      ORDER BY t1.rowid
   1593   }
   1594 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31}
   1595 do_test boundary3-2.8.le.4 {
   1596   db eval {
   1597     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1598      WHERE t2.a=31
   1599      ORDER BY t1.rowid DESC
   1600   }
   1601 } {31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1602 do_test boundary3-2.8.le.5 {
   1603   db eval {
   1604     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1605      WHERE t2.a=31
   1606      ORDER BY x
   1607   }
   1608 } {59 60 41 5 31 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1609 do_test boundary3-2.8.le.10 {
   1610   db eval {
   1611     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1612      WHERE t2.a=31
   1613      ORDER BY t1.rowid
   1614   }
   1615 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31}
   1616 do_test boundary3-2.8.le.11 {
   1617   db eval {
   1618     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1619      WHERE t2.a=31
   1620      ORDER BY t1.rowid DESC
   1621   }
   1622 } {31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1623 do_test boundary3-2.9.1 {
   1624   db eval {
   1625     SELECT t1.* FROM t1, t2 WHERE t1.rowid=562949953421311 AND t2.a=t1.a
   1626   }
   1627 } {13 0001ffffffffffff}
   1628 do_test boundary3-2.9.2 {
   1629   db eval {
   1630     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0001ffffffffffff'
   1631   }
   1632 } {562949953421311 13}
   1633 do_test boundary3-2.9.3 {
   1634   db eval {
   1635     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=13
   1636   }
   1637 } {562949953421311 0001ffffffffffff}
   1638 do_test boundary3-2.9.gt.1 {
   1639   db eval {
   1640     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1641      WHERE t1.rowid > 562949953421311 ORDER BY t2.a
   1642   }
   1643 } {3 17 27 28 43 45}
   1644 do_test boundary3-2.9.gt.2 {
   1645   db eval {
   1646     SELECT t2.a FROM t2 NATURAL JOIN t1
   1647      WHERE t1.rowid > 562949953421311 ORDER BY t1.a DESC
   1648   }
   1649 } {45 43 28 27 17 3}
   1650 do_test boundary3-2.9.gt.3 {
   1651   db eval {
   1652     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1653      WHERE t2.a=13
   1654      ORDER BY t1.rowid
   1655   }
   1656 } {43 27 45 17 28 3}
   1657 do_test boundary3-2.9.gt.4 {
   1658   db eval {
   1659     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1660      WHERE t2.a=13
   1661      ORDER BY t1.rowid DESC
   1662   }
   1663 } {3 28 17 45 27 43}
   1664 do_test boundary3-2.9.gt.5 {
   1665   db eval {
   1666     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1667      WHERE t2.a=13
   1668      ORDER BY x
   1669   }
   1670 } {43 27 45 17 28 3}
   1671 do_test boundary3-2.9.ge.1 {
   1672   db eval {
   1673     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1674      WHERE t1.rowid >= 562949953421311 ORDER BY t2.a
   1675   }
   1676 } {3 13 17 27 28 43 45}
   1677 do_test boundary3-2.9.ge.2 {
   1678   db eval {
   1679     SELECT t2.a FROM t2 NATURAL JOIN t1
   1680      WHERE t1.rowid >= 562949953421311 ORDER BY t1.a DESC
   1681   }
   1682 } {45 43 28 27 17 13 3}
   1683 do_test boundary3-2.9.ge.3 {
   1684   db eval {
   1685     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1686      WHERE t2.a=13
   1687      ORDER BY t1.rowid
   1688   }
   1689 } {13 43 27 45 17 28 3}
   1690 do_test boundary3-2.9.ge.4 {
   1691   db eval {
   1692     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1693      WHERE t2.a=13
   1694      ORDER BY t1.rowid DESC
   1695   }
   1696 } {3 28 17 45 27 43 13}
   1697 do_test boundary3-2.9.ge.5 {
   1698   db eval {
   1699     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1700      WHERE t2.a=13
   1701      ORDER BY x
   1702   }
   1703 } {13 43 27 45 17 28 3}
   1704 do_test boundary3-2.9.lt.1 {
   1705   db eval {
   1706     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1707      WHERE t1.rowid < 562949953421311 ORDER BY t2.a
   1708   }
   1709 } {1 2 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   1710 do_test boundary3-2.9.lt.2 {
   1711   db eval {
   1712     SELECT t2.a FROM t2 NATURAL JOIN t1
   1713      WHERE t1.rowid < 562949953421311 ORDER BY t1.a DESC
   1714   }
   1715 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 26 25 24 23 22 21 20 19 18 16 15 14 12 11 10 9 8 7 6 5 4 2 1}
   1716 do_test boundary3-2.9.lt.3 {
   1717   db eval {
   1718     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1719      WHERE t2.a=13
   1720      ORDER BY t1.rowid
   1721   }
   1722 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26}
   1723 do_test boundary3-2.9.lt.4 {
   1724   db eval {
   1725     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1726      WHERE t2.a=13
   1727      ORDER BY t1.rowid DESC
   1728   }
   1729 } {26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1730 do_test boundary3-2.9.lt.5 {
   1731   db eval {
   1732     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1733      WHERE t2.a=13
   1734      ORDER BY x
   1735   }
   1736 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1737 do_test boundary3-2.9.le.1 {
   1738   db eval {
   1739     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1740      WHERE t1.rowid <= 562949953421311 ORDER BY t2.a
   1741   }
   1742 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   1743 do_test boundary3-2.9.le.2 {
   1744   db eval {
   1745     SELECT t2.a FROM t2 NATURAL JOIN t1
   1746      WHERE t1.rowid <= 562949953421311 ORDER BY t1.a DESC
   1747   }
   1748 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   1749 do_test boundary3-2.9.le.3 {
   1750   db eval {
   1751     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1752      WHERE t2.a=13
   1753      ORDER BY t1.rowid
   1754   }
   1755 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13}
   1756 do_test boundary3-2.9.le.4 {
   1757   db eval {
   1758     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1759      WHERE t2.a=13
   1760      ORDER BY t1.rowid DESC
   1761   }
   1762 } {13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1763 do_test boundary3-2.9.le.5 {
   1764   db eval {
   1765     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1766      WHERE t2.a=13
   1767      ORDER BY x
   1768   }
   1769 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1770 do_test boundary3-2.10.1 {
   1771   db eval {
   1772     SELECT t1.* FROM t1, t2 WHERE t1.rowid=256 AND t2.a=t1.a
   1773   }
   1774 } {61 0000000000000100}
   1775 do_test boundary3-2.10.2 {
   1776   db eval {
   1777     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000100'
   1778   }
   1779 } {256 61}
   1780 do_test boundary3-2.10.3 {
   1781   db eval {
   1782     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=61
   1783   }
   1784 } {256 0000000000000100}
   1785 do_test boundary3-2.10.gt.1 {
   1786   db eval {
   1787     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1788      WHERE t1.rowid > 256 ORDER BY t2.a
   1789   }
   1790 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
   1791 do_test boundary3-2.10.gt.2 {
   1792   db eval {
   1793     SELECT t2.a FROM t2 NATURAL JOIN t1
   1794      WHERE t1.rowid > 256 ORDER BY t1.a DESC
   1795   }
   1796 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   1797 do_test boundary3-2.10.gt.3 {
   1798   db eval {
   1799     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1800      WHERE t2.a=61
   1801      ORDER BY t1.rowid
   1802   }
   1803 } {8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1804 do_test boundary3-2.10.gt.4 {
   1805   db eval {
   1806     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1807      WHERE t2.a=61
   1808      ORDER BY t1.rowid DESC
   1809   }
   1810 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8}
   1811 do_test boundary3-2.10.gt.5 {
   1812   db eval {
   1813     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   1814      WHERE t2.a=61
   1815      ORDER BY x
   1816   }
   1817 } {8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1818 do_test boundary3-2.10.gt.10 {
   1819   db eval {
   1820     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   1821      WHERE t2.a=61
   1822      ORDER BY t1.rowid
   1823   }
   1824 } {8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1825 do_test boundary3-2.10.gt.11 {
   1826   db eval {
   1827     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   1828      WHERE t2.a=61
   1829      ORDER BY t1.rowid DESC
   1830   }
   1831 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8}
   1832 do_test boundary3-2.10.ge.1 {
   1833   db eval {
   1834     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1835      WHERE t1.rowid >= 256 ORDER BY t2.a
   1836   }
   1837 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 61 62}
   1838 do_test boundary3-2.10.ge.2 {
   1839   db eval {
   1840     SELECT t2.a FROM t2 NATURAL JOIN t1
   1841      WHERE t1.rowid >= 256 ORDER BY t1.a DESC
   1842   }
   1843 } {62 61 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   1844 do_test boundary3-2.10.ge.3 {
   1845   db eval {
   1846     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1847      WHERE t2.a=61
   1848      ORDER BY t1.rowid
   1849   }
   1850 } {61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1851 do_test boundary3-2.10.ge.4 {
   1852   db eval {
   1853     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1854      WHERE t2.a=61
   1855      ORDER BY t1.rowid DESC
   1856   }
   1857 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61}
   1858 do_test boundary3-2.10.ge.5 {
   1859   db eval {
   1860     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   1861      WHERE t2.a=61
   1862      ORDER BY x
   1863   }
   1864 } {61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1865 do_test boundary3-2.10.ge.10 {
   1866   db eval {
   1867     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   1868      WHERE t2.a=61
   1869      ORDER BY t1.rowid
   1870   }
   1871 } {61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   1872 do_test boundary3-2.10.ge.11 {
   1873   db eval {
   1874     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   1875      WHERE t2.a=61
   1876      ORDER BY t1.rowid DESC
   1877   }
   1878 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61}
   1879 do_test boundary3-2.10.lt.1 {
   1880   db eval {
   1881     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1882      WHERE t1.rowid < 256 ORDER BY t2.a
   1883   }
   1884 } {1 2 4 5 11 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 63 64}
   1885 do_test boundary3-2.10.lt.2 {
   1886   db eval {
   1887     SELECT t2.a FROM t2 NATURAL JOIN t1
   1888      WHERE t1.rowid < 256 ORDER BY t1.a DESC
   1889   }
   1890 } {64 63 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 11 5 4 2 1}
   1891 do_test boundary3-2.10.lt.3 {
   1892   db eval {
   1893     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1894      WHERE t2.a=61
   1895      ORDER BY t1.rowid
   1896   }
   1897 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30}
   1898 do_test boundary3-2.10.lt.4 {
   1899   db eval {
   1900     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1901      WHERE t2.a=61
   1902      ORDER BY t1.rowid DESC
   1903   }
   1904 } {30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1905 do_test boundary3-2.10.lt.5 {
   1906   db eval {
   1907     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   1908      WHERE t2.a=61
   1909      ORDER BY x
   1910   }
   1911 } {59 60 41 5 31 4 49 30 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1912 do_test boundary3-2.10.lt.10 {
   1913   db eval {
   1914     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1915      WHERE t2.a=61
   1916      ORDER BY t1.rowid
   1917   }
   1918 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30}
   1919 do_test boundary3-2.10.lt.11 {
   1920   db eval {
   1921     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   1922      WHERE t2.a=61
   1923      ORDER BY t1.rowid DESC
   1924   }
   1925 } {30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1926 do_test boundary3-2.10.le.1 {
   1927   db eval {
   1928     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1929      WHERE t1.rowid <= 256 ORDER BY t2.a
   1930   }
   1931 } {1 2 4 5 11 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
   1932 do_test boundary3-2.10.le.2 {
   1933   db eval {
   1934     SELECT t2.a FROM t2 NATURAL JOIN t1
   1935      WHERE t1.rowid <= 256 ORDER BY t1.a DESC
   1936   }
   1937 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 11 5 4 2 1}
   1938 do_test boundary3-2.10.le.3 {
   1939   db eval {
   1940     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1941      WHERE t2.a=61
   1942      ORDER BY t1.rowid
   1943   }
   1944 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61}
   1945 do_test boundary3-2.10.le.4 {
   1946   db eval {
   1947     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1948      WHERE t2.a=61
   1949      ORDER BY t1.rowid DESC
   1950   }
   1951 } {61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1952 do_test boundary3-2.10.le.5 {
   1953   db eval {
   1954     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   1955      WHERE t2.a=61
   1956      ORDER BY x
   1957   }
   1958 } {59 60 41 5 31 4 49 30 61 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   1959 do_test boundary3-2.10.le.10 {
   1960   db eval {
   1961     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1962      WHERE t2.a=61
   1963      ORDER BY t1.rowid
   1964   }
   1965 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61}
   1966 do_test boundary3-2.10.le.11 {
   1967   db eval {
   1968     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   1969      WHERE t2.a=61
   1970      ORDER BY t1.rowid DESC
   1971   }
   1972 } {61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   1973 do_test boundary3-2.11.1 {
   1974   db eval {
   1975     SELECT t1.* FROM t1, t2 WHERE t1.rowid=34359738368 AND t2.a=t1.a
   1976   }
   1977 } {22 0000000800000000}
   1978 do_test boundary3-2.11.2 {
   1979   db eval {
   1980     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000800000000'
   1981   }
   1982 } {34359738368 22}
   1983 do_test boundary3-2.11.3 {
   1984   db eval {
   1985     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=22
   1986   }
   1987 } {34359738368 0000000800000000}
   1988 do_test boundary3-2.11.gt.1 {
   1989   db eval {
   1990     SELECT t2.a FROM t1 JOIN t2 USING(a)
   1991      WHERE t1.rowid > 34359738368 ORDER BY t2.a
   1992   }
   1993 } {3 7 10 13 17 19 25 26 27 28 34 35 43 45 46 56 57}
   1994 do_test boundary3-2.11.gt.2 {
   1995   db eval {
   1996     SELECT t2.a FROM t2 NATURAL JOIN t1
   1997      WHERE t1.rowid > 34359738368 ORDER BY t1.a DESC
   1998   }
   1999 } {57 56 46 45 43 35 34 28 27 26 25 19 17 13 10 7 3}
   2000 do_test boundary3-2.11.gt.3 {
   2001   db eval {
   2002     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2003      WHERE t2.a=22
   2004      ORDER BY t1.rowid
   2005   }
   2006 } {46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2007 do_test boundary3-2.11.gt.4 {
   2008   db eval {
   2009     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2010      WHERE t2.a=22
   2011      ORDER BY t1.rowid DESC
   2012   }
   2013 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46}
   2014 do_test boundary3-2.11.gt.5 {
   2015   db eval {
   2016     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2017      WHERE t2.a=22
   2018      ORDER BY x
   2019   }
   2020 } {46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2021 do_test boundary3-2.11.gt.10 {
   2022   db eval {
   2023     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2024      WHERE t2.a=22
   2025      ORDER BY t1.rowid
   2026   }
   2027 } {46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2028 do_test boundary3-2.11.gt.11 {
   2029   db eval {
   2030     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2031      WHERE t2.a=22
   2032      ORDER BY t1.rowid DESC
   2033   }
   2034 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46}
   2035 do_test boundary3-2.11.ge.1 {
   2036   db eval {
   2037     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2038      WHERE t1.rowid >= 34359738368 ORDER BY t2.a
   2039   }
   2040 } {3 7 10 13 17 19 22 25 26 27 28 34 35 43 45 46 56 57}
   2041 do_test boundary3-2.11.ge.2 {
   2042   db eval {
   2043     SELECT t2.a FROM t2 NATURAL JOIN t1
   2044      WHERE t1.rowid >= 34359738368 ORDER BY t1.a DESC
   2045   }
   2046 } {57 56 46 45 43 35 34 28 27 26 25 22 19 17 13 10 7 3}
   2047 do_test boundary3-2.11.ge.3 {
   2048   db eval {
   2049     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2050      WHERE t2.a=22
   2051      ORDER BY t1.rowid
   2052   }
   2053 } {22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2054 do_test boundary3-2.11.ge.4 {
   2055   db eval {
   2056     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2057      WHERE t2.a=22
   2058      ORDER BY t1.rowid DESC
   2059   }
   2060 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22}
   2061 do_test boundary3-2.11.ge.5 {
   2062   db eval {
   2063     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2064      WHERE t2.a=22
   2065      ORDER BY x
   2066   }
   2067 } {22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2068 do_test boundary3-2.11.ge.10 {
   2069   db eval {
   2070     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2071      WHERE t2.a=22
   2072      ORDER BY t1.rowid
   2073   }
   2074 } {22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2075 do_test boundary3-2.11.ge.11 {
   2076   db eval {
   2077     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2078      WHERE t2.a=22
   2079      ORDER BY t1.rowid DESC
   2080   }
   2081 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22}
   2082 do_test boundary3-2.11.lt.1 {
   2083   db eval {
   2084     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2085      WHERE t1.rowid < 34359738368 ORDER BY t2.a
   2086   }
   2087 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 23 24 29 30 31 32 33 36 37 38 39 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   2088 do_test boundary3-2.11.lt.2 {
   2089   db eval {
   2090     SELECT t2.a FROM t2 NATURAL JOIN t1
   2091      WHERE t1.rowid < 34359738368 ORDER BY t1.a DESC
   2092   }
   2093 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 39 38 37 36 33 32 31 30 29 24 23 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   2094 do_test boundary3-2.11.lt.3 {
   2095   db eval {
   2096     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2097      WHERE t2.a=22
   2098      ORDER BY t1.rowid
   2099   }
   2100 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39}
   2101 do_test boundary3-2.11.lt.4 {
   2102   db eval {
   2103     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2104      WHERE t2.a=22
   2105      ORDER BY t1.rowid DESC
   2106   }
   2107 } {39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2108 do_test boundary3-2.11.lt.5 {
   2109   db eval {
   2110     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2111      WHERE t2.a=22
   2112      ORDER BY x
   2113   }
   2114 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2115 do_test boundary3-2.11.lt.10 {
   2116   db eval {
   2117     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2118      WHERE t2.a=22
   2119      ORDER BY t1.rowid
   2120   }
   2121 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39}
   2122 do_test boundary3-2.11.lt.11 {
   2123   db eval {
   2124     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2125      WHERE t2.a=22
   2126      ORDER BY t1.rowid DESC
   2127   }
   2128 } {39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2129 do_test boundary3-2.11.le.1 {
   2130   db eval {
   2131     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2132      WHERE t1.rowid <= 34359738368 ORDER BY t2.a
   2133   }
   2134 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 36 37 38 39 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   2135 do_test boundary3-2.11.le.2 {
   2136   db eval {
   2137     SELECT t2.a FROM t2 NATURAL JOIN t1
   2138      WHERE t1.rowid <= 34359738368 ORDER BY t1.a DESC
   2139   }
   2140 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 39 38 37 36 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   2141 do_test boundary3-2.11.le.3 {
   2142   db eval {
   2143     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2144      WHERE t2.a=22
   2145      ORDER BY t1.rowid
   2146   }
   2147 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22}
   2148 do_test boundary3-2.11.le.4 {
   2149   db eval {
   2150     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2151      WHERE t2.a=22
   2152      ORDER BY t1.rowid DESC
   2153   }
   2154 } {22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2155 do_test boundary3-2.11.le.5 {
   2156   db eval {
   2157     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2158      WHERE t2.a=22
   2159      ORDER BY x
   2160   }
   2161 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2162 do_test boundary3-2.11.le.10 {
   2163   db eval {
   2164     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2165      WHERE t2.a=22
   2166      ORDER BY t1.rowid
   2167   }
   2168 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22}
   2169 do_test boundary3-2.11.le.11 {
   2170   db eval {
   2171     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2172      WHERE t2.a=22
   2173      ORDER BY t1.rowid DESC
   2174   }
   2175 } {22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2176 do_test boundary3-2.12.1 {
   2177   db eval {
   2178     SELECT t1.* FROM t1, t2 WHERE t1.rowid=65536 AND t2.a=t1.a
   2179   }
   2180 } {62 0000000000010000}
   2181 do_test boundary3-2.12.2 {
   2182   db eval {
   2183     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000010000'
   2184   }
   2185 } {65536 62}
   2186 do_test boundary3-2.12.3 {
   2187   db eval {
   2188     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=62
   2189   }
   2190 } {65536 0000000000010000}
   2191 do_test boundary3-2.12.gt.1 {
   2192   db eval {
   2193     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2194      WHERE t1.rowid > 65536 ORDER BY t2.a
   2195   }
   2196 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 51 56 57}
   2197 do_test boundary3-2.12.gt.2 {
   2198   db eval {
   2199     SELECT t2.a FROM t2 NATURAL JOIN t1
   2200      WHERE t1.rowid > 65536 ORDER BY t1.a DESC
   2201   }
   2202 } {57 56 51 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   2203 do_test boundary3-2.12.gt.3 {
   2204   db eval {
   2205     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2206      WHERE t2.a=62
   2207      ORDER BY t1.rowid
   2208   }
   2209 } {15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2210 do_test boundary3-2.12.gt.4 {
   2211   db eval {
   2212     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2213      WHERE t2.a=62
   2214      ORDER BY t1.rowid DESC
   2215   }
   2216 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15}
   2217 do_test boundary3-2.12.gt.5 {
   2218   db eval {
   2219     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2220      WHERE t2.a=62
   2221      ORDER BY x
   2222   }
   2223 } {15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2224 do_test boundary3-2.12.gt.10 {
   2225   db eval {
   2226     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2227      WHERE t2.a=62
   2228      ORDER BY t1.rowid
   2229   }
   2230 } {15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2231 do_test boundary3-2.12.gt.11 {
   2232   db eval {
   2233     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2234      WHERE t2.a=62
   2235      ORDER BY t1.rowid DESC
   2236   }
   2237 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15}
   2238 do_test boundary3-2.12.ge.1 {
   2239   db eval {
   2240     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2241      WHERE t1.rowid >= 65536 ORDER BY t2.a
   2242   }
   2243 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 51 56 57 62}
   2244 do_test boundary3-2.12.ge.2 {
   2245   db eval {
   2246     SELECT t2.a FROM t2 NATURAL JOIN t1
   2247      WHERE t1.rowid >= 65536 ORDER BY t1.a DESC
   2248   }
   2249 } {62 57 56 51 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   2250 do_test boundary3-2.12.ge.3 {
   2251   db eval {
   2252     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2253      WHERE t2.a=62
   2254      ORDER BY t1.rowid
   2255   }
   2256 } {62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2257 do_test boundary3-2.12.ge.4 {
   2258   db eval {
   2259     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2260      WHERE t2.a=62
   2261      ORDER BY t1.rowid DESC
   2262   }
   2263 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62}
   2264 do_test boundary3-2.12.ge.5 {
   2265   db eval {
   2266     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2267      WHERE t2.a=62
   2268      ORDER BY x
   2269   }
   2270 } {62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2271 do_test boundary3-2.12.ge.10 {
   2272   db eval {
   2273     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2274      WHERE t2.a=62
   2275      ORDER BY t1.rowid
   2276   }
   2277 } {62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2278 do_test boundary3-2.12.ge.11 {
   2279   db eval {
   2280     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2281      WHERE t2.a=62
   2282      ORDER BY t1.rowid DESC
   2283   }
   2284 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62}
   2285 do_test boundary3-2.12.lt.1 {
   2286   db eval {
   2287     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2288      WHERE t1.rowid < 65536 ORDER BY t2.a
   2289   }
   2290 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 48 49 50 52 53 54 55 58 59 60 61 63 64}
   2291 do_test boundary3-2.12.lt.2 {
   2292   db eval {
   2293     SELECT t2.a FROM t2 NATURAL JOIN t1
   2294      WHERE t1.rowid < 65536 ORDER BY t1.a DESC
   2295   }
   2296 } {64 63 61 60 59 58 55 54 53 52 50 49 48 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   2297 do_test boundary3-2.12.lt.3 {
   2298   db eval {
   2299     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2300      WHERE t2.a=62
   2301      ORDER BY t1.rowid
   2302   }
   2303 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48}
   2304 do_test boundary3-2.12.lt.4 {
   2305   db eval {
   2306     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2307      WHERE t2.a=62
   2308      ORDER BY t1.rowid DESC
   2309   }
   2310 } {48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2311 do_test boundary3-2.12.lt.5 {
   2312   db eval {
   2313     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2314      WHERE t2.a=62
   2315      ORDER BY x
   2316   }
   2317 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2318 do_test boundary3-2.12.lt.10 {
   2319   db eval {
   2320     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2321      WHERE t2.a=62
   2322      ORDER BY t1.rowid
   2323   }
   2324 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48}
   2325 do_test boundary3-2.12.lt.11 {
   2326   db eval {
   2327     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2328      WHERE t2.a=62
   2329      ORDER BY t1.rowid DESC
   2330   }
   2331 } {48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2332 do_test boundary3-2.12.le.1 {
   2333   db eval {
   2334     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2335      WHERE t1.rowid <= 65536 ORDER BY t2.a
   2336   }
   2337 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   2338 do_test boundary3-2.12.le.2 {
   2339   db eval {
   2340     SELECT t2.a FROM t2 NATURAL JOIN t1
   2341      WHERE t1.rowid <= 65536 ORDER BY t1.a DESC
   2342   }
   2343 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   2344 do_test boundary3-2.12.le.3 {
   2345   db eval {
   2346     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2347      WHERE t2.a=62
   2348      ORDER BY t1.rowid
   2349   }
   2350 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62}
   2351 do_test boundary3-2.12.le.4 {
   2352   db eval {
   2353     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2354      WHERE t2.a=62
   2355      ORDER BY t1.rowid DESC
   2356   }
   2357 } {62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2358 do_test boundary3-2.12.le.5 {
   2359   db eval {
   2360     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2361      WHERE t2.a=62
   2362      ORDER BY x
   2363   }
   2364 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2365 do_test boundary3-2.12.le.10 {
   2366   db eval {
   2367     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2368      WHERE t2.a=62
   2369      ORDER BY t1.rowid
   2370   }
   2371 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62}
   2372 do_test boundary3-2.12.le.11 {
   2373   db eval {
   2374     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2375      WHERE t2.a=62
   2376      ORDER BY t1.rowid DESC
   2377   }
   2378 } {62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2379 do_test boundary3-2.13.1 {
   2380   db eval {
   2381     SELECT t1.* FROM t1, t2 WHERE t1.rowid=268435456 AND t2.a=t1.a
   2382   }
   2383 } {40 0000000010000000}
   2384 do_test boundary3-2.13.2 {
   2385   db eval {
   2386     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000010000000'
   2387   }
   2388 } {268435456 40}
   2389 do_test boundary3-2.13.3 {
   2390   db eval {
   2391     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=40
   2392   }
   2393 } {268435456 0000000010000000}
   2394 do_test boundary3-2.13.gt.1 {
   2395   db eval {
   2396     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2397      WHERE t1.rowid > 268435456 ORDER BY t2.a
   2398   }
   2399 } {3 7 10 13 14 17 19 20 22 25 26 27 28 34 35 36 39 43 45 46 51 56 57}
   2400 do_test boundary3-2.13.gt.2 {
   2401   db eval {
   2402     SELECT t2.a FROM t2 NATURAL JOIN t1
   2403      WHERE t1.rowid > 268435456 ORDER BY t1.a DESC
   2404   }
   2405 } {57 56 51 46 45 43 39 36 35 34 28 27 26 25 22 20 19 17 14 13 10 7 3}
   2406 do_test boundary3-2.13.gt.3 {
   2407   db eval {
   2408     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2409      WHERE t2.a=40
   2410      ORDER BY t1.rowid
   2411   }
   2412 } {20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2413 do_test boundary3-2.13.gt.4 {
   2414   db eval {
   2415     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2416      WHERE t2.a=40
   2417      ORDER BY t1.rowid DESC
   2418   }
   2419 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20}
   2420 do_test boundary3-2.13.gt.5 {
   2421   db eval {
   2422     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2423      WHERE t2.a=40
   2424      ORDER BY x
   2425   }
   2426 } {20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2427 do_test boundary3-2.13.gt.10 {
   2428   db eval {
   2429     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2430      WHERE t2.a=40
   2431      ORDER BY t1.rowid
   2432   }
   2433 } {20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2434 do_test boundary3-2.13.gt.11 {
   2435   db eval {
   2436     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2437      WHERE t2.a=40
   2438      ORDER BY t1.rowid DESC
   2439   }
   2440 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20}
   2441 do_test boundary3-2.13.ge.1 {
   2442   db eval {
   2443     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2444      WHERE t1.rowid >= 268435456 ORDER BY t2.a
   2445   }
   2446 } {3 7 10 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   2447 do_test boundary3-2.13.ge.2 {
   2448   db eval {
   2449     SELECT t2.a FROM t2 NATURAL JOIN t1
   2450      WHERE t1.rowid >= 268435456 ORDER BY t1.a DESC
   2451   }
   2452 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 10 7 3}
   2453 do_test boundary3-2.13.ge.3 {
   2454   db eval {
   2455     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2456      WHERE t2.a=40
   2457      ORDER BY t1.rowid
   2458   }
   2459 } {40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2460 do_test boundary3-2.13.ge.4 {
   2461   db eval {
   2462     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2463      WHERE t2.a=40
   2464      ORDER BY t1.rowid DESC
   2465   }
   2466 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40}
   2467 do_test boundary3-2.13.ge.5 {
   2468   db eval {
   2469     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2470      WHERE t2.a=40
   2471      ORDER BY x
   2472   }
   2473 } {40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2474 do_test boundary3-2.13.ge.10 {
   2475   db eval {
   2476     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2477      WHERE t2.a=40
   2478      ORDER BY t1.rowid
   2479   }
   2480 } {40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2481 do_test boundary3-2.13.ge.11 {
   2482   db eval {
   2483     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2484      WHERE t2.a=40
   2485      ORDER BY t1.rowid DESC
   2486   }
   2487 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40}
   2488 do_test boundary3-2.13.lt.1 {
   2489   db eval {
   2490     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2491      WHERE t1.rowid < 268435456 ORDER BY t2.a
   2492   }
   2493 } {1 2 4 5 6 8 9 11 12 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   2494 do_test boundary3-2.13.lt.2 {
   2495   db eval {
   2496     SELECT t2.a FROM t2 NATURAL JOIN t1
   2497      WHERE t1.rowid < 268435456 ORDER BY t1.a DESC
   2498   }
   2499 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 12 11 9 8 6 5 4 2 1}
   2500 do_test boundary3-2.13.lt.3 {
   2501   db eval {
   2502     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2503      WHERE t2.a=40
   2504      ORDER BY t1.rowid
   2505   }
   2506 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12}
   2507 do_test boundary3-2.13.lt.4 {
   2508   db eval {
   2509     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2510      WHERE t2.a=40
   2511      ORDER BY t1.rowid DESC
   2512   }
   2513 } {12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2514 do_test boundary3-2.13.lt.5 {
   2515   db eval {
   2516     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2517      WHERE t2.a=40
   2518      ORDER BY x
   2519   }
   2520 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2521 do_test boundary3-2.13.lt.10 {
   2522   db eval {
   2523     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2524      WHERE t2.a=40
   2525      ORDER BY t1.rowid
   2526   }
   2527 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12}
   2528 do_test boundary3-2.13.lt.11 {
   2529   db eval {
   2530     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2531      WHERE t2.a=40
   2532      ORDER BY t1.rowid DESC
   2533   }
   2534 } {12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2535 do_test boundary3-2.13.le.1 {
   2536   db eval {
   2537     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2538      WHERE t1.rowid <= 268435456 ORDER BY t2.a
   2539   }
   2540 } {1 2 4 5 6 8 9 11 12 15 16 18 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   2541 do_test boundary3-2.13.le.2 {
   2542   db eval {
   2543     SELECT t2.a FROM t2 NATURAL JOIN t1
   2544      WHERE t1.rowid <= 268435456 ORDER BY t1.a DESC
   2545   }
   2546 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 18 16 15 12 11 9 8 6 5 4 2 1}
   2547 do_test boundary3-2.13.le.3 {
   2548   db eval {
   2549     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2550      WHERE t2.a=40
   2551      ORDER BY t1.rowid
   2552   }
   2553 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40}
   2554 do_test boundary3-2.13.le.4 {
   2555   db eval {
   2556     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2557      WHERE t2.a=40
   2558      ORDER BY t1.rowid DESC
   2559   }
   2560 } {40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2561 do_test boundary3-2.13.le.5 {
   2562   db eval {
   2563     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2564      WHERE t2.a=40
   2565      ORDER BY x
   2566   }
   2567 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2568 do_test boundary3-2.13.le.10 {
   2569   db eval {
   2570     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2571      WHERE t2.a=40
   2572      ORDER BY t1.rowid
   2573   }
   2574 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40}
   2575 do_test boundary3-2.13.le.11 {
   2576   db eval {
   2577     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2578      WHERE t2.a=40
   2579      ORDER BY t1.rowid DESC
   2580   }
   2581 } {40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2582 do_test boundary3-2.14.1 {
   2583   db eval {
   2584     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-140737488355328 AND t2.a=t1.a
   2585   }
   2586 } {44 ffff800000000000}
   2587 do_test boundary3-2.14.2 {
   2588   db eval {
   2589     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffff800000000000'
   2590   }
   2591 } {-140737488355328 44}
   2592 do_test boundary3-2.14.3 {
   2593   db eval {
   2594     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=44
   2595   }
   2596 } {-140737488355328 ffff800000000000}
   2597 do_test boundary3-2.14.gt.1 {
   2598   db eval {
   2599     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2600      WHERE t1.rowid > -140737488355328 ORDER BY t2.a
   2601   }
   2602 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63}
   2603 do_test boundary3-2.14.gt.2 {
   2604   db eval {
   2605     SELECT t2.a FROM t2 NATURAL JOIN t1
   2606      WHERE t1.rowid > -140737488355328 ORDER BY t1.a DESC
   2607   }
   2608 } {63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   2609 do_test boundary3-2.14.gt.3 {
   2610   db eval {
   2611     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2612      WHERE t2.a=44
   2613      ORDER BY t1.rowid
   2614   }
   2615 } {58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2616 do_test boundary3-2.14.gt.4 {
   2617   db eval {
   2618     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2619      WHERE t2.a=44
   2620      ORDER BY t1.rowid DESC
   2621   }
   2622 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58}
   2623 do_test boundary3-2.14.gt.5 {
   2624   db eval {
   2625     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2626      WHERE t2.a=44
   2627      ORDER BY x
   2628   }
   2629 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2630 do_test boundary3-2.14.ge.1 {
   2631   db eval {
   2632     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2633      WHERE t1.rowid >= -140737488355328 ORDER BY t2.a
   2634   }
   2635 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63}
   2636 do_test boundary3-2.14.ge.2 {
   2637   db eval {
   2638     SELECT t2.a FROM t2 NATURAL JOIN t1
   2639      WHERE t1.rowid >= -140737488355328 ORDER BY t1.a DESC
   2640   }
   2641 } {63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   2642 do_test boundary3-2.14.ge.3 {
   2643   db eval {
   2644     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2645      WHERE t2.a=44
   2646      ORDER BY t1.rowid
   2647   }
   2648 } {44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2649 do_test boundary3-2.14.ge.4 {
   2650   db eval {
   2651     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2652      WHERE t2.a=44
   2653      ORDER BY t1.rowid DESC
   2654   }
   2655 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44}
   2656 do_test boundary3-2.14.ge.5 {
   2657   db eval {
   2658     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2659      WHERE t2.a=44
   2660      ORDER BY x
   2661   }
   2662 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2663 do_test boundary3-2.14.lt.1 {
   2664   db eval {
   2665     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2666      WHERE t1.rowid < -140737488355328 ORDER BY t2.a
   2667   }
   2668 } {2 21 55 64}
   2669 do_test boundary3-2.14.lt.2 {
   2670   db eval {
   2671     SELECT t2.a FROM t2 NATURAL JOIN t1
   2672      WHERE t1.rowid < -140737488355328 ORDER BY t1.a DESC
   2673   }
   2674 } {64 55 21 2}
   2675 do_test boundary3-2.14.lt.3 {
   2676   db eval {
   2677     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2678      WHERE t2.a=44
   2679      ORDER BY t1.rowid
   2680   }
   2681 } {55 2 64 21}
   2682 do_test boundary3-2.14.lt.4 {
   2683   db eval {
   2684     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2685      WHERE t2.a=44
   2686      ORDER BY t1.rowid DESC
   2687   }
   2688 } {21 64 2 55}
   2689 do_test boundary3-2.14.lt.5 {
   2690   db eval {
   2691     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2692      WHERE t2.a=44
   2693      ORDER BY x
   2694   }
   2695 } {55 2 64 21}
   2696 do_test boundary3-2.14.le.1 {
   2697   db eval {
   2698     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2699      WHERE t1.rowid <= -140737488355328 ORDER BY t2.a
   2700   }
   2701 } {2 21 44 55 64}
   2702 do_test boundary3-2.14.le.2 {
   2703   db eval {
   2704     SELECT t2.a FROM t2 NATURAL JOIN t1
   2705      WHERE t1.rowid <= -140737488355328 ORDER BY t1.a DESC
   2706   }
   2707 } {64 55 44 21 2}
   2708 do_test boundary3-2.14.le.3 {
   2709   db eval {
   2710     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2711      WHERE t2.a=44
   2712      ORDER BY t1.rowid
   2713   }
   2714 } {55 2 64 21 44}
   2715 do_test boundary3-2.14.le.4 {
   2716   db eval {
   2717     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2718      WHERE t2.a=44
   2719      ORDER BY t1.rowid DESC
   2720   }
   2721 } {44 21 64 2 55}
   2722 do_test boundary3-2.14.le.5 {
   2723   db eval {
   2724     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2725      WHERE t2.a=44
   2726      ORDER BY x
   2727   }
   2728 } {55 2 64 21 44}
   2729 do_test boundary3-2.15.1 {
   2730   db eval {
   2731     SELECT t1.* FROM t1, t2 WHERE t1.rowid=1099511627776 AND t2.a=t1.a
   2732   }
   2733 } {19 0000010000000000}
   2734 do_test boundary3-2.15.2 {
   2735   db eval {
   2736     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000010000000000'
   2737   }
   2738 } {1099511627776 19}
   2739 do_test boundary3-2.15.3 {
   2740   db eval {
   2741     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=19
   2742   }
   2743 } {1099511627776 0000010000000000}
   2744 do_test boundary3-2.15.gt.1 {
   2745   db eval {
   2746     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2747      WHERE t1.rowid > 1099511627776 ORDER BY t2.a
   2748   }
   2749 } {3 7 10 13 17 25 26 27 28 34 43 45 56}
   2750 do_test boundary3-2.15.gt.2 {
   2751   db eval {
   2752     SELECT t2.a FROM t2 NATURAL JOIN t1
   2753      WHERE t1.rowid > 1099511627776 ORDER BY t1.a DESC
   2754   }
   2755 } {56 45 43 34 28 27 26 25 17 13 10 7 3}
   2756 do_test boundary3-2.15.gt.3 {
   2757   db eval {
   2758     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2759      WHERE t2.a=19
   2760      ORDER BY t1.rowid
   2761   }
   2762 } {7 56 25 34 10 26 13 43 27 45 17 28 3}
   2763 do_test boundary3-2.15.gt.4 {
   2764   db eval {
   2765     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2766      WHERE t2.a=19
   2767      ORDER BY t1.rowid DESC
   2768   }
   2769 } {3 28 17 45 27 43 13 26 10 34 25 56 7}
   2770 do_test boundary3-2.15.gt.5 {
   2771   db eval {
   2772     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2773      WHERE t2.a=19
   2774      ORDER BY x
   2775   }
   2776 } {7 56 25 34 10 26 13 43 27 45 17 28 3}
   2777 do_test boundary3-2.15.gt.10 {
   2778   db eval {
   2779     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2780      WHERE t2.a=19
   2781      ORDER BY t1.rowid
   2782   }
   2783 } {7 56 25 34 10 26 13 43 27 45 17 28 3}
   2784 do_test boundary3-2.15.gt.11 {
   2785   db eval {
   2786     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   2787      WHERE t2.a=19
   2788      ORDER BY t1.rowid DESC
   2789   }
   2790 } {3 28 17 45 27 43 13 26 10 34 25 56 7}
   2791 do_test boundary3-2.15.ge.1 {
   2792   db eval {
   2793     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2794      WHERE t1.rowid >= 1099511627776 ORDER BY t2.a
   2795   }
   2796 } {3 7 10 13 17 19 25 26 27 28 34 43 45 56}
   2797 do_test boundary3-2.15.ge.2 {
   2798   db eval {
   2799     SELECT t2.a FROM t2 NATURAL JOIN t1
   2800      WHERE t1.rowid >= 1099511627776 ORDER BY t1.a DESC
   2801   }
   2802 } {56 45 43 34 28 27 26 25 19 17 13 10 7 3}
   2803 do_test boundary3-2.15.ge.3 {
   2804   db eval {
   2805     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2806      WHERE t2.a=19
   2807      ORDER BY t1.rowid
   2808   }
   2809 } {19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2810 do_test boundary3-2.15.ge.4 {
   2811   db eval {
   2812     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2813      WHERE t2.a=19
   2814      ORDER BY t1.rowid DESC
   2815   }
   2816 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19}
   2817 do_test boundary3-2.15.ge.5 {
   2818   db eval {
   2819     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2820      WHERE t2.a=19
   2821      ORDER BY x
   2822   }
   2823 } {19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2824 do_test boundary3-2.15.ge.10 {
   2825   db eval {
   2826     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2827      WHERE t2.a=19
   2828      ORDER BY t1.rowid
   2829   }
   2830 } {19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   2831 do_test boundary3-2.15.ge.11 {
   2832   db eval {
   2833     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   2834      WHERE t2.a=19
   2835      ORDER BY t1.rowid DESC
   2836   }
   2837 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19}
   2838 do_test boundary3-2.15.lt.1 {
   2839   db eval {
   2840     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2841      WHERE t1.rowid < 1099511627776 ORDER BY t2.a
   2842   }
   2843 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64}
   2844 do_test boundary3-2.15.lt.2 {
   2845   db eval {
   2846     SELECT t2.a FROM t2 NATURAL JOIN t1
   2847      WHERE t1.rowid < 1099511627776 ORDER BY t1.a DESC
   2848   }
   2849 } {64 63 62 61 60 59 58 57 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   2850 do_test boundary3-2.15.lt.3 {
   2851   db eval {
   2852     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2853      WHERE t2.a=19
   2854      ORDER BY t1.rowid
   2855   }
   2856 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57}
   2857 do_test boundary3-2.15.lt.4 {
   2858   db eval {
   2859     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2860      WHERE t2.a=19
   2861      ORDER BY t1.rowid DESC
   2862   }
   2863 } {57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2864 do_test boundary3-2.15.lt.5 {
   2865   db eval {
   2866     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   2867      WHERE t2.a=19
   2868      ORDER BY x
   2869   }
   2870 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2871 do_test boundary3-2.15.lt.10 {
   2872   db eval {
   2873     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2874      WHERE t2.a=19
   2875      ORDER BY t1.rowid
   2876   }
   2877 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57}
   2878 do_test boundary3-2.15.lt.11 {
   2879   db eval {
   2880     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   2881      WHERE t2.a=19
   2882      ORDER BY t1.rowid DESC
   2883   }
   2884 } {57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2885 do_test boundary3-2.15.le.1 {
   2886   db eval {
   2887     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2888      WHERE t1.rowid <= 1099511627776 ORDER BY t2.a
   2889   }
   2890 } {1 2 4 5 6 8 9 11 12 14 15 16 18 19 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64}
   2891 do_test boundary3-2.15.le.2 {
   2892   db eval {
   2893     SELECT t2.a FROM t2 NATURAL JOIN t1
   2894      WHERE t1.rowid <= 1099511627776 ORDER BY t1.a DESC
   2895   }
   2896 } {64 63 62 61 60 59 58 57 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 19 18 16 15 14 12 11 9 8 6 5 4 2 1}
   2897 do_test boundary3-2.15.le.3 {
   2898   db eval {
   2899     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2900      WHERE t2.a=19
   2901      ORDER BY t1.rowid
   2902   }
   2903 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19}
   2904 do_test boundary3-2.15.le.4 {
   2905   db eval {
   2906     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2907      WHERE t2.a=19
   2908      ORDER BY t1.rowid DESC
   2909   }
   2910 } {19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2911 do_test boundary3-2.15.le.5 {
   2912   db eval {
   2913     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   2914      WHERE t2.a=19
   2915      ORDER BY x
   2916   }
   2917 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   2918 do_test boundary3-2.15.le.10 {
   2919   db eval {
   2920     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2921      WHERE t2.a=19
   2922      ORDER BY t1.rowid
   2923   }
   2924 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19}
   2925 do_test boundary3-2.15.le.11 {
   2926   db eval {
   2927     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   2928      WHERE t2.a=19
   2929      ORDER BY t1.rowid DESC
   2930   }
   2931 } {19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   2932 do_test boundary3-2.16.gt.1 {
   2933   db eval {
   2934     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2935      WHERE t1.rowid > 9223372036854775807 ORDER BY t2.a
   2936   }
   2937 } {}
   2938 do_test boundary3-2.16.gt.2 {
   2939   db eval {
   2940     SELECT t2.a FROM t2 NATURAL JOIN t1
   2941      WHERE t1.rowid > 9223372036854775807 ORDER BY t1.a DESC
   2942   }
   2943 } {}
   2944 do_test boundary3-2.16.gt.3 {
   2945   db eval {
   2946     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2947      WHERE t2.a=3
   2948      ORDER BY t1.rowid
   2949   }
   2950 } {}
   2951 do_test boundary3-2.16.gt.4 {
   2952   db eval {
   2953     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2954      WHERE t2.a=3
   2955      ORDER BY t1.rowid DESC
   2956   }
   2957 } {}
   2958 do_test boundary3-2.16.gt.5 {
   2959   db eval {
   2960     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   2961      WHERE t2.a=3
   2962      ORDER BY x
   2963   }
   2964 } {}
   2965 do_test boundary3-2.16.ge.1 {
   2966   db eval {
   2967     SELECT t2.a FROM t1 JOIN t2 USING(a)
   2968      WHERE t1.rowid >= 9223372036854775807 ORDER BY t2.a
   2969   }
   2970 } {3}
   2971 do_test boundary3-2.16.ge.2 {
   2972   db eval {
   2973     SELECT t2.a FROM t2 NATURAL JOIN t1
   2974      WHERE t1.rowid >= 9223372036854775807 ORDER BY t1.a DESC
   2975   }
   2976 } {3}
   2977 do_test boundary3-2.16.ge.3 {
   2978   db eval {
   2979     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2980      WHERE t2.a=3
   2981      ORDER BY t1.rowid
   2982   }
   2983 } {3}
   2984 do_test boundary3-2.16.ge.4 {
   2985   db eval {
   2986     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2987      WHERE t2.a=3
   2988      ORDER BY t1.rowid DESC
   2989   }
   2990 } {3}
   2991 do_test boundary3-2.16.ge.5 {
   2992   db eval {
   2993     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   2994      WHERE t2.a=3
   2995      ORDER BY x
   2996   }
   2997 } {3}
   2998 do_test boundary3-2.16.lt.1 {
   2999   db eval {
   3000     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3001      WHERE t1.rowid < 9223372036854775807 ORDER BY t2.a
   3002   }
   3003 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   3004 do_test boundary3-2.16.lt.2 {
   3005   db eval {
   3006     SELECT t2.a FROM t2 NATURAL JOIN t1
   3007      WHERE t1.rowid < 9223372036854775807 ORDER BY t1.a DESC
   3008   }
   3009 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   3010 do_test boundary3-2.16.lt.3 {
   3011   db eval {
   3012     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3013      WHERE t2.a=3
   3014      ORDER BY t1.rowid
   3015   }
   3016 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28}
   3017 do_test boundary3-2.16.lt.4 {
   3018   db eval {
   3019     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3020      WHERE t2.a=3
   3021      ORDER BY t1.rowid DESC
   3022   }
   3023 } {28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3024 do_test boundary3-2.16.lt.5 {
   3025   db eval {
   3026     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3027      WHERE t2.a=3
   3028      ORDER BY x
   3029   }
   3030 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3031 do_test boundary3-2.16.le.1 {
   3032   db eval {
   3033     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3034      WHERE t1.rowid <= 9223372036854775807 ORDER BY t2.a
   3035   }
   3036 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   3037 do_test boundary3-2.16.le.2 {
   3038   db eval {
   3039     SELECT t2.a FROM t2 NATURAL JOIN t1
   3040      WHERE t1.rowid <= 9223372036854775807 ORDER BY t1.a DESC
   3041   }
   3042 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   3043 do_test boundary3-2.16.le.3 {
   3044   db eval {
   3045     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3046      WHERE t2.a=3
   3047      ORDER BY t1.rowid
   3048   }
   3049 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3050 do_test boundary3-2.16.le.4 {
   3051   db eval {
   3052     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3053      WHERE t2.a=3
   3054      ORDER BY t1.rowid DESC
   3055   }
   3056 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3057 do_test boundary3-2.16.le.5 {
   3058   db eval {
   3059     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3060      WHERE t2.a=3
   3061      ORDER BY x
   3062   }
   3063 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3064 do_test boundary3-2.17.1 {
   3065   db eval {
   3066     SELECT t1.* FROM t1, t2 WHERE t1.rowid=32768 AND t2.a=t1.a
   3067   }
   3068 } {50 0000000000008000}
   3069 do_test boundary3-2.17.2 {
   3070   db eval {
   3071     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000008000'
   3072   }
   3073 } {32768 50}
   3074 do_test boundary3-2.17.3 {
   3075   db eval {
   3076     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=50
   3077   }
   3078 } {32768 0000000000008000}
   3079 do_test boundary3-2.17.gt.1 {
   3080   db eval {
   3081     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3082      WHERE t1.rowid > 32768 ORDER BY t2.a
   3083   }
   3084 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 51 56 57 62}
   3085 do_test boundary3-2.17.gt.2 {
   3086   db eval {
   3087     SELECT t2.a FROM t2 NATURAL JOIN t1
   3088      WHERE t1.rowid > 32768 ORDER BY t1.a DESC
   3089   }
   3090 } {62 57 56 51 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   3091 do_test boundary3-2.17.gt.3 {
   3092   db eval {
   3093     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3094      WHERE t2.a=50
   3095      ORDER BY t1.rowid
   3096   }
   3097 } {48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3098 do_test boundary3-2.17.gt.4 {
   3099   db eval {
   3100     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3101      WHERE t2.a=50
   3102      ORDER BY t1.rowid DESC
   3103   }
   3104 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48}
   3105 do_test boundary3-2.17.gt.5 {
   3106   db eval {
   3107     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3108      WHERE t2.a=50
   3109      ORDER BY x
   3110   }
   3111 } {48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3112 do_test boundary3-2.17.gt.10 {
   3113   db eval {
   3114     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3115      WHERE t2.a=50
   3116      ORDER BY t1.rowid
   3117   }
   3118 } {48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3119 do_test boundary3-2.17.gt.11 {
   3120   db eval {
   3121     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3122      WHERE t2.a=50
   3123      ORDER BY t1.rowid DESC
   3124   }
   3125 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48}
   3126 do_test boundary3-2.17.ge.1 {
   3127   db eval {
   3128     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3129      WHERE t1.rowid >= 32768 ORDER BY t2.a
   3130   }
   3131 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
   3132 do_test boundary3-2.17.ge.2 {
   3133   db eval {
   3134     SELECT t2.a FROM t2 NATURAL JOIN t1
   3135      WHERE t1.rowid >= 32768 ORDER BY t1.a DESC
   3136   }
   3137 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   3138 do_test boundary3-2.17.ge.3 {
   3139   db eval {
   3140     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3141      WHERE t2.a=50
   3142      ORDER BY t1.rowid
   3143   }
   3144 } {50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3145 do_test boundary3-2.17.ge.4 {
   3146   db eval {
   3147     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3148      WHERE t2.a=50
   3149      ORDER BY t1.rowid DESC
   3150   }
   3151 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50}
   3152 do_test boundary3-2.17.ge.5 {
   3153   db eval {
   3154     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3155      WHERE t2.a=50
   3156      ORDER BY x
   3157   }
   3158 } {50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3159 do_test boundary3-2.17.ge.10 {
   3160   db eval {
   3161     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3162      WHERE t2.a=50
   3163      ORDER BY t1.rowid
   3164   }
   3165 } {50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3166 do_test boundary3-2.17.ge.11 {
   3167   db eval {
   3168     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3169      WHERE t2.a=50
   3170      ORDER BY t1.rowid DESC
   3171   }
   3172 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50}
   3173 do_test boundary3-2.17.lt.1 {
   3174   db eval {
   3175     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3176      WHERE t1.rowid < 32768 ORDER BY t2.a
   3177   }
   3178 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
   3179 do_test boundary3-2.17.lt.2 {
   3180   db eval {
   3181     SELECT t2.a FROM t2 NATURAL JOIN t1
   3182      WHERE t1.rowid < 32768 ORDER BY t1.a DESC
   3183   }
   3184 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   3185 do_test boundary3-2.17.lt.3 {
   3186   db eval {
   3187     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3188      WHERE t2.a=50
   3189      ORDER BY t1.rowid
   3190   }
   3191 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23}
   3192 do_test boundary3-2.17.lt.4 {
   3193   db eval {
   3194     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3195      WHERE t2.a=50
   3196      ORDER BY t1.rowid DESC
   3197   }
   3198 } {23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3199 do_test boundary3-2.17.lt.5 {
   3200   db eval {
   3201     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3202      WHERE t2.a=50
   3203      ORDER BY x
   3204   }
   3205 } {59 60 41 5 31 4 49 30 61 8 16 23 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3206 do_test boundary3-2.17.lt.10 {
   3207   db eval {
   3208     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3209      WHERE t2.a=50
   3210      ORDER BY t1.rowid
   3211   }
   3212 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23}
   3213 do_test boundary3-2.17.lt.11 {
   3214   db eval {
   3215     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3216      WHERE t2.a=50
   3217      ORDER BY t1.rowid DESC
   3218   }
   3219 } {23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3220 do_test boundary3-2.17.le.1 {
   3221   db eval {
   3222     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3223      WHERE t1.rowid <= 32768 ORDER BY t2.a
   3224   }
   3225 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 49 50 52 53 54 55 58 59 60 61 63 64}
   3226 do_test boundary3-2.17.le.2 {
   3227   db eval {
   3228     SELECT t2.a FROM t2 NATURAL JOIN t1
   3229      WHERE t1.rowid <= 32768 ORDER BY t1.a DESC
   3230   }
   3231 } {64 63 61 60 59 58 55 54 53 52 50 49 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   3232 do_test boundary3-2.17.le.3 {
   3233   db eval {
   3234     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3235      WHERE t2.a=50
   3236      ORDER BY t1.rowid
   3237   }
   3238 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50}
   3239 do_test boundary3-2.17.le.4 {
   3240   db eval {
   3241     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3242      WHERE t2.a=50
   3243      ORDER BY t1.rowid DESC
   3244   }
   3245 } {50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3246 do_test boundary3-2.17.le.5 {
   3247   db eval {
   3248     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3249      WHERE t2.a=50
   3250      ORDER BY x
   3251   }
   3252 } {59 60 41 5 31 4 49 30 61 8 16 23 50 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3253 do_test boundary3-2.17.le.10 {
   3254   db eval {
   3255     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   3256      WHERE t2.a=50
   3257      ORDER BY t1.rowid
   3258   }
   3259 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50}
   3260 do_test boundary3-2.17.le.11 {
   3261   db eval {
   3262     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   3263      WHERE t2.a=50
   3264      ORDER BY t1.rowid DESC
   3265   }
   3266 } {50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3267 do_test boundary3-2.18.1 {
   3268   db eval {
   3269     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-36028797018963968 AND t2.a=t1.a
   3270   }
   3271 } {64 ff80000000000000}
   3272 do_test boundary3-2.18.2 {
   3273   db eval {
   3274     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ff80000000000000'
   3275   }
   3276 } {-36028797018963968 64}
   3277 do_test boundary3-2.18.3 {
   3278   db eval {
   3279     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=64
   3280   }
   3281 } {-36028797018963968 ff80000000000000}
   3282 do_test boundary3-2.18.gt.1 {
   3283   db eval {
   3284     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3285      WHERE t1.rowid > -36028797018963968 ORDER BY t2.a
   3286   }
   3287 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63}
   3288 do_test boundary3-2.18.gt.2 {
   3289   db eval {
   3290     SELECT t2.a FROM t2 NATURAL JOIN t1
   3291      WHERE t1.rowid > -36028797018963968 ORDER BY t1.a DESC
   3292   }
   3293 } {63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   3294 do_test boundary3-2.18.gt.3 {
   3295   db eval {
   3296     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3297      WHERE t2.a=64
   3298      ORDER BY t1.rowid
   3299   }
   3300 } {21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3301 do_test boundary3-2.18.gt.4 {
   3302   db eval {
   3303     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3304      WHERE t2.a=64
   3305      ORDER BY t1.rowid DESC
   3306   }
   3307 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21}
   3308 do_test boundary3-2.18.gt.5 {
   3309   db eval {
   3310     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3311      WHERE t2.a=64
   3312      ORDER BY x
   3313   }
   3314 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3315 do_test boundary3-2.18.ge.1 {
   3316   db eval {
   3317     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3318      WHERE t1.rowid >= -36028797018963968 ORDER BY t2.a
   3319   }
   3320 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64}
   3321 do_test boundary3-2.18.ge.2 {
   3322   db eval {
   3323     SELECT t2.a FROM t2 NATURAL JOIN t1
   3324      WHERE t1.rowid >= -36028797018963968 ORDER BY t1.a DESC
   3325   }
   3326 } {64 63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   3327 do_test boundary3-2.18.ge.3 {
   3328   db eval {
   3329     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3330      WHERE t2.a=64
   3331      ORDER BY t1.rowid
   3332   }
   3333 } {64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3334 do_test boundary3-2.18.ge.4 {
   3335   db eval {
   3336     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3337      WHERE t2.a=64
   3338      ORDER BY t1.rowid DESC
   3339   }
   3340 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64}
   3341 do_test boundary3-2.18.ge.5 {
   3342   db eval {
   3343     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3344      WHERE t2.a=64
   3345      ORDER BY x
   3346   }
   3347 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3348 do_test boundary3-2.18.lt.1 {
   3349   db eval {
   3350     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3351      WHERE t1.rowid < -36028797018963968 ORDER BY t2.a
   3352   }
   3353 } {2 55}
   3354 do_test boundary3-2.18.lt.2 {
   3355   db eval {
   3356     SELECT t2.a FROM t2 NATURAL JOIN t1
   3357      WHERE t1.rowid < -36028797018963968 ORDER BY t1.a DESC
   3358   }
   3359 } {55 2}
   3360 do_test boundary3-2.18.lt.3 {
   3361   db eval {
   3362     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3363      WHERE t2.a=64
   3364      ORDER BY t1.rowid
   3365   }
   3366 } {55 2}
   3367 do_test boundary3-2.18.lt.4 {
   3368   db eval {
   3369     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3370      WHERE t2.a=64
   3371      ORDER BY t1.rowid DESC
   3372   }
   3373 } {2 55}
   3374 do_test boundary3-2.18.lt.5 {
   3375   db eval {
   3376     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3377      WHERE t2.a=64
   3378      ORDER BY x
   3379   }
   3380 } {55 2}
   3381 do_test boundary3-2.18.le.1 {
   3382   db eval {
   3383     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3384      WHERE t1.rowid <= -36028797018963968 ORDER BY t2.a
   3385   }
   3386 } {2 55 64}
   3387 do_test boundary3-2.18.le.2 {
   3388   db eval {
   3389     SELECT t2.a FROM t2 NATURAL JOIN t1
   3390      WHERE t1.rowid <= -36028797018963968 ORDER BY t1.a DESC
   3391   }
   3392 } {64 55 2}
   3393 do_test boundary3-2.18.le.3 {
   3394   db eval {
   3395     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3396      WHERE t2.a=64
   3397      ORDER BY t1.rowid
   3398   }
   3399 } {55 2 64}
   3400 do_test boundary3-2.18.le.4 {
   3401   db eval {
   3402     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3403      WHERE t2.a=64
   3404      ORDER BY t1.rowid DESC
   3405   }
   3406 } {64 2 55}
   3407 do_test boundary3-2.18.le.5 {
   3408   db eval {
   3409     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3410      WHERE t2.a=64
   3411      ORDER BY x
   3412   }
   3413 } {55 2 64}
   3414 do_test boundary3-2.19.1 {
   3415   db eval {
   3416     SELECT t1.* FROM t1, t2 WHERE t1.rowid=65535 AND t2.a=t1.a
   3417   }
   3418 } {48 000000000000ffff}
   3419 do_test boundary3-2.19.2 {
   3420   db eval {
   3421     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='000000000000ffff'
   3422   }
   3423 } {65535 48}
   3424 do_test boundary3-2.19.3 {
   3425   db eval {
   3426     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=48
   3427   }
   3428 } {65535 000000000000ffff}
   3429 do_test boundary3-2.19.gt.1 {
   3430   db eval {
   3431     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3432      WHERE t1.rowid > 65535 ORDER BY t2.a
   3433   }
   3434 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 51 56 57 62}
   3435 do_test boundary3-2.19.gt.2 {
   3436   db eval {
   3437     SELECT t2.a FROM t2 NATURAL JOIN t1
   3438      WHERE t1.rowid > 65535 ORDER BY t1.a DESC
   3439   }
   3440 } {62 57 56 51 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   3441 do_test boundary3-2.19.gt.3 {
   3442   db eval {
   3443     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3444      WHERE t2.a=48
   3445      ORDER BY t1.rowid
   3446   }
   3447 } {62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3448 do_test boundary3-2.19.gt.4 {
   3449   db eval {
   3450     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3451      WHERE t2.a=48
   3452      ORDER BY t1.rowid DESC
   3453   }
   3454 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62}
   3455 do_test boundary3-2.19.gt.5 {
   3456   db eval {
   3457     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3458      WHERE t2.a=48
   3459      ORDER BY x
   3460   }
   3461 } {62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3462 do_test boundary3-2.19.gt.10 {
   3463   db eval {
   3464     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3465      WHERE t2.a=48
   3466      ORDER BY t1.rowid
   3467   }
   3468 } {62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3469 do_test boundary3-2.19.gt.11 {
   3470   db eval {
   3471     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3472      WHERE t2.a=48
   3473      ORDER BY t1.rowid DESC
   3474   }
   3475 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62}
   3476 do_test boundary3-2.19.ge.1 {
   3477   db eval {
   3478     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3479      WHERE t1.rowid >= 65535 ORDER BY t2.a
   3480   }
   3481 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 51 56 57 62}
   3482 do_test boundary3-2.19.ge.2 {
   3483   db eval {
   3484     SELECT t2.a FROM t2 NATURAL JOIN t1
   3485      WHERE t1.rowid >= 65535 ORDER BY t1.a DESC
   3486   }
   3487 } {62 57 56 51 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   3488 do_test boundary3-2.19.ge.3 {
   3489   db eval {
   3490     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3491      WHERE t2.a=48
   3492      ORDER BY t1.rowid
   3493   }
   3494 } {48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3495 do_test boundary3-2.19.ge.4 {
   3496   db eval {
   3497     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3498      WHERE t2.a=48
   3499      ORDER BY t1.rowid DESC
   3500   }
   3501 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48}
   3502 do_test boundary3-2.19.ge.5 {
   3503   db eval {
   3504     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3505      WHERE t2.a=48
   3506      ORDER BY x
   3507   }
   3508 } {48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3509 do_test boundary3-2.19.ge.10 {
   3510   db eval {
   3511     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3512      WHERE t2.a=48
   3513      ORDER BY t1.rowid
   3514   }
   3515 } {48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3516 do_test boundary3-2.19.ge.11 {
   3517   db eval {
   3518     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3519      WHERE t2.a=48
   3520      ORDER BY t1.rowid DESC
   3521   }
   3522 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48}
   3523 do_test boundary3-2.19.lt.1 {
   3524   db eval {
   3525     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3526      WHERE t1.rowid < 65535 ORDER BY t2.a
   3527   }
   3528 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 49 50 52 53 54 55 58 59 60 61 63 64}
   3529 do_test boundary3-2.19.lt.2 {
   3530   db eval {
   3531     SELECT t2.a FROM t2 NATURAL JOIN t1
   3532      WHERE t1.rowid < 65535 ORDER BY t1.a DESC
   3533   }
   3534 } {64 63 61 60 59 58 55 54 53 52 50 49 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   3535 do_test boundary3-2.19.lt.3 {
   3536   db eval {
   3537     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3538      WHERE t2.a=48
   3539      ORDER BY t1.rowid
   3540   }
   3541 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50}
   3542 do_test boundary3-2.19.lt.4 {
   3543   db eval {
   3544     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3545      WHERE t2.a=48
   3546      ORDER BY t1.rowid DESC
   3547   }
   3548 } {50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3549 do_test boundary3-2.19.lt.5 {
   3550   db eval {
   3551     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3552      WHERE t2.a=48
   3553      ORDER BY x
   3554   }
   3555 } {59 60 41 5 31 4 49 30 61 8 16 23 50 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3556 do_test boundary3-2.19.lt.10 {
   3557   db eval {
   3558     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3559      WHERE t2.a=48
   3560      ORDER BY t1.rowid
   3561   }
   3562 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50}
   3563 do_test boundary3-2.19.lt.11 {
   3564   db eval {
   3565     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3566      WHERE t2.a=48
   3567      ORDER BY t1.rowid DESC
   3568   }
   3569 } {50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3570 do_test boundary3-2.19.le.1 {
   3571   db eval {
   3572     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3573      WHERE t1.rowid <= 65535 ORDER BY t2.a
   3574   }
   3575 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 48 49 50 52 53 54 55 58 59 60 61 63 64}
   3576 do_test boundary3-2.19.le.2 {
   3577   db eval {
   3578     SELECT t2.a FROM t2 NATURAL JOIN t1
   3579      WHERE t1.rowid <= 65535 ORDER BY t1.a DESC
   3580   }
   3581 } {64 63 61 60 59 58 55 54 53 52 50 49 48 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   3582 do_test boundary3-2.19.le.3 {
   3583   db eval {
   3584     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3585      WHERE t2.a=48
   3586      ORDER BY t1.rowid
   3587   }
   3588 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48}
   3589 do_test boundary3-2.19.le.4 {
   3590   db eval {
   3591     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3592      WHERE t2.a=48
   3593      ORDER BY t1.rowid DESC
   3594   }
   3595 } {48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3596 do_test boundary3-2.19.le.5 {
   3597   db eval {
   3598     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3599      WHERE t2.a=48
   3600      ORDER BY x
   3601   }
   3602 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3603 do_test boundary3-2.19.le.10 {
   3604   db eval {
   3605     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   3606      WHERE t2.a=48
   3607      ORDER BY t1.rowid
   3608   }
   3609 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48}
   3610 do_test boundary3-2.19.le.11 {
   3611   db eval {
   3612     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   3613      WHERE t2.a=48
   3614      ORDER BY t1.rowid DESC
   3615   }
   3616 } {48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3617 do_test boundary3-2.20.1 {
   3618   db eval {
   3619     SELECT t1.* FROM t1, t2 WHERE t1.rowid=4294967295 AND t2.a=t1.a
   3620   }
   3621 } {14 00000000ffffffff}
   3622 do_test boundary3-2.20.2 {
   3623   db eval {
   3624     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00000000ffffffff'
   3625   }
   3626 } {4294967295 14}
   3627 do_test boundary3-2.20.3 {
   3628   db eval {
   3629     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=14
   3630   }
   3631 } {4294967295 00000000ffffffff}
   3632 do_test boundary3-2.20.gt.1 {
   3633   db eval {
   3634     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3635      WHERE t1.rowid > 4294967295 ORDER BY t2.a
   3636   }
   3637 } {3 7 10 13 17 19 22 25 26 27 28 34 35 36 39 43 45 46 56 57}
   3638 do_test boundary3-2.20.gt.2 {
   3639   db eval {
   3640     SELECT t2.a FROM t2 NATURAL JOIN t1
   3641      WHERE t1.rowid > 4294967295 ORDER BY t1.a DESC
   3642   }
   3643 } {57 56 46 45 43 39 36 35 34 28 27 26 25 22 19 17 13 10 7 3}
   3644 do_test boundary3-2.20.gt.3 {
   3645   db eval {
   3646     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3647      WHERE t2.a=14
   3648      ORDER BY t1.rowid
   3649   }
   3650 } {36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3651 do_test boundary3-2.20.gt.4 {
   3652   db eval {
   3653     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3654      WHERE t2.a=14
   3655      ORDER BY t1.rowid DESC
   3656   }
   3657 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36}
   3658 do_test boundary3-2.20.gt.5 {
   3659   db eval {
   3660     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3661      WHERE t2.a=14
   3662      ORDER BY x
   3663   }
   3664 } {36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3665 do_test boundary3-2.20.gt.10 {
   3666   db eval {
   3667     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3668      WHERE t2.a=14
   3669      ORDER BY t1.rowid
   3670   }
   3671 } {36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3672 do_test boundary3-2.20.gt.11 {
   3673   db eval {
   3674     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3675      WHERE t2.a=14
   3676      ORDER BY t1.rowid DESC
   3677   }
   3678 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36}
   3679 do_test boundary3-2.20.ge.1 {
   3680   db eval {
   3681     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3682      WHERE t1.rowid >= 4294967295 ORDER BY t2.a
   3683   }
   3684 } {3 7 10 13 14 17 19 22 25 26 27 28 34 35 36 39 43 45 46 56 57}
   3685 do_test boundary3-2.20.ge.2 {
   3686   db eval {
   3687     SELECT t2.a FROM t2 NATURAL JOIN t1
   3688      WHERE t1.rowid >= 4294967295 ORDER BY t1.a DESC
   3689   }
   3690 } {57 56 46 45 43 39 36 35 34 28 27 26 25 22 19 17 14 13 10 7 3}
   3691 do_test boundary3-2.20.ge.3 {
   3692   db eval {
   3693     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3694      WHERE t2.a=14
   3695      ORDER BY t1.rowid
   3696   }
   3697 } {14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3698 do_test boundary3-2.20.ge.4 {
   3699   db eval {
   3700     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3701      WHERE t2.a=14
   3702      ORDER BY t1.rowid DESC
   3703   }
   3704 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14}
   3705 do_test boundary3-2.20.ge.5 {
   3706   db eval {
   3707     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3708      WHERE t2.a=14
   3709      ORDER BY x
   3710   }
   3711 } {14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3712 do_test boundary3-2.20.ge.10 {
   3713   db eval {
   3714     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3715      WHERE t2.a=14
   3716      ORDER BY t1.rowid
   3717   }
   3718 } {14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3719 do_test boundary3-2.20.ge.11 {
   3720   db eval {
   3721     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3722      WHERE t2.a=14
   3723      ORDER BY t1.rowid DESC
   3724   }
   3725 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14}
   3726 do_test boundary3-2.20.lt.1 {
   3727   db eval {
   3728     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3729      WHERE t1.rowid < 4294967295 ORDER BY t2.a
   3730   }
   3731 } {1 2 4 5 6 8 9 11 12 15 16 18 20 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   3732 do_test boundary3-2.20.lt.2 {
   3733   db eval {
   3734     SELECT t2.a FROM t2 NATURAL JOIN t1
   3735      WHERE t1.rowid < 4294967295 ORDER BY t1.a DESC
   3736   }
   3737 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 20 18 16 15 12 11 9 8 6 5 4 2 1}
   3738 do_test boundary3-2.20.lt.3 {
   3739   db eval {
   3740     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3741      WHERE t2.a=14
   3742      ORDER BY t1.rowid
   3743   }
   3744 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51}
   3745 do_test boundary3-2.20.lt.4 {
   3746   db eval {
   3747     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3748      WHERE t2.a=14
   3749      ORDER BY t1.rowid DESC
   3750   }
   3751 } {51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3752 do_test boundary3-2.20.lt.5 {
   3753   db eval {
   3754     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3755      WHERE t2.a=14
   3756      ORDER BY x
   3757   }
   3758 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3759 do_test boundary3-2.20.lt.10 {
   3760   db eval {
   3761     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3762      WHERE t2.a=14
   3763      ORDER BY t1.rowid
   3764   }
   3765 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51}
   3766 do_test boundary3-2.20.lt.11 {
   3767   db eval {
   3768     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3769      WHERE t2.a=14
   3770      ORDER BY t1.rowid DESC
   3771   }
   3772 } {51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3773 do_test boundary3-2.20.le.1 {
   3774   db eval {
   3775     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3776      WHERE t1.rowid <= 4294967295 ORDER BY t2.a
   3777   }
   3778 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   3779 do_test boundary3-2.20.le.2 {
   3780   db eval {
   3781     SELECT t2.a FROM t2 NATURAL JOIN t1
   3782      WHERE t1.rowid <= 4294967295 ORDER BY t1.a DESC
   3783   }
   3784 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   3785 do_test boundary3-2.20.le.3 {
   3786   db eval {
   3787     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3788      WHERE t2.a=14
   3789      ORDER BY t1.rowid
   3790   }
   3791 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14}
   3792 do_test boundary3-2.20.le.4 {
   3793   db eval {
   3794     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3795      WHERE t2.a=14
   3796      ORDER BY t1.rowid DESC
   3797   }
   3798 } {14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3799 do_test boundary3-2.20.le.5 {
   3800   db eval {
   3801     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3802      WHERE t2.a=14
   3803      ORDER BY x
   3804   }
   3805 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3806 do_test boundary3-2.20.le.10 {
   3807   db eval {
   3808     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   3809      WHERE t2.a=14
   3810      ORDER BY t1.rowid
   3811   }
   3812 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14}
   3813 do_test boundary3-2.20.le.11 {
   3814   db eval {
   3815     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   3816      WHERE t2.a=14
   3817      ORDER BY t1.rowid DESC
   3818   }
   3819 } {14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3820 do_test boundary3-2.21.1 {
   3821   db eval {
   3822     SELECT t1.* FROM t1, t2 WHERE t1.rowid=1099511627775 AND t2.a=t1.a
   3823   }
   3824 } {57 000000ffffffffff}
   3825 do_test boundary3-2.21.2 {
   3826   db eval {
   3827     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='000000ffffffffff'
   3828   }
   3829 } {1099511627775 57}
   3830 do_test boundary3-2.21.3 {
   3831   db eval {
   3832     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=57
   3833   }
   3834 } {1099511627775 000000ffffffffff}
   3835 do_test boundary3-2.21.gt.1 {
   3836   db eval {
   3837     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3838      WHERE t1.rowid > 1099511627775 ORDER BY t2.a
   3839   }
   3840 } {3 7 10 13 17 19 25 26 27 28 34 43 45 56}
   3841 do_test boundary3-2.21.gt.2 {
   3842   db eval {
   3843     SELECT t2.a FROM t2 NATURAL JOIN t1
   3844      WHERE t1.rowid > 1099511627775 ORDER BY t1.a DESC
   3845   }
   3846 } {56 45 43 34 28 27 26 25 19 17 13 10 7 3}
   3847 do_test boundary3-2.21.gt.3 {
   3848   db eval {
   3849     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3850      WHERE t2.a=57
   3851      ORDER BY t1.rowid
   3852   }
   3853 } {19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3854 do_test boundary3-2.21.gt.4 {
   3855   db eval {
   3856     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3857      WHERE t2.a=57
   3858      ORDER BY t1.rowid DESC
   3859   }
   3860 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19}
   3861 do_test boundary3-2.21.gt.5 {
   3862   db eval {
   3863     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   3864      WHERE t2.a=57
   3865      ORDER BY x
   3866   }
   3867 } {19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3868 do_test boundary3-2.21.gt.10 {
   3869   db eval {
   3870     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3871      WHERE t2.a=57
   3872      ORDER BY t1.rowid
   3873   }
   3874 } {19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3875 do_test boundary3-2.21.gt.11 {
   3876   db eval {
   3877     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   3878      WHERE t2.a=57
   3879      ORDER BY t1.rowid DESC
   3880   }
   3881 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19}
   3882 do_test boundary3-2.21.ge.1 {
   3883   db eval {
   3884     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3885      WHERE t1.rowid >= 1099511627775 ORDER BY t2.a
   3886   }
   3887 } {3 7 10 13 17 19 25 26 27 28 34 43 45 56 57}
   3888 do_test boundary3-2.21.ge.2 {
   3889   db eval {
   3890     SELECT t2.a FROM t2 NATURAL JOIN t1
   3891      WHERE t1.rowid >= 1099511627775 ORDER BY t1.a DESC
   3892   }
   3893 } {57 56 45 43 34 28 27 26 25 19 17 13 10 7 3}
   3894 do_test boundary3-2.21.ge.3 {
   3895   db eval {
   3896     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3897      WHERE t2.a=57
   3898      ORDER BY t1.rowid
   3899   }
   3900 } {57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3901 do_test boundary3-2.21.ge.4 {
   3902   db eval {
   3903     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3904      WHERE t2.a=57
   3905      ORDER BY t1.rowid DESC
   3906   }
   3907 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57}
   3908 do_test boundary3-2.21.ge.5 {
   3909   db eval {
   3910     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   3911      WHERE t2.a=57
   3912      ORDER BY x
   3913   }
   3914 } {57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3915 do_test boundary3-2.21.ge.10 {
   3916   db eval {
   3917     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3918      WHERE t2.a=57
   3919      ORDER BY t1.rowid
   3920   }
   3921 } {57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   3922 do_test boundary3-2.21.ge.11 {
   3923   db eval {
   3924     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   3925      WHERE t2.a=57
   3926      ORDER BY t1.rowid DESC
   3927   }
   3928 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57}
   3929 do_test boundary3-2.21.lt.1 {
   3930   db eval {
   3931     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3932      WHERE t1.rowid < 1099511627775 ORDER BY t2.a
   3933   }
   3934 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   3935 do_test boundary3-2.21.lt.2 {
   3936   db eval {
   3937     SELECT t2.a FROM t2 NATURAL JOIN t1
   3938      WHERE t1.rowid < 1099511627775 ORDER BY t1.a DESC
   3939   }
   3940 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   3941 do_test boundary3-2.21.lt.3 {
   3942   db eval {
   3943     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3944      WHERE t2.a=57
   3945      ORDER BY t1.rowid
   3946   }
   3947 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35}
   3948 do_test boundary3-2.21.lt.4 {
   3949   db eval {
   3950     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3951      WHERE t2.a=57
   3952      ORDER BY t1.rowid DESC
   3953   }
   3954 } {35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3955 do_test boundary3-2.21.lt.5 {
   3956   db eval {
   3957     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   3958      WHERE t2.a=57
   3959      ORDER BY x
   3960   }
   3961 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   3962 do_test boundary3-2.21.lt.10 {
   3963   db eval {
   3964     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3965      WHERE t2.a=57
   3966      ORDER BY t1.rowid
   3967   }
   3968 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35}
   3969 do_test boundary3-2.21.lt.11 {
   3970   db eval {
   3971     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   3972      WHERE t2.a=57
   3973      ORDER BY t1.rowid DESC
   3974   }
   3975 } {35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   3976 do_test boundary3-2.21.le.1 {
   3977   db eval {
   3978     SELECT t2.a FROM t1 JOIN t2 USING(a)
   3979      WHERE t1.rowid <= 1099511627775 ORDER BY t2.a
   3980   }
   3981 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64}
   3982 do_test boundary3-2.21.le.2 {
   3983   db eval {
   3984     SELECT t2.a FROM t2 NATURAL JOIN t1
   3985      WHERE t1.rowid <= 1099511627775 ORDER BY t1.a DESC
   3986   }
   3987 } {64 63 62 61 60 59 58 57 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   3988 do_test boundary3-2.21.le.3 {
   3989   db eval {
   3990     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3991      WHERE t2.a=57
   3992      ORDER BY t1.rowid
   3993   }
   3994 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57}
   3995 do_test boundary3-2.21.le.4 {
   3996   db eval {
   3997     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   3998      WHERE t2.a=57
   3999      ORDER BY t1.rowid DESC
   4000   }
   4001 } {57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4002 do_test boundary3-2.21.le.5 {
   4003   db eval {
   4004     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4005      WHERE t2.a=57
   4006      ORDER BY x
   4007   }
   4008 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4009 do_test boundary3-2.21.le.10 {
   4010   db eval {
   4011     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4012      WHERE t2.a=57
   4013      ORDER BY t1.rowid
   4014   }
   4015 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57}
   4016 do_test boundary3-2.21.le.11 {
   4017   db eval {
   4018     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4019      WHERE t2.a=57
   4020      ORDER BY t1.rowid DESC
   4021   }
   4022 } {57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4023 do_test boundary3-2.22.1 {
   4024   db eval {
   4025     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-8388608 AND t2.a=t1.a
   4026   }
   4027 } {37 ffffffffff800000}
   4028 do_test boundary3-2.22.2 {
   4029   db eval {
   4030     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffff800000'
   4031   }
   4032 } {-8388608 37}
   4033 do_test boundary3-2.22.3 {
   4034   db eval {
   4035     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=37
   4036   }
   4037 } {-8388608 ffffffffff800000}
   4038 do_test boundary3-2.22.gt.1 {
   4039   db eval {
   4040     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4041      WHERE t1.rowid > -8388608 ORDER BY t2.a
   4042   }
   4043 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   4044 do_test boundary3-2.22.gt.2 {
   4045   db eval {
   4046     SELECT t2.a FROM t2 NATURAL JOIN t1
   4047      WHERE t1.rowid > -8388608 ORDER BY t1.a DESC
   4048   }
   4049 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   4050 do_test boundary3-2.22.gt.3 {
   4051   db eval {
   4052     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4053      WHERE t2.a=37
   4054      ORDER BY t1.rowid
   4055   }
   4056 } {29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4057 do_test boundary3-2.22.gt.4 {
   4058   db eval {
   4059     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4060      WHERE t2.a=37
   4061      ORDER BY t1.rowid DESC
   4062   }
   4063 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29}
   4064 do_test boundary3-2.22.gt.5 {
   4065   db eval {
   4066     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4067      WHERE t2.a=37
   4068      ORDER BY x
   4069   }
   4070 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 29 32 54 53 52 33 38}
   4071 do_test boundary3-2.22.gt.10 {
   4072   db eval {
   4073     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4074      WHERE t2.a=37
   4075      ORDER BY t1.rowid
   4076   }
   4077 } {29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4078 do_test boundary3-2.22.gt.11 {
   4079   db eval {
   4080     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4081      WHERE t2.a=37
   4082      ORDER BY t1.rowid DESC
   4083   }
   4084 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29}
   4085 do_test boundary3-2.22.ge.1 {
   4086   db eval {
   4087     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4088      WHERE t1.rowid >= -8388608 ORDER BY t2.a
   4089   }
   4090 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   4091 do_test boundary3-2.22.ge.2 {
   4092   db eval {
   4093     SELECT t2.a FROM t2 NATURAL JOIN t1
   4094      WHERE t1.rowid >= -8388608 ORDER BY t1.a DESC
   4095   }
   4096 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   4097 do_test boundary3-2.22.ge.3 {
   4098   db eval {
   4099     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4100      WHERE t2.a=37
   4101      ORDER BY t1.rowid
   4102   }
   4103 } {37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4104 do_test boundary3-2.22.ge.4 {
   4105   db eval {
   4106     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4107      WHERE t2.a=37
   4108      ORDER BY t1.rowid DESC
   4109   }
   4110 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37}
   4111 do_test boundary3-2.22.ge.5 {
   4112   db eval {
   4113     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4114      WHERE t2.a=37
   4115      ORDER BY x
   4116   }
   4117 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 37 29 32 54 53 52 33 38}
   4118 do_test boundary3-2.22.ge.10 {
   4119   db eval {
   4120     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4121      WHERE t2.a=37
   4122      ORDER BY t1.rowid
   4123   }
   4124 } {37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4125 do_test boundary3-2.22.ge.11 {
   4126   db eval {
   4127     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4128      WHERE t2.a=37
   4129      ORDER BY t1.rowid DESC
   4130   }
   4131 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37}
   4132 do_test boundary3-2.22.lt.1 {
   4133   db eval {
   4134     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4135      WHERE t1.rowid < -8388608 ORDER BY t2.a
   4136   }
   4137 } {1 2 11 21 44 47 55 58 63 64}
   4138 do_test boundary3-2.22.lt.2 {
   4139   db eval {
   4140     SELECT t2.a FROM t2 NATURAL JOIN t1
   4141      WHERE t1.rowid < -8388608 ORDER BY t1.a DESC
   4142   }
   4143 } {64 63 58 55 47 44 21 11 2 1}
   4144 do_test boundary3-2.22.lt.3 {
   4145   db eval {
   4146     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4147      WHERE t2.a=37
   4148      ORDER BY t1.rowid
   4149   }
   4150 } {55 2 64 21 44 58 63 47 11 1}
   4151 do_test boundary3-2.22.lt.4 {
   4152   db eval {
   4153     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4154      WHERE t2.a=37
   4155      ORDER BY t1.rowid DESC
   4156   }
   4157 } {1 11 47 63 58 44 21 64 2 55}
   4158 do_test boundary3-2.22.lt.5 {
   4159   db eval {
   4160     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4161      WHERE t2.a=37
   4162      ORDER BY x
   4163   }
   4164 } {55 2 64 21 44 58 63 47 11 1}
   4165 do_test boundary3-2.22.lt.10 {
   4166   db eval {
   4167     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4168      WHERE t2.a=37
   4169      ORDER BY t1.rowid
   4170   }
   4171 } {55 2 64 21 44 58 63 47 11 1}
   4172 do_test boundary3-2.22.lt.11 {
   4173   db eval {
   4174     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4175      WHERE t2.a=37
   4176      ORDER BY t1.rowid DESC
   4177   }
   4178 } {1 11 47 63 58 44 21 64 2 55}
   4179 do_test boundary3-2.22.le.1 {
   4180   db eval {
   4181     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4182      WHERE t1.rowid <= -8388608 ORDER BY t2.a
   4183   }
   4184 } {1 2 11 21 37 44 47 55 58 63 64}
   4185 do_test boundary3-2.22.le.2 {
   4186   db eval {
   4187     SELECT t2.a FROM t2 NATURAL JOIN t1
   4188      WHERE t1.rowid <= -8388608 ORDER BY t1.a DESC
   4189   }
   4190 } {64 63 58 55 47 44 37 21 11 2 1}
   4191 do_test boundary3-2.22.le.3 {
   4192   db eval {
   4193     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4194      WHERE t2.a=37
   4195      ORDER BY t1.rowid
   4196   }
   4197 } {55 2 64 21 44 58 63 47 11 1 37}
   4198 do_test boundary3-2.22.le.4 {
   4199   db eval {
   4200     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4201      WHERE t2.a=37
   4202      ORDER BY t1.rowid DESC
   4203   }
   4204 } {37 1 11 47 63 58 44 21 64 2 55}
   4205 do_test boundary3-2.22.le.5 {
   4206   db eval {
   4207     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4208      WHERE t2.a=37
   4209      ORDER BY x
   4210   }
   4211 } {55 2 64 21 44 58 63 47 11 1 37}
   4212 do_test boundary3-2.22.le.10 {
   4213   db eval {
   4214     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4215      WHERE t2.a=37
   4216      ORDER BY t1.rowid
   4217   }
   4218 } {55 2 64 21 44 58 63 47 11 1 37}
   4219 do_test boundary3-2.22.le.11 {
   4220   db eval {
   4221     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4222      WHERE t2.a=37
   4223      ORDER BY t1.rowid DESC
   4224   }
   4225 } {37 1 11 47 63 58 44 21 64 2 55}
   4226 do_test boundary3-2.23.1 {
   4227   db eval {
   4228     SELECT t1.* FROM t1, t2 WHERE t1.rowid=549755813888 AND t2.a=t1.a
   4229   }
   4230 } {35 0000008000000000}
   4231 do_test boundary3-2.23.2 {
   4232   db eval {
   4233     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000008000000000'
   4234   }
   4235 } {549755813888 35}
   4236 do_test boundary3-2.23.3 {
   4237   db eval {
   4238     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=35
   4239   }
   4240 } {549755813888 0000008000000000}
   4241 do_test boundary3-2.23.gt.1 {
   4242   db eval {
   4243     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4244      WHERE t1.rowid > 549755813888 ORDER BY t2.a
   4245   }
   4246 } {3 7 10 13 17 19 25 26 27 28 34 43 45 56 57}
   4247 do_test boundary3-2.23.gt.2 {
   4248   db eval {
   4249     SELECT t2.a FROM t2 NATURAL JOIN t1
   4250      WHERE t1.rowid > 549755813888 ORDER BY t1.a DESC
   4251   }
   4252 } {57 56 45 43 34 28 27 26 25 19 17 13 10 7 3}
   4253 do_test boundary3-2.23.gt.3 {
   4254   db eval {
   4255     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4256      WHERE t2.a=35
   4257      ORDER BY t1.rowid
   4258   }
   4259 } {57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4260 do_test boundary3-2.23.gt.4 {
   4261   db eval {
   4262     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4263      WHERE t2.a=35
   4264      ORDER BY t1.rowid DESC
   4265   }
   4266 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57}
   4267 do_test boundary3-2.23.gt.5 {
   4268   db eval {
   4269     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4270      WHERE t2.a=35
   4271      ORDER BY x
   4272   }
   4273 } {57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4274 do_test boundary3-2.23.gt.10 {
   4275   db eval {
   4276     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4277      WHERE t2.a=35
   4278      ORDER BY t1.rowid
   4279   }
   4280 } {57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4281 do_test boundary3-2.23.gt.11 {
   4282   db eval {
   4283     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4284      WHERE t2.a=35
   4285      ORDER BY t1.rowid DESC
   4286   }
   4287 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57}
   4288 do_test boundary3-2.23.ge.1 {
   4289   db eval {
   4290     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4291      WHERE t1.rowid >= 549755813888 ORDER BY t2.a
   4292   }
   4293 } {3 7 10 13 17 19 25 26 27 28 34 35 43 45 56 57}
   4294 do_test boundary3-2.23.ge.2 {
   4295   db eval {
   4296     SELECT t2.a FROM t2 NATURAL JOIN t1
   4297      WHERE t1.rowid >= 549755813888 ORDER BY t1.a DESC
   4298   }
   4299 } {57 56 45 43 35 34 28 27 26 25 19 17 13 10 7 3}
   4300 do_test boundary3-2.23.ge.3 {
   4301   db eval {
   4302     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4303      WHERE t2.a=35
   4304      ORDER BY t1.rowid
   4305   }
   4306 } {35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4307 do_test boundary3-2.23.ge.4 {
   4308   db eval {
   4309     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4310      WHERE t2.a=35
   4311      ORDER BY t1.rowid DESC
   4312   }
   4313 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35}
   4314 do_test boundary3-2.23.ge.5 {
   4315   db eval {
   4316     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4317      WHERE t2.a=35
   4318      ORDER BY x
   4319   }
   4320 } {35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4321 do_test boundary3-2.23.ge.10 {
   4322   db eval {
   4323     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4324      WHERE t2.a=35
   4325      ORDER BY t1.rowid
   4326   }
   4327 } {35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4328 do_test boundary3-2.23.ge.11 {
   4329   db eval {
   4330     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4331      WHERE t2.a=35
   4332      ORDER BY t1.rowid DESC
   4333   }
   4334 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35}
   4335 do_test boundary3-2.23.lt.1 {
   4336   db eval {
   4337     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4338      WHERE t1.rowid < 549755813888 ORDER BY t2.a
   4339   }
   4340 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   4341 do_test boundary3-2.23.lt.2 {
   4342   db eval {
   4343     SELECT t2.a FROM t2 NATURAL JOIN t1
   4344      WHERE t1.rowid < 549755813888 ORDER BY t1.a DESC
   4345   }
   4346 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   4347 do_test boundary3-2.23.lt.3 {
   4348   db eval {
   4349     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4350      WHERE t2.a=35
   4351      ORDER BY t1.rowid
   4352   }
   4353 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46}
   4354 do_test boundary3-2.23.lt.4 {
   4355   db eval {
   4356     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4357      WHERE t2.a=35
   4358      ORDER BY t1.rowid DESC
   4359   }
   4360 } {46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4361 do_test boundary3-2.23.lt.5 {
   4362   db eval {
   4363     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4364      WHERE t2.a=35
   4365      ORDER BY x
   4366   }
   4367 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4368 do_test boundary3-2.23.lt.10 {
   4369   db eval {
   4370     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4371      WHERE t2.a=35
   4372      ORDER BY t1.rowid
   4373   }
   4374 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46}
   4375 do_test boundary3-2.23.lt.11 {
   4376   db eval {
   4377     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4378      WHERE t2.a=35
   4379      ORDER BY t1.rowid DESC
   4380   }
   4381 } {46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4382 do_test boundary3-2.23.le.1 {
   4383   db eval {
   4384     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4385      WHERE t1.rowid <= 549755813888 ORDER BY t2.a
   4386   }
   4387 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   4388 do_test boundary3-2.23.le.2 {
   4389   db eval {
   4390     SELECT t2.a FROM t2 NATURAL JOIN t1
   4391      WHERE t1.rowid <= 549755813888 ORDER BY t1.a DESC
   4392   }
   4393 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   4394 do_test boundary3-2.23.le.3 {
   4395   db eval {
   4396     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4397      WHERE t2.a=35
   4398      ORDER BY t1.rowid
   4399   }
   4400 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35}
   4401 do_test boundary3-2.23.le.4 {
   4402   db eval {
   4403     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4404      WHERE t2.a=35
   4405      ORDER BY t1.rowid DESC
   4406   }
   4407 } {35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4408 do_test boundary3-2.23.le.5 {
   4409   db eval {
   4410     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4411      WHERE t2.a=35
   4412      ORDER BY x
   4413   }
   4414 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4415 do_test boundary3-2.23.le.10 {
   4416   db eval {
   4417     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4418      WHERE t2.a=35
   4419      ORDER BY t1.rowid
   4420   }
   4421 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35}
   4422 do_test boundary3-2.23.le.11 {
   4423   db eval {
   4424     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4425      WHERE t2.a=35
   4426      ORDER BY t1.rowid DESC
   4427   }
   4428 } {35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4429 do_test boundary3-2.24.1 {
   4430   db eval {
   4431     SELECT t1.* FROM t1, t2 WHERE t1.rowid=8388607 AND t2.a=t1.a
   4432   }
   4433 } {18 00000000007fffff}
   4434 do_test boundary3-2.24.2 {
   4435   db eval {
   4436     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00000000007fffff'
   4437   }
   4438 } {8388607 18}
   4439 do_test boundary3-2.24.3 {
   4440   db eval {
   4441     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=18
   4442   }
   4443 } {8388607 00000000007fffff}
   4444 do_test boundary3-2.24.gt.1 {
   4445   db eval {
   4446     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4447      WHERE t1.rowid > 8388607 ORDER BY t2.a
   4448   }
   4449 } {3 6 7 9 10 12 13 14 17 19 20 22 24 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   4450 do_test boundary3-2.24.gt.2 {
   4451   db eval {
   4452     SELECT t2.a FROM t2 NATURAL JOIN t1
   4453      WHERE t1.rowid > 8388607 ORDER BY t1.a DESC
   4454   }
   4455 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 24 22 20 19 17 14 13 12 10 9 7 6 3}
   4456 do_test boundary3-2.24.gt.3 {
   4457   db eval {
   4458     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4459      WHERE t2.a=18
   4460      ORDER BY t1.rowid
   4461   }
   4462 } {24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4463 do_test boundary3-2.24.gt.4 {
   4464   db eval {
   4465     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4466      WHERE t2.a=18
   4467      ORDER BY t1.rowid DESC
   4468   }
   4469 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24}
   4470 do_test boundary3-2.24.gt.5 {
   4471   db eval {
   4472     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4473      WHERE t2.a=18
   4474      ORDER BY x
   4475   }
   4476 } {24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4477 do_test boundary3-2.24.gt.10 {
   4478   db eval {
   4479     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4480      WHERE t2.a=18
   4481      ORDER BY t1.rowid
   4482   }
   4483 } {24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4484 do_test boundary3-2.24.gt.11 {
   4485   db eval {
   4486     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4487      WHERE t2.a=18
   4488      ORDER BY t1.rowid DESC
   4489   }
   4490 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24}
   4491 do_test boundary3-2.24.ge.1 {
   4492   db eval {
   4493     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4494      WHERE t1.rowid >= 8388607 ORDER BY t2.a
   4495   }
   4496 } {3 6 7 9 10 12 13 14 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   4497 do_test boundary3-2.24.ge.2 {
   4498   db eval {
   4499     SELECT t2.a FROM t2 NATURAL JOIN t1
   4500      WHERE t1.rowid >= 8388607 ORDER BY t1.a DESC
   4501   }
   4502 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 14 13 12 10 9 7 6 3}
   4503 do_test boundary3-2.24.ge.3 {
   4504   db eval {
   4505     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4506      WHERE t2.a=18
   4507      ORDER BY t1.rowid
   4508   }
   4509 } {18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4510 do_test boundary3-2.24.ge.4 {
   4511   db eval {
   4512     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4513      WHERE t2.a=18
   4514      ORDER BY t1.rowid DESC
   4515   }
   4516 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18}
   4517 do_test boundary3-2.24.ge.5 {
   4518   db eval {
   4519     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4520      WHERE t2.a=18
   4521      ORDER BY x
   4522   }
   4523 } {18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4524 do_test boundary3-2.24.ge.10 {
   4525   db eval {
   4526     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4527      WHERE t2.a=18
   4528      ORDER BY t1.rowid
   4529   }
   4530 } {18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4531 do_test boundary3-2.24.ge.11 {
   4532   db eval {
   4533     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4534      WHERE t2.a=18
   4535      ORDER BY t1.rowid DESC
   4536   }
   4537 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18}
   4538 do_test boundary3-2.24.lt.1 {
   4539   db eval {
   4540     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4541      WHERE t1.rowid < 8388607 ORDER BY t2.a
   4542   }
   4543 } {1 2 4 5 8 11 15 16 21 23 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   4544 do_test boundary3-2.24.lt.2 {
   4545   db eval {
   4546     SELECT t2.a FROM t2 NATURAL JOIN t1
   4547      WHERE t1.rowid < 8388607 ORDER BY t1.a DESC
   4548   }
   4549 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 23 21 16 15 11 8 5 4 2 1}
   4550 do_test boundary3-2.24.lt.3 {
   4551   db eval {
   4552     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4553      WHERE t2.a=18
   4554      ORDER BY t1.rowid
   4555   }
   4556 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42}
   4557 do_test boundary3-2.24.lt.4 {
   4558   db eval {
   4559     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4560      WHERE t2.a=18
   4561      ORDER BY t1.rowid DESC
   4562   }
   4563 } {42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4564 do_test boundary3-2.24.lt.5 {
   4565   db eval {
   4566     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4567      WHERE t2.a=18
   4568      ORDER BY x
   4569   }
   4570 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4571 do_test boundary3-2.24.lt.10 {
   4572   db eval {
   4573     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4574      WHERE t2.a=18
   4575      ORDER BY t1.rowid
   4576   }
   4577 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42}
   4578 do_test boundary3-2.24.lt.11 {
   4579   db eval {
   4580     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4581      WHERE t2.a=18
   4582      ORDER BY t1.rowid DESC
   4583   }
   4584 } {42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4585 do_test boundary3-2.24.le.1 {
   4586   db eval {
   4587     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4588      WHERE t1.rowid <= 8388607 ORDER BY t2.a
   4589   }
   4590 } {1 2 4 5 8 11 15 16 18 21 23 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   4591 do_test boundary3-2.24.le.2 {
   4592   db eval {
   4593     SELECT t2.a FROM t2 NATURAL JOIN t1
   4594      WHERE t1.rowid <= 8388607 ORDER BY t1.a DESC
   4595   }
   4596 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 23 21 18 16 15 11 8 5 4 2 1}
   4597 do_test boundary3-2.24.le.3 {
   4598   db eval {
   4599     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4600      WHERE t2.a=18
   4601      ORDER BY t1.rowid
   4602   }
   4603 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18}
   4604 do_test boundary3-2.24.le.4 {
   4605   db eval {
   4606     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4607      WHERE t2.a=18
   4608      ORDER BY t1.rowid DESC
   4609   }
   4610 } {18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4611 do_test boundary3-2.24.le.5 {
   4612   db eval {
   4613     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4614      WHERE t2.a=18
   4615      ORDER BY x
   4616   }
   4617 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4618 do_test boundary3-2.24.le.10 {
   4619   db eval {
   4620     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4621      WHERE t2.a=18
   4622      ORDER BY t1.rowid
   4623   }
   4624 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18}
   4625 do_test boundary3-2.24.le.11 {
   4626   db eval {
   4627     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4628      WHERE t2.a=18
   4629      ORDER BY t1.rowid DESC
   4630   }
   4631 } {18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4632 do_test boundary3-2.25.1 {
   4633   db eval {
   4634     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-3 AND t2.a=t1.a
   4635   }
   4636 } {52 fffffffffffffffd}
   4637 do_test boundary3-2.25.2 {
   4638   db eval {
   4639     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='fffffffffffffffd'
   4640   }
   4641 } {-3 52}
   4642 do_test boundary3-2.25.3 {
   4643   db eval {
   4644     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=52
   4645   }
   4646 } {-3 fffffffffffffffd}
   4647 do_test boundary3-2.25.gt.1 {
   4648   db eval {
   4649     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4650      WHERE t1.rowid > -3 ORDER BY t2.a
   4651   }
   4652 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 56 57 59 60 61 62}
   4653 do_test boundary3-2.25.gt.2 {
   4654   db eval {
   4655     SELECT t2.a FROM t2 NATURAL JOIN t1
   4656      WHERE t1.rowid > -3 ORDER BY t1.a DESC
   4657   }
   4658 } {62 61 60 59 57 56 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   4659 do_test boundary3-2.25.gt.3 {
   4660   db eval {
   4661     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4662      WHERE t2.a=52
   4663      ORDER BY t1.rowid
   4664   }
   4665 } {33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4666 do_test boundary3-2.25.gt.4 {
   4667   db eval {
   4668     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4669      WHERE t2.a=52
   4670      ORDER BY t1.rowid DESC
   4671   }
   4672 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33}
   4673 do_test boundary3-2.25.gt.5 {
   4674   db eval {
   4675     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4676      WHERE t2.a=52
   4677      ORDER BY x
   4678   }
   4679 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 33 38}
   4680 do_test boundary3-2.25.gt.10 {
   4681   db eval {
   4682     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4683      WHERE t2.a=52
   4684      ORDER BY t1.rowid
   4685   }
   4686 } {33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4687 do_test boundary3-2.25.gt.11 {
   4688   db eval {
   4689     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4690      WHERE t2.a=52
   4691      ORDER BY t1.rowid DESC
   4692   }
   4693 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33}
   4694 do_test boundary3-2.25.ge.1 {
   4695   db eval {
   4696     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4697      WHERE t1.rowid >= -3 ORDER BY t2.a
   4698   }
   4699 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 56 57 59 60 61 62}
   4700 do_test boundary3-2.25.ge.2 {
   4701   db eval {
   4702     SELECT t2.a FROM t2 NATURAL JOIN t1
   4703      WHERE t1.rowid >= -3 ORDER BY t1.a DESC
   4704   }
   4705 } {62 61 60 59 57 56 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   4706 do_test boundary3-2.25.ge.3 {
   4707   db eval {
   4708     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4709      WHERE t2.a=52
   4710      ORDER BY t1.rowid
   4711   }
   4712 } {52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4713 do_test boundary3-2.25.ge.4 {
   4714   db eval {
   4715     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4716      WHERE t2.a=52
   4717      ORDER BY t1.rowid DESC
   4718   }
   4719 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52}
   4720 do_test boundary3-2.25.ge.5 {
   4721   db eval {
   4722     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4723      WHERE t2.a=52
   4724      ORDER BY x
   4725   }
   4726 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 52 33 38}
   4727 do_test boundary3-2.25.ge.10 {
   4728   db eval {
   4729     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4730      WHERE t2.a=52
   4731      ORDER BY t1.rowid
   4732   }
   4733 } {52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4734 do_test boundary3-2.25.ge.11 {
   4735   db eval {
   4736     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4737      WHERE t2.a=52
   4738      ORDER BY t1.rowid DESC
   4739   }
   4740 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52}
   4741 do_test boundary3-2.25.lt.1 {
   4742   db eval {
   4743     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4744      WHERE t1.rowid < -3 ORDER BY t2.a
   4745   }
   4746 } {1 2 11 21 29 32 37 44 47 53 54 55 58 63 64}
   4747 do_test boundary3-2.25.lt.2 {
   4748   db eval {
   4749     SELECT t2.a FROM t2 NATURAL JOIN t1
   4750      WHERE t1.rowid < -3 ORDER BY t1.a DESC
   4751   }
   4752 } {64 63 58 55 54 53 47 44 37 32 29 21 11 2 1}
   4753 do_test boundary3-2.25.lt.3 {
   4754   db eval {
   4755     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4756      WHERE t2.a=52
   4757      ORDER BY t1.rowid
   4758   }
   4759 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53}
   4760 do_test boundary3-2.25.lt.4 {
   4761   db eval {
   4762     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4763      WHERE t2.a=52
   4764      ORDER BY t1.rowid DESC
   4765   }
   4766 } {53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4767 do_test boundary3-2.25.lt.5 {
   4768   db eval {
   4769     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4770      WHERE t2.a=52
   4771      ORDER BY x
   4772   }
   4773 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53}
   4774 do_test boundary3-2.25.lt.10 {
   4775   db eval {
   4776     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4777      WHERE t2.a=52
   4778      ORDER BY t1.rowid
   4779   }
   4780 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53}
   4781 do_test boundary3-2.25.lt.11 {
   4782   db eval {
   4783     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4784      WHERE t2.a=52
   4785      ORDER BY t1.rowid DESC
   4786   }
   4787 } {53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4788 do_test boundary3-2.25.le.1 {
   4789   db eval {
   4790     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4791      WHERE t1.rowid <= -3 ORDER BY t2.a
   4792   }
   4793 } {1 2 11 21 29 32 37 44 47 52 53 54 55 58 63 64}
   4794 do_test boundary3-2.25.le.2 {
   4795   db eval {
   4796     SELECT t2.a FROM t2 NATURAL JOIN t1
   4797      WHERE t1.rowid <= -3 ORDER BY t1.a DESC
   4798   }
   4799 } {64 63 58 55 54 53 52 47 44 37 32 29 21 11 2 1}
   4800 do_test boundary3-2.25.le.3 {
   4801   db eval {
   4802     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4803      WHERE t2.a=52
   4804      ORDER BY t1.rowid
   4805   }
   4806 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52}
   4807 do_test boundary3-2.25.le.4 {
   4808   db eval {
   4809     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4810      WHERE t2.a=52
   4811      ORDER BY t1.rowid DESC
   4812   }
   4813 } {52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4814 do_test boundary3-2.25.le.5 {
   4815   db eval {
   4816     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   4817      WHERE t2.a=52
   4818      ORDER BY x
   4819   }
   4820 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52}
   4821 do_test boundary3-2.25.le.10 {
   4822   db eval {
   4823     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4824      WHERE t2.a=52
   4825      ORDER BY t1.rowid
   4826   }
   4827 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52}
   4828 do_test boundary3-2.25.le.11 {
   4829   db eval {
   4830     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   4831      WHERE t2.a=52
   4832      ORDER BY t1.rowid DESC
   4833   }
   4834 } {52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4835 do_test boundary3-2.26.1 {
   4836   db eval {
   4837     SELECT t1.* FROM t1, t2 WHERE t1.rowid=0 AND t2.a=t1.a
   4838   }
   4839 } {59 0000000000000000}
   4840 do_test boundary3-2.26.2 {
   4841   db eval {
   4842     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000000'
   4843   }
   4844 } {0 59}
   4845 do_test boundary3-2.26.3 {
   4846   db eval {
   4847     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=59
   4848   }
   4849 } {0 0000000000000000}
   4850 do_test boundary3-2.26.gt.1 {
   4851   db eval {
   4852     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4853      WHERE t1.rowid > 0 ORDER BY t2.a
   4854   }
   4855 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 41 42 43 45 46 48 49 50 51 56 57 60 61 62}
   4856 do_test boundary3-2.26.gt.2 {
   4857   db eval {
   4858     SELECT t2.a FROM t2 NATURAL JOIN t1
   4859      WHERE t1.rowid > 0 ORDER BY t1.a DESC
   4860   }
   4861 } {62 61 60 57 56 51 50 49 48 46 45 43 42 41 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   4862 do_test boundary3-2.26.gt.3 {
   4863   db eval {
   4864     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4865      WHERE t2.a=59
   4866      ORDER BY t1.rowid
   4867   }
   4868 } {60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4869 do_test boundary3-2.26.gt.4 {
   4870   db eval {
   4871     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4872      WHERE t2.a=59
   4873      ORDER BY t1.rowid DESC
   4874   }
   4875 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60}
   4876 do_test boundary3-2.26.gt.5 {
   4877   db eval {
   4878     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   4879      WHERE t2.a=59
   4880      ORDER BY x
   4881   }
   4882 } {60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4883 do_test boundary3-2.26.gt.10 {
   4884   db eval {
   4885     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4886      WHERE t2.a=59
   4887      ORDER BY t1.rowid
   4888   }
   4889 } {60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4890 do_test boundary3-2.26.gt.11 {
   4891   db eval {
   4892     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   4893      WHERE t2.a=59
   4894      ORDER BY t1.rowid DESC
   4895   }
   4896 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60}
   4897 do_test boundary3-2.26.ge.1 {
   4898   db eval {
   4899     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4900      WHERE t1.rowid >= 0 ORDER BY t2.a
   4901   }
   4902 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 41 42 43 45 46 48 49 50 51 56 57 59 60 61 62}
   4903 do_test boundary3-2.26.ge.2 {
   4904   db eval {
   4905     SELECT t2.a FROM t2 NATURAL JOIN t1
   4906      WHERE t1.rowid >= 0 ORDER BY t1.a DESC
   4907   }
   4908 } {62 61 60 59 57 56 51 50 49 48 46 45 43 42 41 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   4909 do_test boundary3-2.26.ge.3 {
   4910   db eval {
   4911     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4912      WHERE t2.a=59
   4913      ORDER BY t1.rowid
   4914   }
   4915 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4916 do_test boundary3-2.26.ge.4 {
   4917   db eval {
   4918     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4919      WHERE t2.a=59
   4920      ORDER BY t1.rowid DESC
   4921   }
   4922 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59}
   4923 do_test boundary3-2.26.ge.5 {
   4924   db eval {
   4925     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   4926      WHERE t2.a=59
   4927      ORDER BY x
   4928   }
   4929 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4930 do_test boundary3-2.26.ge.10 {
   4931   db eval {
   4932     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4933      WHERE t2.a=59
   4934      ORDER BY t1.rowid
   4935   }
   4936 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   4937 do_test boundary3-2.26.ge.11 {
   4938   db eval {
   4939     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   4940      WHERE t2.a=59
   4941      ORDER BY t1.rowid DESC
   4942   }
   4943 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59}
   4944 do_test boundary3-2.26.lt.1 {
   4945   db eval {
   4946     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4947      WHERE t1.rowid < 0 ORDER BY t2.a
   4948   }
   4949 } {1 2 11 21 29 32 33 37 38 44 47 52 53 54 55 58 63 64}
   4950 do_test boundary3-2.26.lt.2 {
   4951   db eval {
   4952     SELECT t2.a FROM t2 NATURAL JOIN t1
   4953      WHERE t1.rowid < 0 ORDER BY t1.a DESC
   4954   }
   4955 } {64 63 58 55 54 53 52 47 44 38 37 33 32 29 21 11 2 1}
   4956 do_test boundary3-2.26.lt.3 {
   4957   db eval {
   4958     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4959      WHERE t2.a=59
   4960      ORDER BY t1.rowid
   4961   }
   4962 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4963 do_test boundary3-2.26.lt.4 {
   4964   db eval {
   4965     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4966      WHERE t2.a=59
   4967      ORDER BY t1.rowid DESC
   4968   }
   4969 } {38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4970 do_test boundary3-2.26.lt.5 {
   4971   db eval {
   4972     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   4973      WHERE t2.a=59
   4974      ORDER BY x
   4975   }
   4976 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4977 do_test boundary3-2.26.lt.10 {
   4978   db eval {
   4979     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4980      WHERE t2.a=59
   4981      ORDER BY t1.rowid
   4982   }
   4983 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   4984 do_test boundary3-2.26.lt.11 {
   4985   db eval {
   4986     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   4987      WHERE t2.a=59
   4988      ORDER BY t1.rowid DESC
   4989   }
   4990 } {38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   4991 do_test boundary3-2.26.le.1 {
   4992   db eval {
   4993     SELECT t2.a FROM t1 JOIN t2 USING(a)
   4994      WHERE t1.rowid <= 0 ORDER BY t2.a
   4995   }
   4996 } {1 2 11 21 29 32 33 37 38 44 47 52 53 54 55 58 59 63 64}
   4997 do_test boundary3-2.26.le.2 {
   4998   db eval {
   4999     SELECT t2.a FROM t2 NATURAL JOIN t1
   5000      WHERE t1.rowid <= 0 ORDER BY t1.a DESC
   5001   }
   5002 } {64 63 59 58 55 54 53 52 47 44 38 37 33 32 29 21 11 2 1}
   5003 do_test boundary3-2.26.le.3 {
   5004   db eval {
   5005     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5006      WHERE t2.a=59
   5007      ORDER BY t1.rowid
   5008   }
   5009 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59}
   5010 do_test boundary3-2.26.le.4 {
   5011   db eval {
   5012     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5013      WHERE t2.a=59
   5014      ORDER BY t1.rowid DESC
   5015   }
   5016 } {59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5017 do_test boundary3-2.26.le.5 {
   5018   db eval {
   5019     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5020      WHERE t2.a=59
   5021      ORDER BY x
   5022   }
   5023 } {59 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5024 do_test boundary3-2.26.le.10 {
   5025   db eval {
   5026     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5027      WHERE t2.a=59
   5028      ORDER BY t1.rowid
   5029   }
   5030 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59}
   5031 do_test boundary3-2.26.le.11 {
   5032   db eval {
   5033     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5034      WHERE t2.a=59
   5035      ORDER BY t1.rowid DESC
   5036   }
   5037 } {59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5038 do_test boundary3-2.27.1 {
   5039   db eval {
   5040     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-1 AND t2.a=t1.a
   5041   }
   5042 } {38 ffffffffffffffff}
   5043 do_test boundary3-2.27.2 {
   5044   db eval {
   5045     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffffffffff'
   5046   }
   5047 } {-1 38}
   5048 do_test boundary3-2.27.3 {
   5049   db eval {
   5050     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=38
   5051   }
   5052 } {-1 ffffffffffffffff}
   5053 do_test boundary3-2.27.gt.1 {
   5054   db eval {
   5055     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5056      WHERE t1.rowid > -1 ORDER BY t2.a
   5057   }
   5058 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 41 42 43 45 46 48 49 50 51 56 57 59 60 61 62}
   5059 do_test boundary3-2.27.gt.2 {
   5060   db eval {
   5061     SELECT t2.a FROM t2 NATURAL JOIN t1
   5062      WHERE t1.rowid > -1 ORDER BY t1.a DESC
   5063   }
   5064 } {62 61 60 59 57 56 51 50 49 48 46 45 43 42 41 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   5065 do_test boundary3-2.27.gt.3 {
   5066   db eval {
   5067     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5068      WHERE t2.a=38
   5069      ORDER BY t1.rowid
   5070   }
   5071 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5072 do_test boundary3-2.27.gt.4 {
   5073   db eval {
   5074     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5075      WHERE t2.a=38
   5076      ORDER BY t1.rowid DESC
   5077   }
   5078 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59}
   5079 do_test boundary3-2.27.gt.5 {
   5080   db eval {
   5081     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5082      WHERE t2.a=38
   5083      ORDER BY x
   5084   }
   5085 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5086 do_test boundary3-2.27.gt.10 {
   5087   db eval {
   5088     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5089      WHERE t2.a=38
   5090      ORDER BY t1.rowid
   5091   }
   5092 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5093 do_test boundary3-2.27.gt.11 {
   5094   db eval {
   5095     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5096      WHERE t2.a=38
   5097      ORDER BY t1.rowid DESC
   5098   }
   5099 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59}
   5100 do_test boundary3-2.27.ge.1 {
   5101   db eval {
   5102     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5103      WHERE t1.rowid >= -1 ORDER BY t2.a
   5104   }
   5105 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 56 57 59 60 61 62}
   5106 do_test boundary3-2.27.ge.2 {
   5107   db eval {
   5108     SELECT t2.a FROM t2 NATURAL JOIN t1
   5109      WHERE t1.rowid >= -1 ORDER BY t1.a DESC
   5110   }
   5111 } {62 61 60 59 57 56 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   5112 do_test boundary3-2.27.ge.3 {
   5113   db eval {
   5114     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5115      WHERE t2.a=38
   5116      ORDER BY t1.rowid
   5117   }
   5118 } {38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5119 do_test boundary3-2.27.ge.4 {
   5120   db eval {
   5121     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5122      WHERE t2.a=38
   5123      ORDER BY t1.rowid DESC
   5124   }
   5125 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38}
   5126 do_test boundary3-2.27.ge.5 {
   5127   db eval {
   5128     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5129      WHERE t2.a=38
   5130      ORDER BY x
   5131   }
   5132 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 38}
   5133 do_test boundary3-2.27.ge.10 {
   5134   db eval {
   5135     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5136      WHERE t2.a=38
   5137      ORDER BY t1.rowid
   5138   }
   5139 } {38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5140 do_test boundary3-2.27.ge.11 {
   5141   db eval {
   5142     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5143      WHERE t2.a=38
   5144      ORDER BY t1.rowid DESC
   5145   }
   5146 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38}
   5147 do_test boundary3-2.27.lt.1 {
   5148   db eval {
   5149     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5150      WHERE t1.rowid < -1 ORDER BY t2.a
   5151   }
   5152 } {1 2 11 21 29 32 33 37 44 47 52 53 54 55 58 63 64}
   5153 do_test boundary3-2.27.lt.2 {
   5154   db eval {
   5155     SELECT t2.a FROM t2 NATURAL JOIN t1
   5156      WHERE t1.rowid < -1 ORDER BY t1.a DESC
   5157   }
   5158 } {64 63 58 55 54 53 52 47 44 37 33 32 29 21 11 2 1}
   5159 do_test boundary3-2.27.lt.3 {
   5160   db eval {
   5161     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5162      WHERE t2.a=38
   5163      ORDER BY t1.rowid
   5164   }
   5165 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33}
   5166 do_test boundary3-2.27.lt.4 {
   5167   db eval {
   5168     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5169      WHERE t2.a=38
   5170      ORDER BY t1.rowid DESC
   5171   }
   5172 } {33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5173 do_test boundary3-2.27.lt.5 {
   5174   db eval {
   5175     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5176      WHERE t2.a=38
   5177      ORDER BY x
   5178   }
   5179 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33}
   5180 do_test boundary3-2.27.lt.10 {
   5181   db eval {
   5182     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5183      WHERE t2.a=38
   5184      ORDER BY t1.rowid
   5185   }
   5186 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33}
   5187 do_test boundary3-2.27.lt.11 {
   5188   db eval {
   5189     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5190      WHERE t2.a=38
   5191      ORDER BY t1.rowid DESC
   5192   }
   5193 } {33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5194 do_test boundary3-2.27.le.1 {
   5195   db eval {
   5196     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5197      WHERE t1.rowid <= -1 ORDER BY t2.a
   5198   }
   5199 } {1 2 11 21 29 32 33 37 38 44 47 52 53 54 55 58 63 64}
   5200 do_test boundary3-2.27.le.2 {
   5201   db eval {
   5202     SELECT t2.a FROM t2 NATURAL JOIN t1
   5203      WHERE t1.rowid <= -1 ORDER BY t1.a DESC
   5204   }
   5205 } {64 63 58 55 54 53 52 47 44 38 37 33 32 29 21 11 2 1}
   5206 do_test boundary3-2.27.le.3 {
   5207   db eval {
   5208     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5209      WHERE t2.a=38
   5210      ORDER BY t1.rowid
   5211   }
   5212 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5213 do_test boundary3-2.27.le.4 {
   5214   db eval {
   5215     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5216      WHERE t2.a=38
   5217      ORDER BY t1.rowid DESC
   5218   }
   5219 } {38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5220 do_test boundary3-2.27.le.5 {
   5221   db eval {
   5222     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5223      WHERE t2.a=38
   5224      ORDER BY x
   5225   }
   5226 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5227 do_test boundary3-2.27.le.10 {
   5228   db eval {
   5229     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5230      WHERE t2.a=38
   5231      ORDER BY t1.rowid
   5232   }
   5233 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5234 do_test boundary3-2.27.le.11 {
   5235   db eval {
   5236     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5237      WHERE t2.a=38
   5238      ORDER BY t1.rowid DESC
   5239   }
   5240 } {38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5241 do_test boundary3-2.28.1 {
   5242   db eval {
   5243     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-2 AND t2.a=t1.a
   5244   }
   5245 } {33 fffffffffffffffe}
   5246 do_test boundary3-2.28.2 {
   5247   db eval {
   5248     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='fffffffffffffffe'
   5249   }
   5250 } {-2 33}
   5251 do_test boundary3-2.28.3 {
   5252   db eval {
   5253     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=33
   5254   }
   5255 } {-2 fffffffffffffffe}
   5256 do_test boundary3-2.28.gt.1 {
   5257   db eval {
   5258     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5259      WHERE t1.rowid > -2 ORDER BY t2.a
   5260   }
   5261 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 56 57 59 60 61 62}
   5262 do_test boundary3-2.28.gt.2 {
   5263   db eval {
   5264     SELECT t2.a FROM t2 NATURAL JOIN t1
   5265      WHERE t1.rowid > -2 ORDER BY t1.a DESC
   5266   }
   5267 } {62 61 60 59 57 56 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   5268 do_test boundary3-2.28.gt.3 {
   5269   db eval {
   5270     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5271      WHERE t2.a=33
   5272      ORDER BY t1.rowid
   5273   }
   5274 } {38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5275 do_test boundary3-2.28.gt.4 {
   5276   db eval {
   5277     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5278      WHERE t2.a=33
   5279      ORDER BY t1.rowid DESC
   5280   }
   5281 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38}
   5282 do_test boundary3-2.28.gt.5 {
   5283   db eval {
   5284     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5285      WHERE t2.a=33
   5286      ORDER BY x
   5287   }
   5288 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 38}
   5289 do_test boundary3-2.28.gt.10 {
   5290   db eval {
   5291     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5292      WHERE t2.a=33
   5293      ORDER BY t1.rowid
   5294   }
   5295 } {38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5296 do_test boundary3-2.28.gt.11 {
   5297   db eval {
   5298     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5299      WHERE t2.a=33
   5300      ORDER BY t1.rowid DESC
   5301   }
   5302 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38}
   5303 do_test boundary3-2.28.ge.1 {
   5304   db eval {
   5305     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5306      WHERE t1.rowid >= -2 ORDER BY t2.a
   5307   }
   5308 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 56 57 59 60 61 62}
   5309 do_test boundary3-2.28.ge.2 {
   5310   db eval {
   5311     SELECT t2.a FROM t2 NATURAL JOIN t1
   5312      WHERE t1.rowid >= -2 ORDER BY t1.a DESC
   5313   }
   5314 } {62 61 60 59 57 56 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   5315 do_test boundary3-2.28.ge.3 {
   5316   db eval {
   5317     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5318      WHERE t2.a=33
   5319      ORDER BY t1.rowid
   5320   }
   5321 } {33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5322 do_test boundary3-2.28.ge.4 {
   5323   db eval {
   5324     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5325      WHERE t2.a=33
   5326      ORDER BY t1.rowid DESC
   5327   }
   5328 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33}
   5329 do_test boundary3-2.28.ge.5 {
   5330   db eval {
   5331     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5332      WHERE t2.a=33
   5333      ORDER BY x
   5334   }
   5335 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 33 38}
   5336 do_test boundary3-2.28.ge.10 {
   5337   db eval {
   5338     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5339      WHERE t2.a=33
   5340      ORDER BY t1.rowid
   5341   }
   5342 } {33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5343 do_test boundary3-2.28.ge.11 {
   5344   db eval {
   5345     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5346      WHERE t2.a=33
   5347      ORDER BY t1.rowid DESC
   5348   }
   5349 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33}
   5350 do_test boundary3-2.28.lt.1 {
   5351   db eval {
   5352     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5353      WHERE t1.rowid < -2 ORDER BY t2.a
   5354   }
   5355 } {1 2 11 21 29 32 37 44 47 52 53 54 55 58 63 64}
   5356 do_test boundary3-2.28.lt.2 {
   5357   db eval {
   5358     SELECT t2.a FROM t2 NATURAL JOIN t1
   5359      WHERE t1.rowid < -2 ORDER BY t1.a DESC
   5360   }
   5361 } {64 63 58 55 54 53 52 47 44 37 32 29 21 11 2 1}
   5362 do_test boundary3-2.28.lt.3 {
   5363   db eval {
   5364     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5365      WHERE t2.a=33
   5366      ORDER BY t1.rowid
   5367   }
   5368 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52}
   5369 do_test boundary3-2.28.lt.4 {
   5370   db eval {
   5371     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5372      WHERE t2.a=33
   5373      ORDER BY t1.rowid DESC
   5374   }
   5375 } {52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5376 do_test boundary3-2.28.lt.5 {
   5377   db eval {
   5378     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5379      WHERE t2.a=33
   5380      ORDER BY x
   5381   }
   5382 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52}
   5383 do_test boundary3-2.28.lt.10 {
   5384   db eval {
   5385     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5386      WHERE t2.a=33
   5387      ORDER BY t1.rowid
   5388   }
   5389 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52}
   5390 do_test boundary3-2.28.lt.11 {
   5391   db eval {
   5392     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5393      WHERE t2.a=33
   5394      ORDER BY t1.rowid DESC
   5395   }
   5396 } {52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5397 do_test boundary3-2.28.le.1 {
   5398   db eval {
   5399     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5400      WHERE t1.rowid <= -2 ORDER BY t2.a
   5401   }
   5402 } {1 2 11 21 29 32 33 37 44 47 52 53 54 55 58 63 64}
   5403 do_test boundary3-2.28.le.2 {
   5404   db eval {
   5405     SELECT t2.a FROM t2 NATURAL JOIN t1
   5406      WHERE t1.rowid <= -2 ORDER BY t1.a DESC
   5407   }
   5408 } {64 63 58 55 54 53 52 47 44 37 33 32 29 21 11 2 1}
   5409 do_test boundary3-2.28.le.3 {
   5410   db eval {
   5411     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5412      WHERE t2.a=33
   5413      ORDER BY t1.rowid
   5414   }
   5415 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33}
   5416 do_test boundary3-2.28.le.4 {
   5417   db eval {
   5418     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5419      WHERE t2.a=33
   5420      ORDER BY t1.rowid DESC
   5421   }
   5422 } {33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5423 do_test boundary3-2.28.le.5 {
   5424   db eval {
   5425     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5426      WHERE t2.a=33
   5427      ORDER BY x
   5428   }
   5429 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33}
   5430 do_test boundary3-2.28.le.10 {
   5431   db eval {
   5432     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5433      WHERE t2.a=33
   5434      ORDER BY t1.rowid
   5435   }
   5436 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33}
   5437 do_test boundary3-2.28.le.11 {
   5438   db eval {
   5439     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5440      WHERE t2.a=33
   5441      ORDER BY t1.rowid DESC
   5442   }
   5443 } {33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5444 do_test boundary3-2.29.1 {
   5445   db eval {
   5446     SELECT t1.* FROM t1, t2 WHERE t1.rowid=2097152 AND t2.a=t1.a
   5447   }
   5448 } {42 0000000000200000}
   5449 do_test boundary3-2.29.2 {
   5450   db eval {
   5451     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000200000'
   5452   }
   5453 } {2097152 42}
   5454 do_test boundary3-2.29.3 {
   5455   db eval {
   5456     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=42
   5457   }
   5458 } {2097152 0000000000200000}
   5459 do_test boundary3-2.29.gt.1 {
   5460   db eval {
   5461     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5462      WHERE t1.rowid > 2097152 ORDER BY t2.a
   5463   }
   5464 } {3 6 7 9 10 12 13 14 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   5465 do_test boundary3-2.29.gt.2 {
   5466   db eval {
   5467     SELECT t2.a FROM t2 NATURAL JOIN t1
   5468      WHERE t1.rowid > 2097152 ORDER BY t1.a DESC
   5469   }
   5470 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 14 13 12 10 9 7 6 3}
   5471 do_test boundary3-2.29.gt.3 {
   5472   db eval {
   5473     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5474      WHERE t2.a=42
   5475      ORDER BY t1.rowid
   5476   }
   5477 } {18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5478 do_test boundary3-2.29.gt.4 {
   5479   db eval {
   5480     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5481      WHERE t2.a=42
   5482      ORDER BY t1.rowid DESC
   5483   }
   5484 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18}
   5485 do_test boundary3-2.29.gt.5 {
   5486   db eval {
   5487     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5488      WHERE t2.a=42
   5489      ORDER BY x
   5490   }
   5491 } {18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5492 do_test boundary3-2.29.gt.10 {
   5493   db eval {
   5494     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5495      WHERE t2.a=42
   5496      ORDER BY t1.rowid
   5497   }
   5498 } {18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5499 do_test boundary3-2.29.gt.11 {
   5500   db eval {
   5501     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5502      WHERE t2.a=42
   5503      ORDER BY t1.rowid DESC
   5504   }
   5505 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18}
   5506 do_test boundary3-2.29.ge.1 {
   5507   db eval {
   5508     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5509      WHERE t1.rowid >= 2097152 ORDER BY t2.a
   5510   }
   5511 } {3 6 7 9 10 12 13 14 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 51 56 57}
   5512 do_test boundary3-2.29.ge.2 {
   5513   db eval {
   5514     SELECT t2.a FROM t2 NATURAL JOIN t1
   5515      WHERE t1.rowid >= 2097152 ORDER BY t1.a DESC
   5516   }
   5517 } {57 56 51 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 14 13 12 10 9 7 6 3}
   5518 do_test boundary3-2.29.ge.3 {
   5519   db eval {
   5520     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5521      WHERE t2.a=42
   5522      ORDER BY t1.rowid
   5523   }
   5524 } {42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5525 do_test boundary3-2.29.ge.4 {
   5526   db eval {
   5527     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5528      WHERE t2.a=42
   5529      ORDER BY t1.rowid DESC
   5530   }
   5531 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42}
   5532 do_test boundary3-2.29.ge.5 {
   5533   db eval {
   5534     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5535      WHERE t2.a=42
   5536      ORDER BY x
   5537   }
   5538 } {42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5539 do_test boundary3-2.29.ge.10 {
   5540   db eval {
   5541     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5542      WHERE t2.a=42
   5543      ORDER BY t1.rowid
   5544   }
   5545 } {42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5546 do_test boundary3-2.29.ge.11 {
   5547   db eval {
   5548     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5549      WHERE t2.a=42
   5550      ORDER BY t1.rowid DESC
   5551   }
   5552 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42}
   5553 do_test boundary3-2.29.lt.1 {
   5554   db eval {
   5555     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5556      WHERE t1.rowid < 2097152 ORDER BY t2.a
   5557   }
   5558 } {1 2 4 5 8 11 15 16 21 23 29 30 31 32 33 37 38 41 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   5559 do_test boundary3-2.29.lt.2 {
   5560   db eval {
   5561     SELECT t2.a FROM t2 NATURAL JOIN t1
   5562      WHERE t1.rowid < 2097152 ORDER BY t1.a DESC
   5563   }
   5564 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 41 38 37 33 32 31 30 29 23 21 16 15 11 8 5 4 2 1}
   5565 do_test boundary3-2.29.lt.3 {
   5566   db eval {
   5567     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5568      WHERE t2.a=42
   5569      ORDER BY t1.rowid
   5570   }
   5571 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15}
   5572 do_test boundary3-2.29.lt.4 {
   5573   db eval {
   5574     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5575      WHERE t2.a=42
   5576      ORDER BY t1.rowid DESC
   5577   }
   5578 } {15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5579 do_test boundary3-2.29.lt.5 {
   5580   db eval {
   5581     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5582      WHERE t2.a=42
   5583      ORDER BY x
   5584   }
   5585 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5586 do_test boundary3-2.29.lt.10 {
   5587   db eval {
   5588     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5589      WHERE t2.a=42
   5590      ORDER BY t1.rowid
   5591   }
   5592 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15}
   5593 do_test boundary3-2.29.lt.11 {
   5594   db eval {
   5595     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5596      WHERE t2.a=42
   5597      ORDER BY t1.rowid DESC
   5598   }
   5599 } {15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5600 do_test boundary3-2.29.le.1 {
   5601   db eval {
   5602     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5603      WHERE t1.rowid <= 2097152 ORDER BY t2.a
   5604   }
   5605 } {1 2 4 5 8 11 15 16 21 23 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   5606 do_test boundary3-2.29.le.2 {
   5607   db eval {
   5608     SELECT t2.a FROM t2 NATURAL JOIN t1
   5609      WHERE t1.rowid <= 2097152 ORDER BY t1.a DESC
   5610   }
   5611 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 23 21 16 15 11 8 5 4 2 1}
   5612 do_test boundary3-2.29.le.3 {
   5613   db eval {
   5614     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5615      WHERE t2.a=42
   5616      ORDER BY t1.rowid
   5617   }
   5618 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42}
   5619 do_test boundary3-2.29.le.4 {
   5620   db eval {
   5621     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5622      WHERE t2.a=42
   5623      ORDER BY t1.rowid DESC
   5624   }
   5625 } {42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5626 do_test boundary3-2.29.le.5 {
   5627   db eval {
   5628     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5629      WHERE t2.a=42
   5630      ORDER BY x
   5631   }
   5632 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5633 do_test boundary3-2.29.le.10 {
   5634   db eval {
   5635     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5636      WHERE t2.a=42
   5637      ORDER BY t1.rowid
   5638   }
   5639 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42}
   5640 do_test boundary3-2.29.le.11 {
   5641   db eval {
   5642     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5643      WHERE t2.a=42
   5644      ORDER BY t1.rowid DESC
   5645   }
   5646 } {42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5647 do_test boundary3-2.30.1 {
   5648   db eval {
   5649     SELECT t1.* FROM t1, t2 WHERE t1.rowid=128 AND t2.a=t1.a
   5650   }
   5651 } {49 0000000000000080}
   5652 do_test boundary3-2.30.2 {
   5653   db eval {
   5654     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000080'
   5655   }
   5656 } {128 49}
   5657 do_test boundary3-2.30.3 {
   5658   db eval {
   5659     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=49
   5660   }
   5661 } {128 0000000000000080}
   5662 do_test boundary3-2.30.gt.1 {
   5663   db eval {
   5664     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5665      WHERE t1.rowid > 128 ORDER BY t2.a
   5666   }
   5667 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 34 35 36 39 40 42 43 45 46 48 50 51 56 57 61 62}
   5668 do_test boundary3-2.30.gt.2 {
   5669   db eval {
   5670     SELECT t2.a FROM t2 NATURAL JOIN t1
   5671      WHERE t1.rowid > 128 ORDER BY t1.a DESC
   5672   }
   5673 } {62 61 57 56 51 50 48 46 45 43 42 40 39 36 35 34 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   5674 do_test boundary3-2.30.gt.3 {
   5675   db eval {
   5676     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5677      WHERE t2.a=49
   5678      ORDER BY t1.rowid
   5679   }
   5680 } {30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5681 do_test boundary3-2.30.gt.4 {
   5682   db eval {
   5683     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5684      WHERE t2.a=49
   5685      ORDER BY t1.rowid DESC
   5686   }
   5687 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30}
   5688 do_test boundary3-2.30.gt.5 {
   5689   db eval {
   5690     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5691      WHERE t2.a=49
   5692      ORDER BY x
   5693   }
   5694 } {30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5695 do_test boundary3-2.30.gt.10 {
   5696   db eval {
   5697     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5698      WHERE t2.a=49
   5699      ORDER BY t1.rowid
   5700   }
   5701 } {30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5702 do_test boundary3-2.30.gt.11 {
   5703   db eval {
   5704     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5705      WHERE t2.a=49
   5706      ORDER BY t1.rowid DESC
   5707   }
   5708 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30}
   5709 do_test boundary3-2.30.ge.1 {
   5710   db eval {
   5711     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5712      WHERE t1.rowid >= 128 ORDER BY t2.a
   5713   }
   5714 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   5715 do_test boundary3-2.30.ge.2 {
   5716   db eval {
   5717     SELECT t2.a FROM t2 NATURAL JOIN t1
   5718      WHERE t1.rowid >= 128 ORDER BY t1.a DESC
   5719   }
   5720 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   5721 do_test boundary3-2.30.ge.3 {
   5722   db eval {
   5723     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5724      WHERE t2.a=49
   5725      ORDER BY t1.rowid
   5726   }
   5727 } {49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5728 do_test boundary3-2.30.ge.4 {
   5729   db eval {
   5730     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5731      WHERE t2.a=49
   5732      ORDER BY t1.rowid DESC
   5733   }
   5734 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49}
   5735 do_test boundary3-2.30.ge.5 {
   5736   db eval {
   5737     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5738      WHERE t2.a=49
   5739      ORDER BY x
   5740   }
   5741 } {49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5742 do_test boundary3-2.30.ge.10 {
   5743   db eval {
   5744     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5745      WHERE t2.a=49
   5746      ORDER BY t1.rowid
   5747   }
   5748 } {49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5749 do_test boundary3-2.30.ge.11 {
   5750   db eval {
   5751     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5752      WHERE t2.a=49
   5753      ORDER BY t1.rowid DESC
   5754   }
   5755 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49}
   5756 do_test boundary3-2.30.lt.1 {
   5757   db eval {
   5758     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5759      WHERE t1.rowid < 128 ORDER BY t2.a
   5760   }
   5761 } {1 2 4 5 11 21 29 31 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   5762 do_test boundary3-2.30.lt.2 {
   5763   db eval {
   5764     SELECT t2.a FROM t2 NATURAL JOIN t1
   5765      WHERE t1.rowid < 128 ORDER BY t1.a DESC
   5766   }
   5767 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 31 29 21 11 5 4 2 1}
   5768 do_test boundary3-2.30.lt.3 {
   5769   db eval {
   5770     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5771      WHERE t2.a=49
   5772      ORDER BY t1.rowid
   5773   }
   5774 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4}
   5775 do_test boundary3-2.30.lt.4 {
   5776   db eval {
   5777     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5778      WHERE t2.a=49
   5779      ORDER BY t1.rowid DESC
   5780   }
   5781 } {4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5782 do_test boundary3-2.30.lt.5 {
   5783   db eval {
   5784     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5785      WHERE t2.a=49
   5786      ORDER BY x
   5787   }
   5788 } {59 60 41 5 31 4 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5789 do_test boundary3-2.30.lt.10 {
   5790   db eval {
   5791     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5792      WHERE t2.a=49
   5793      ORDER BY t1.rowid
   5794   }
   5795 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4}
   5796 do_test boundary3-2.30.lt.11 {
   5797   db eval {
   5798     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5799      WHERE t2.a=49
   5800      ORDER BY t1.rowid DESC
   5801   }
   5802 } {4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5803 do_test boundary3-2.30.le.1 {
   5804   db eval {
   5805     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5806      WHERE t1.rowid <= 128 ORDER BY t2.a
   5807   }
   5808 } {1 2 4 5 11 21 29 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 63 64}
   5809 do_test boundary3-2.30.le.2 {
   5810   db eval {
   5811     SELECT t2.a FROM t2 NATURAL JOIN t1
   5812      WHERE t1.rowid <= 128 ORDER BY t1.a DESC
   5813   }
   5814 } {64 63 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 29 21 11 5 4 2 1}
   5815 do_test boundary3-2.30.le.3 {
   5816   db eval {
   5817     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5818      WHERE t2.a=49
   5819      ORDER BY t1.rowid
   5820   }
   5821 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49}
   5822 do_test boundary3-2.30.le.4 {
   5823   db eval {
   5824     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5825      WHERE t2.a=49
   5826      ORDER BY t1.rowid DESC
   5827   }
   5828 } {49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5829 do_test boundary3-2.30.le.5 {
   5830   db eval {
   5831     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   5832      WHERE t2.a=49
   5833      ORDER BY x
   5834   }
   5835 } {59 60 41 5 31 4 49 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5836 do_test boundary3-2.30.le.10 {
   5837   db eval {
   5838     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5839      WHERE t2.a=49
   5840      ORDER BY t1.rowid
   5841   }
   5842 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49}
   5843 do_test boundary3-2.30.le.11 {
   5844   db eval {
   5845     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   5846      WHERE t2.a=49
   5847      ORDER BY t1.rowid DESC
   5848   }
   5849 } {49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5850 do_test boundary3-2.31.1 {
   5851   db eval {
   5852     SELECT t1.* FROM t1, t2 WHERE t1.rowid=255 AND t2.a=t1.a
   5853   }
   5854 } {30 00000000000000ff}
   5855 do_test boundary3-2.31.2 {
   5856   db eval {
   5857     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00000000000000ff'
   5858   }
   5859 } {255 30}
   5860 do_test boundary3-2.31.3 {
   5861   db eval {
   5862     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=30
   5863   }
   5864 } {255 00000000000000ff}
   5865 do_test boundary3-2.31.gt.1 {
   5866   db eval {
   5867     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5868      WHERE t1.rowid > 255 ORDER BY t2.a
   5869   }
   5870 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 61 62}
   5871 do_test boundary3-2.31.gt.2 {
   5872   db eval {
   5873     SELECT t2.a FROM t2 NATURAL JOIN t1
   5874      WHERE t1.rowid > 255 ORDER BY t1.a DESC
   5875   }
   5876 } {62 61 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   5877 do_test boundary3-2.31.gt.3 {
   5878   db eval {
   5879     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5880      WHERE t2.a=30
   5881      ORDER BY t1.rowid
   5882   }
   5883 } {61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5884 do_test boundary3-2.31.gt.4 {
   5885   db eval {
   5886     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5887      WHERE t2.a=30
   5888      ORDER BY t1.rowid DESC
   5889   }
   5890 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61}
   5891 do_test boundary3-2.31.gt.5 {
   5892   db eval {
   5893     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   5894      WHERE t2.a=30
   5895      ORDER BY x
   5896   }
   5897 } {61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5898 do_test boundary3-2.31.gt.10 {
   5899   db eval {
   5900     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5901      WHERE t2.a=30
   5902      ORDER BY t1.rowid
   5903   }
   5904 } {61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5905 do_test boundary3-2.31.gt.11 {
   5906   db eval {
   5907     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   5908      WHERE t2.a=30
   5909      ORDER BY t1.rowid DESC
   5910   }
   5911 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61}
   5912 do_test boundary3-2.31.ge.1 {
   5913   db eval {
   5914     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5915      WHERE t1.rowid >= 255 ORDER BY t2.a
   5916   }
   5917 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 34 35 36 39 40 42 43 45 46 48 50 51 56 57 61 62}
   5918 do_test boundary3-2.31.ge.2 {
   5919   db eval {
   5920     SELECT t2.a FROM t2 NATURAL JOIN t1
   5921      WHERE t1.rowid >= 255 ORDER BY t1.a DESC
   5922   }
   5923 } {62 61 57 56 51 50 48 46 45 43 42 40 39 36 35 34 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   5924 do_test boundary3-2.31.ge.3 {
   5925   db eval {
   5926     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5927      WHERE t2.a=30
   5928      ORDER BY t1.rowid
   5929   }
   5930 } {30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5931 do_test boundary3-2.31.ge.4 {
   5932   db eval {
   5933     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5934      WHERE t2.a=30
   5935      ORDER BY t1.rowid DESC
   5936   }
   5937 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30}
   5938 do_test boundary3-2.31.ge.5 {
   5939   db eval {
   5940     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   5941      WHERE t2.a=30
   5942      ORDER BY x
   5943   }
   5944 } {30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5945 do_test boundary3-2.31.ge.10 {
   5946   db eval {
   5947     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5948      WHERE t2.a=30
   5949      ORDER BY t1.rowid
   5950   }
   5951 } {30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   5952 do_test boundary3-2.31.ge.11 {
   5953   db eval {
   5954     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   5955      WHERE t2.a=30
   5956      ORDER BY t1.rowid DESC
   5957   }
   5958 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30}
   5959 do_test boundary3-2.31.lt.1 {
   5960   db eval {
   5961     SELECT t2.a FROM t1 JOIN t2 USING(a)
   5962      WHERE t1.rowid < 255 ORDER BY t2.a
   5963   }
   5964 } {1 2 4 5 11 21 29 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 63 64}
   5965 do_test boundary3-2.31.lt.2 {
   5966   db eval {
   5967     SELECT t2.a FROM t2 NATURAL JOIN t1
   5968      WHERE t1.rowid < 255 ORDER BY t1.a DESC
   5969   }
   5970 } {64 63 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 29 21 11 5 4 2 1}
   5971 do_test boundary3-2.31.lt.3 {
   5972   db eval {
   5973     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5974      WHERE t2.a=30
   5975      ORDER BY t1.rowid
   5976   }
   5977 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49}
   5978 do_test boundary3-2.31.lt.4 {
   5979   db eval {
   5980     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5981      WHERE t2.a=30
   5982      ORDER BY t1.rowid DESC
   5983   }
   5984 } {49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   5985 do_test boundary3-2.31.lt.5 {
   5986   db eval {
   5987     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   5988      WHERE t2.a=30
   5989      ORDER BY x
   5990   }
   5991 } {59 60 41 5 31 4 49 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   5992 do_test boundary3-2.31.lt.10 {
   5993   db eval {
   5994     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   5995      WHERE t2.a=30
   5996      ORDER BY t1.rowid
   5997   }
   5998 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49}
   5999 do_test boundary3-2.31.lt.11 {
   6000   db eval {
   6001     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6002      WHERE t2.a=30
   6003      ORDER BY t1.rowid DESC
   6004   }
   6005 } {49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6006 do_test boundary3-2.31.le.1 {
   6007   db eval {
   6008     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6009      WHERE t1.rowid <= 255 ORDER BY t2.a
   6010   }
   6011 } {1 2 4 5 11 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 63 64}
   6012 do_test boundary3-2.31.le.2 {
   6013   db eval {
   6014     SELECT t2.a FROM t2 NATURAL JOIN t1
   6015      WHERE t1.rowid <= 255 ORDER BY t1.a DESC
   6016   }
   6017 } {64 63 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 11 5 4 2 1}
   6018 do_test boundary3-2.31.le.3 {
   6019   db eval {
   6020     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6021      WHERE t2.a=30
   6022      ORDER BY t1.rowid
   6023   }
   6024 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30}
   6025 do_test boundary3-2.31.le.4 {
   6026   db eval {
   6027     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6028      WHERE t2.a=30
   6029      ORDER BY t1.rowid DESC
   6030   }
   6031 } {30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6032 do_test boundary3-2.31.le.5 {
   6033   db eval {
   6034     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6035      WHERE t2.a=30
   6036      ORDER BY x
   6037   }
   6038 } {59 60 41 5 31 4 49 30 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   6039 do_test boundary3-2.31.le.10 {
   6040   db eval {
   6041     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6042      WHERE t2.a=30
   6043      ORDER BY t1.rowid
   6044   }
   6045 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30}
   6046 do_test boundary3-2.31.le.11 {
   6047   db eval {
   6048     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6049      WHERE t2.a=30
   6050      ORDER BY t1.rowid DESC
   6051   }
   6052 } {30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6053 do_test boundary3-2.32.1 {
   6054   db eval {
   6055     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-2147483648 AND t2.a=t1.a
   6056   }
   6057 } {11 ffffffff80000000}
   6058 do_test boundary3-2.32.2 {
   6059   db eval {
   6060     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffff80000000'
   6061   }
   6062 } {-2147483648 11}
   6063 do_test boundary3-2.32.3 {
   6064   db eval {
   6065     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=11
   6066   }
   6067 } {-2147483648 ffffffff80000000}
   6068 do_test boundary3-2.32.gt.1 {
   6069   db eval {
   6070     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6071      WHERE t1.rowid > -2147483648 ORDER BY t2.a
   6072   }
   6073 } {1 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   6074 do_test boundary3-2.32.gt.2 {
   6075   db eval {
   6076     SELECT t2.a FROM t2 NATURAL JOIN t1
   6077      WHERE t1.rowid > -2147483648 ORDER BY t1.a DESC
   6078   }
   6079 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3 1}
   6080 do_test boundary3-2.32.gt.3 {
   6081   db eval {
   6082     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6083      WHERE t2.a=11
   6084      ORDER BY t1.rowid
   6085   }
   6086 } {1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6087 do_test boundary3-2.32.gt.4 {
   6088   db eval {
   6089     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6090      WHERE t2.a=11
   6091      ORDER BY t1.rowid DESC
   6092   }
   6093 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1}
   6094 do_test boundary3-2.32.gt.5 {
   6095   db eval {
   6096     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6097      WHERE t2.a=11
   6098      ORDER BY x
   6099   }
   6100 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 1 37 29 32 54 53 52 33 38}
   6101 do_test boundary3-2.32.gt.10 {
   6102   db eval {
   6103     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6104      WHERE t2.a=11
   6105      ORDER BY t1.rowid
   6106   }
   6107 } {1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6108 do_test boundary3-2.32.gt.11 {
   6109   db eval {
   6110     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6111      WHERE t2.a=11
   6112      ORDER BY t1.rowid DESC
   6113   }
   6114 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1}
   6115 do_test boundary3-2.32.ge.1 {
   6116   db eval {
   6117     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6118      WHERE t1.rowid >= -2147483648 ORDER BY t2.a
   6119   }
   6120 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   6121 do_test boundary3-2.32.ge.2 {
   6122   db eval {
   6123     SELECT t2.a FROM t2 NATURAL JOIN t1
   6124      WHERE t1.rowid >= -2147483648 ORDER BY t1.a DESC
   6125   }
   6126 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   6127 do_test boundary3-2.32.ge.3 {
   6128   db eval {
   6129     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6130      WHERE t2.a=11
   6131      ORDER BY t1.rowid
   6132   }
   6133 } {11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6134 do_test boundary3-2.32.ge.4 {
   6135   db eval {
   6136     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6137      WHERE t2.a=11
   6138      ORDER BY t1.rowid DESC
   6139   }
   6140 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11}
   6141 do_test boundary3-2.32.ge.5 {
   6142   db eval {
   6143     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6144      WHERE t2.a=11
   6145      ORDER BY x
   6146   }
   6147 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 11 1 37 29 32 54 53 52 33 38}
   6148 do_test boundary3-2.32.ge.10 {
   6149   db eval {
   6150     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6151      WHERE t2.a=11
   6152      ORDER BY t1.rowid
   6153   }
   6154 } {11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6155 do_test boundary3-2.32.ge.11 {
   6156   db eval {
   6157     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6158      WHERE t2.a=11
   6159      ORDER BY t1.rowid DESC
   6160   }
   6161 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11}
   6162 do_test boundary3-2.32.lt.1 {
   6163   db eval {
   6164     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6165      WHERE t1.rowid < -2147483648 ORDER BY t2.a
   6166   }
   6167 } {2 21 44 47 55 58 63 64}
   6168 do_test boundary3-2.32.lt.2 {
   6169   db eval {
   6170     SELECT t2.a FROM t2 NATURAL JOIN t1
   6171      WHERE t1.rowid < -2147483648 ORDER BY t1.a DESC
   6172   }
   6173 } {64 63 58 55 47 44 21 2}
   6174 do_test boundary3-2.32.lt.3 {
   6175   db eval {
   6176     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6177      WHERE t2.a=11
   6178      ORDER BY t1.rowid
   6179   }
   6180 } {55 2 64 21 44 58 63 47}
   6181 do_test boundary3-2.32.lt.4 {
   6182   db eval {
   6183     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6184      WHERE t2.a=11
   6185      ORDER BY t1.rowid DESC
   6186   }
   6187 } {47 63 58 44 21 64 2 55}
   6188 do_test boundary3-2.32.lt.5 {
   6189   db eval {
   6190     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6191      WHERE t2.a=11
   6192      ORDER BY x
   6193   }
   6194 } {55 2 64 21 44 58 63 47}
   6195 do_test boundary3-2.32.lt.10 {
   6196   db eval {
   6197     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6198      WHERE t2.a=11
   6199      ORDER BY t1.rowid
   6200   }
   6201 } {55 2 64 21 44 58 63 47}
   6202 do_test boundary3-2.32.lt.11 {
   6203   db eval {
   6204     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6205      WHERE t2.a=11
   6206      ORDER BY t1.rowid DESC
   6207   }
   6208 } {47 63 58 44 21 64 2 55}
   6209 do_test boundary3-2.32.le.1 {
   6210   db eval {
   6211     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6212      WHERE t1.rowid <= -2147483648 ORDER BY t2.a
   6213   }
   6214 } {2 11 21 44 47 55 58 63 64}
   6215 do_test boundary3-2.32.le.2 {
   6216   db eval {
   6217     SELECT t2.a FROM t2 NATURAL JOIN t1
   6218      WHERE t1.rowid <= -2147483648 ORDER BY t1.a DESC
   6219   }
   6220 } {64 63 58 55 47 44 21 11 2}
   6221 do_test boundary3-2.32.le.3 {
   6222   db eval {
   6223     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6224      WHERE t2.a=11
   6225      ORDER BY t1.rowid
   6226   }
   6227 } {55 2 64 21 44 58 63 47 11}
   6228 do_test boundary3-2.32.le.4 {
   6229   db eval {
   6230     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6231      WHERE t2.a=11
   6232      ORDER BY t1.rowid DESC
   6233   }
   6234 } {11 47 63 58 44 21 64 2 55}
   6235 do_test boundary3-2.32.le.5 {
   6236   db eval {
   6237     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6238      WHERE t2.a=11
   6239      ORDER BY x
   6240   }
   6241 } {55 2 64 21 44 58 63 47 11}
   6242 do_test boundary3-2.32.le.10 {
   6243   db eval {
   6244     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6245      WHERE t2.a=11
   6246      ORDER BY t1.rowid
   6247   }
   6248 } {55 2 64 21 44 58 63 47 11}
   6249 do_test boundary3-2.32.le.11 {
   6250   db eval {
   6251     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6252      WHERE t2.a=11
   6253      ORDER BY t1.rowid DESC
   6254   }
   6255 } {11 47 63 58 44 21 64 2 55}
   6256 do_test boundary3-2.33.1 {
   6257   db eval {
   6258     SELECT t1.* FROM t1, t2 WHERE t1.rowid=34359738367 AND t2.a=t1.a
   6259   }
   6260 } {39 00000007ffffffff}
   6261 do_test boundary3-2.33.2 {
   6262   db eval {
   6263     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00000007ffffffff'
   6264   }
   6265 } {34359738367 39}
   6266 do_test boundary3-2.33.3 {
   6267   db eval {
   6268     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=39
   6269   }
   6270 } {34359738367 00000007ffffffff}
   6271 do_test boundary3-2.33.gt.1 {
   6272   db eval {
   6273     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6274      WHERE t1.rowid > 34359738367 ORDER BY t2.a
   6275   }
   6276 } {3 7 10 13 17 19 22 25 26 27 28 34 35 43 45 46 56 57}
   6277 do_test boundary3-2.33.gt.2 {
   6278   db eval {
   6279     SELECT t2.a FROM t2 NATURAL JOIN t1
   6280      WHERE t1.rowid > 34359738367 ORDER BY t1.a DESC
   6281   }
   6282 } {57 56 46 45 43 35 34 28 27 26 25 22 19 17 13 10 7 3}
   6283 do_test boundary3-2.33.gt.3 {
   6284   db eval {
   6285     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6286      WHERE t2.a=39
   6287      ORDER BY t1.rowid
   6288   }
   6289 } {22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6290 do_test boundary3-2.33.gt.4 {
   6291   db eval {
   6292     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6293      WHERE t2.a=39
   6294      ORDER BY t1.rowid DESC
   6295   }
   6296 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22}
   6297 do_test boundary3-2.33.gt.5 {
   6298   db eval {
   6299     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6300      WHERE t2.a=39
   6301      ORDER BY x
   6302   }
   6303 } {22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6304 do_test boundary3-2.33.gt.10 {
   6305   db eval {
   6306     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6307      WHERE t2.a=39
   6308      ORDER BY t1.rowid
   6309   }
   6310 } {22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6311 do_test boundary3-2.33.gt.11 {
   6312   db eval {
   6313     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6314      WHERE t2.a=39
   6315      ORDER BY t1.rowid DESC
   6316   }
   6317 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22}
   6318 do_test boundary3-2.33.ge.1 {
   6319   db eval {
   6320     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6321      WHERE t1.rowid >= 34359738367 ORDER BY t2.a
   6322   }
   6323 } {3 7 10 13 17 19 22 25 26 27 28 34 35 39 43 45 46 56 57}
   6324 do_test boundary3-2.33.ge.2 {
   6325   db eval {
   6326     SELECT t2.a FROM t2 NATURAL JOIN t1
   6327      WHERE t1.rowid >= 34359738367 ORDER BY t1.a DESC
   6328   }
   6329 } {57 56 46 45 43 39 35 34 28 27 26 25 22 19 17 13 10 7 3}
   6330 do_test boundary3-2.33.ge.3 {
   6331   db eval {
   6332     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6333      WHERE t2.a=39
   6334      ORDER BY t1.rowid
   6335   }
   6336 } {39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6337 do_test boundary3-2.33.ge.4 {
   6338   db eval {
   6339     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6340      WHERE t2.a=39
   6341      ORDER BY t1.rowid DESC
   6342   }
   6343 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39}
   6344 do_test boundary3-2.33.ge.5 {
   6345   db eval {
   6346     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6347      WHERE t2.a=39
   6348      ORDER BY x
   6349   }
   6350 } {39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6351 do_test boundary3-2.33.ge.10 {
   6352   db eval {
   6353     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6354      WHERE t2.a=39
   6355      ORDER BY t1.rowid
   6356   }
   6357 } {39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6358 do_test boundary3-2.33.ge.11 {
   6359   db eval {
   6360     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6361      WHERE t2.a=39
   6362      ORDER BY t1.rowid DESC
   6363   }
   6364 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39}
   6365 do_test boundary3-2.33.lt.1 {
   6366   db eval {
   6367     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6368      WHERE t1.rowid < 34359738367 ORDER BY t2.a
   6369   }
   6370 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 23 24 29 30 31 32 33 36 37 38 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   6371 do_test boundary3-2.33.lt.2 {
   6372   db eval {
   6373     SELECT t2.a FROM t2 NATURAL JOIN t1
   6374      WHERE t1.rowid < 34359738367 ORDER BY t1.a DESC
   6375   }
   6376 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 38 37 36 33 32 31 30 29 24 23 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   6377 do_test boundary3-2.33.lt.3 {
   6378   db eval {
   6379     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6380      WHERE t2.a=39
   6381      ORDER BY t1.rowid
   6382   }
   6383 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36}
   6384 do_test boundary3-2.33.lt.4 {
   6385   db eval {
   6386     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6387      WHERE t2.a=39
   6388      ORDER BY t1.rowid DESC
   6389   }
   6390 } {36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6391 do_test boundary3-2.33.lt.5 {
   6392   db eval {
   6393     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6394      WHERE t2.a=39
   6395      ORDER BY x
   6396   }
   6397 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   6398 do_test boundary3-2.33.lt.10 {
   6399   db eval {
   6400     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6401      WHERE t2.a=39
   6402      ORDER BY t1.rowid
   6403   }
   6404 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36}
   6405 do_test boundary3-2.33.lt.11 {
   6406   db eval {
   6407     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6408      WHERE t2.a=39
   6409      ORDER BY t1.rowid DESC
   6410   }
   6411 } {36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6412 do_test boundary3-2.33.le.1 {
   6413   db eval {
   6414     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6415      WHERE t1.rowid <= 34359738367 ORDER BY t2.a
   6416   }
   6417 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 23 24 29 30 31 32 33 36 37 38 39 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   6418 do_test boundary3-2.33.le.2 {
   6419   db eval {
   6420     SELECT t2.a FROM t2 NATURAL JOIN t1
   6421      WHERE t1.rowid <= 34359738367 ORDER BY t1.a DESC
   6422   }
   6423 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 39 38 37 36 33 32 31 30 29 24 23 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   6424 do_test boundary3-2.33.le.3 {
   6425   db eval {
   6426     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6427      WHERE t2.a=39
   6428      ORDER BY t1.rowid
   6429   }
   6430 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39}
   6431 do_test boundary3-2.33.le.4 {
   6432   db eval {
   6433     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6434      WHERE t2.a=39
   6435      ORDER BY t1.rowid DESC
   6436   }
   6437 } {39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6438 do_test boundary3-2.33.le.5 {
   6439   db eval {
   6440     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6441      WHERE t2.a=39
   6442      ORDER BY x
   6443   }
   6444 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   6445 do_test boundary3-2.33.le.10 {
   6446   db eval {
   6447     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6448      WHERE t2.a=39
   6449      ORDER BY t1.rowid
   6450   }
   6451 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39}
   6452 do_test boundary3-2.33.le.11 {
   6453   db eval {
   6454     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6455      WHERE t2.a=39
   6456      ORDER BY t1.rowid DESC
   6457   }
   6458 } {39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   6459 do_test boundary3-2.34.1 {
   6460   db eval {
   6461     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-549755813889 AND t2.a=t1.a
   6462   }
   6463 } {58 ffffff7fffffffff}
   6464 do_test boundary3-2.34.2 {
   6465   db eval {
   6466     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffff7fffffffff'
   6467   }
   6468 } {-549755813889 58}
   6469 do_test boundary3-2.34.3 {
   6470   db eval {
   6471     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=58
   6472   }
   6473 } {-549755813889 ffffff7fffffffff}
   6474 do_test boundary3-2.34.gt.1 {
   6475   db eval {
   6476     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6477      WHERE t1.rowid > -549755813889 ORDER BY t2.a
   6478   }
   6479 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 56 57 59 60 61 62 63}
   6480 do_test boundary3-2.34.gt.2 {
   6481   db eval {
   6482     SELECT t2.a FROM t2 NATURAL JOIN t1
   6483      WHERE t1.rowid > -549755813889 ORDER BY t1.a DESC
   6484   }
   6485 } {63 62 61 60 59 57 56 54 53 52 51 50 49 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   6486 do_test boundary3-2.34.gt.3 {
   6487   db eval {
   6488     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6489      WHERE t2.a=58
   6490      ORDER BY t1.rowid
   6491   }
   6492 } {63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6493 do_test boundary3-2.34.gt.4 {
   6494   db eval {
   6495     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6496      WHERE t2.a=58
   6497      ORDER BY t1.rowid DESC
   6498   }
   6499 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63}
   6500 do_test boundary3-2.34.gt.5 {
   6501   db eval {
   6502     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6503      WHERE t2.a=58
   6504      ORDER BY x
   6505   }
   6506 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 63 47 11 1 37 29 32 54 53 52 33 38}
   6507 do_test boundary3-2.34.gt.10 {
   6508   db eval {
   6509     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6510      WHERE t2.a=58
   6511      ORDER BY t1.rowid
   6512   }
   6513 } {63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6514 do_test boundary3-2.34.gt.11 {
   6515   db eval {
   6516     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6517      WHERE t2.a=58
   6518      ORDER BY t1.rowid DESC
   6519   }
   6520 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63}
   6521 do_test boundary3-2.34.ge.1 {
   6522   db eval {
   6523     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6524      WHERE t1.rowid >= -549755813889 ORDER BY t2.a
   6525   }
   6526 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63}
   6527 do_test boundary3-2.34.ge.2 {
   6528   db eval {
   6529     SELECT t2.a FROM t2 NATURAL JOIN t1
   6530      WHERE t1.rowid >= -549755813889 ORDER BY t1.a DESC
   6531   }
   6532 } {63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   6533 do_test boundary3-2.34.ge.3 {
   6534   db eval {
   6535     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6536      WHERE t2.a=58
   6537      ORDER BY t1.rowid
   6538   }
   6539 } {58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6540 do_test boundary3-2.34.ge.4 {
   6541   db eval {
   6542     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6543      WHERE t2.a=58
   6544      ORDER BY t1.rowid DESC
   6545   }
   6546 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58}
   6547 do_test boundary3-2.34.ge.5 {
   6548   db eval {
   6549     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6550      WHERE t2.a=58
   6551      ORDER BY x
   6552   }
   6553 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 58 63 47 11 1 37 29 32 54 53 52 33 38}
   6554 do_test boundary3-2.34.ge.10 {
   6555   db eval {
   6556     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6557      WHERE t2.a=58
   6558      ORDER BY t1.rowid
   6559   }
   6560 } {58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6561 do_test boundary3-2.34.ge.11 {
   6562   db eval {
   6563     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6564      WHERE t2.a=58
   6565      ORDER BY t1.rowid DESC
   6566   }
   6567 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58}
   6568 do_test boundary3-2.34.lt.1 {
   6569   db eval {
   6570     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6571      WHERE t1.rowid < -549755813889 ORDER BY t2.a
   6572   }
   6573 } {2 21 44 55 64}
   6574 do_test boundary3-2.34.lt.2 {
   6575   db eval {
   6576     SELECT t2.a FROM t2 NATURAL JOIN t1
   6577      WHERE t1.rowid < -549755813889 ORDER BY t1.a DESC
   6578   }
   6579 } {64 55 44 21 2}
   6580 do_test boundary3-2.34.lt.3 {
   6581   db eval {
   6582     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6583      WHERE t2.a=58
   6584      ORDER BY t1.rowid
   6585   }
   6586 } {55 2 64 21 44}
   6587 do_test boundary3-2.34.lt.4 {
   6588   db eval {
   6589     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6590      WHERE t2.a=58
   6591      ORDER BY t1.rowid DESC
   6592   }
   6593 } {44 21 64 2 55}
   6594 do_test boundary3-2.34.lt.5 {
   6595   db eval {
   6596     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6597      WHERE t2.a=58
   6598      ORDER BY x
   6599   }
   6600 } {55 2 64 21 44}
   6601 do_test boundary3-2.34.lt.10 {
   6602   db eval {
   6603     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6604      WHERE t2.a=58
   6605      ORDER BY t1.rowid
   6606   }
   6607 } {55 2 64 21 44}
   6608 do_test boundary3-2.34.lt.11 {
   6609   db eval {
   6610     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6611      WHERE t2.a=58
   6612      ORDER BY t1.rowid DESC
   6613   }
   6614 } {44 21 64 2 55}
   6615 do_test boundary3-2.34.le.1 {
   6616   db eval {
   6617     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6618      WHERE t1.rowid <= -549755813889 ORDER BY t2.a
   6619   }
   6620 } {2 21 44 55 58 64}
   6621 do_test boundary3-2.34.le.2 {
   6622   db eval {
   6623     SELECT t2.a FROM t2 NATURAL JOIN t1
   6624      WHERE t1.rowid <= -549755813889 ORDER BY t1.a DESC
   6625   }
   6626 } {64 58 55 44 21 2}
   6627 do_test boundary3-2.34.le.3 {
   6628   db eval {
   6629     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6630      WHERE t2.a=58
   6631      ORDER BY t1.rowid
   6632   }
   6633 } {55 2 64 21 44 58}
   6634 do_test boundary3-2.34.le.4 {
   6635   db eval {
   6636     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6637      WHERE t2.a=58
   6638      ORDER BY t1.rowid DESC
   6639   }
   6640 } {58 44 21 64 2 55}
   6641 do_test boundary3-2.34.le.5 {
   6642   db eval {
   6643     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6644      WHERE t2.a=58
   6645      ORDER BY x
   6646   }
   6647 } {55 2 64 21 44 58}
   6648 do_test boundary3-2.34.le.10 {
   6649   db eval {
   6650     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6651      WHERE t2.a=58
   6652      ORDER BY t1.rowid
   6653   }
   6654 } {55 2 64 21 44 58}
   6655 do_test boundary3-2.34.le.11 {
   6656   db eval {
   6657     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6658      WHERE t2.a=58
   6659      ORDER BY t1.rowid DESC
   6660   }
   6661 } {58 44 21 64 2 55}
   6662 do_test boundary3-2.35.1 {
   6663   db eval {
   6664     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-32768 AND t2.a=t1.a
   6665   }
   6666 } {32 ffffffffffff8000}
   6667 do_test boundary3-2.35.2 {
   6668   db eval {
   6669     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffffff8000'
   6670   }
   6671 } {-32768 32}
   6672 do_test boundary3-2.35.3 {
   6673   db eval {
   6674     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=32
   6675   }
   6676 } {-32768 ffffffffffff8000}
   6677 do_test boundary3-2.35.gt.1 {
   6678   db eval {
   6679     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6680      WHERE t1.rowid > -32768 ORDER BY t2.a
   6681   }
   6682 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   6683 do_test boundary3-2.35.gt.2 {
   6684   db eval {
   6685     SELECT t2.a FROM t2 NATURAL JOIN t1
   6686      WHERE t1.rowid > -32768 ORDER BY t1.a DESC
   6687   }
   6688 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   6689 do_test boundary3-2.35.gt.3 {
   6690   db eval {
   6691     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6692      WHERE t2.a=32
   6693      ORDER BY t1.rowid
   6694   }
   6695 } {54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6696 do_test boundary3-2.35.gt.4 {
   6697   db eval {
   6698     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6699      WHERE t2.a=32
   6700      ORDER BY t1.rowid DESC
   6701   }
   6702 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54}
   6703 do_test boundary3-2.35.gt.5 {
   6704   db eval {
   6705     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6706      WHERE t2.a=32
   6707      ORDER BY x
   6708   }
   6709 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 54 53 52 33 38}
   6710 do_test boundary3-2.35.gt.10 {
   6711   db eval {
   6712     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6713      WHERE t2.a=32
   6714      ORDER BY t1.rowid
   6715   }
   6716 } {54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6717 do_test boundary3-2.35.gt.11 {
   6718   db eval {
   6719     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6720      WHERE t2.a=32
   6721      ORDER BY t1.rowid DESC
   6722   }
   6723 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54}
   6724 do_test boundary3-2.35.ge.1 {
   6725   db eval {
   6726     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6727      WHERE t1.rowid >= -32768 ORDER BY t2.a
   6728   }
   6729 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 32 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   6730 do_test boundary3-2.35.ge.2 {
   6731   db eval {
   6732     SELECT t2.a FROM t2 NATURAL JOIN t1
   6733      WHERE t1.rowid >= -32768 ORDER BY t1.a DESC
   6734   }
   6735 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 32 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   6736 do_test boundary3-2.35.ge.3 {
   6737   db eval {
   6738     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6739      WHERE t2.a=32
   6740      ORDER BY t1.rowid
   6741   }
   6742 } {32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6743 do_test boundary3-2.35.ge.4 {
   6744   db eval {
   6745     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6746      WHERE t2.a=32
   6747      ORDER BY t1.rowid DESC
   6748   }
   6749 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32}
   6750 do_test boundary3-2.35.ge.5 {
   6751   db eval {
   6752     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6753      WHERE t2.a=32
   6754      ORDER BY x
   6755   }
   6756 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 32 54 53 52 33 38}
   6757 do_test boundary3-2.35.ge.10 {
   6758   db eval {
   6759     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6760      WHERE t2.a=32
   6761      ORDER BY t1.rowid
   6762   }
   6763 } {32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6764 do_test boundary3-2.35.ge.11 {
   6765   db eval {
   6766     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6767      WHERE t2.a=32
   6768      ORDER BY t1.rowid DESC
   6769   }
   6770 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32}
   6771 do_test boundary3-2.35.lt.1 {
   6772   db eval {
   6773     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6774      WHERE t1.rowid < -32768 ORDER BY t2.a
   6775   }
   6776 } {1 2 11 21 29 37 44 47 55 58 63 64}
   6777 do_test boundary3-2.35.lt.2 {
   6778   db eval {
   6779     SELECT t2.a FROM t2 NATURAL JOIN t1
   6780      WHERE t1.rowid < -32768 ORDER BY t1.a DESC
   6781   }
   6782 } {64 63 58 55 47 44 37 29 21 11 2 1}
   6783 do_test boundary3-2.35.lt.3 {
   6784   db eval {
   6785     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6786      WHERE t2.a=32
   6787      ORDER BY t1.rowid
   6788   }
   6789 } {55 2 64 21 44 58 63 47 11 1 37 29}
   6790 do_test boundary3-2.35.lt.4 {
   6791   db eval {
   6792     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6793      WHERE t2.a=32
   6794      ORDER BY t1.rowid DESC
   6795   }
   6796 } {29 37 1 11 47 63 58 44 21 64 2 55}
   6797 do_test boundary3-2.35.lt.5 {
   6798   db eval {
   6799     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6800      WHERE t2.a=32
   6801      ORDER BY x
   6802   }
   6803 } {55 2 64 21 44 58 63 47 11 1 37 29}
   6804 do_test boundary3-2.35.lt.10 {
   6805   db eval {
   6806     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6807      WHERE t2.a=32
   6808      ORDER BY t1.rowid
   6809   }
   6810 } {55 2 64 21 44 58 63 47 11 1 37 29}
   6811 do_test boundary3-2.35.lt.11 {
   6812   db eval {
   6813     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   6814      WHERE t2.a=32
   6815      ORDER BY t1.rowid DESC
   6816   }
   6817 } {29 37 1 11 47 63 58 44 21 64 2 55}
   6818 do_test boundary3-2.35.le.1 {
   6819   db eval {
   6820     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6821      WHERE t1.rowid <= -32768 ORDER BY t2.a
   6822   }
   6823 } {1 2 11 21 29 32 37 44 47 55 58 63 64}
   6824 do_test boundary3-2.35.le.2 {
   6825   db eval {
   6826     SELECT t2.a FROM t2 NATURAL JOIN t1
   6827      WHERE t1.rowid <= -32768 ORDER BY t1.a DESC
   6828   }
   6829 } {64 63 58 55 47 44 37 32 29 21 11 2 1}
   6830 do_test boundary3-2.35.le.3 {
   6831   db eval {
   6832     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6833      WHERE t2.a=32
   6834      ORDER BY t1.rowid
   6835   }
   6836 } {55 2 64 21 44 58 63 47 11 1 37 29 32}
   6837 do_test boundary3-2.35.le.4 {
   6838   db eval {
   6839     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6840      WHERE t2.a=32
   6841      ORDER BY t1.rowid DESC
   6842   }
   6843 } {32 29 37 1 11 47 63 58 44 21 64 2 55}
   6844 do_test boundary3-2.35.le.5 {
   6845   db eval {
   6846     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   6847      WHERE t2.a=32
   6848      ORDER BY x
   6849   }
   6850 } {55 2 64 21 44 58 63 47 11 1 37 29 32}
   6851 do_test boundary3-2.35.le.10 {
   6852   db eval {
   6853     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6854      WHERE t2.a=32
   6855      ORDER BY t1.rowid
   6856   }
   6857 } {55 2 64 21 44 58 63 47 11 1 37 29 32}
   6858 do_test boundary3-2.35.le.11 {
   6859   db eval {
   6860     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   6861      WHERE t2.a=32
   6862      ORDER BY t1.rowid DESC
   6863   }
   6864 } {32 29 37 1 11 47 63 58 44 21 64 2 55}
   6865 do_test boundary3-2.36.1 {
   6866   db eval {
   6867     SELECT t1.* FROM t1, t2 WHERE t1.rowid=2147483647 AND t2.a=t1.a
   6868   }
   6869 } {20 000000007fffffff}
   6870 do_test boundary3-2.36.2 {
   6871   db eval {
   6872     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='000000007fffffff'
   6873   }
   6874 } {2147483647 20}
   6875 do_test boundary3-2.36.3 {
   6876   db eval {
   6877     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=20
   6878   }
   6879 } {2147483647 000000007fffffff}
   6880 do_test boundary3-2.36.gt.1 {
   6881   db eval {
   6882     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6883      WHERE t1.rowid > 2147483647 ORDER BY t2.a
   6884   }
   6885 } {3 7 10 13 14 17 19 22 25 26 27 28 34 35 36 39 43 45 46 51 56 57}
   6886 do_test boundary3-2.36.gt.2 {
   6887   db eval {
   6888     SELECT t2.a FROM t2 NATURAL JOIN t1
   6889      WHERE t1.rowid > 2147483647 ORDER BY t1.a DESC
   6890   }
   6891 } {57 56 51 46 45 43 39 36 35 34 28 27 26 25 22 19 17 14 13 10 7 3}
   6892 do_test boundary3-2.36.gt.3 {
   6893   db eval {
   6894     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6895      WHERE t2.a=20
   6896      ORDER BY t1.rowid
   6897   }
   6898 } {51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6899 do_test boundary3-2.36.gt.4 {
   6900   db eval {
   6901     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6902      WHERE t2.a=20
   6903      ORDER BY t1.rowid DESC
   6904   }
   6905 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51}
   6906 do_test boundary3-2.36.gt.5 {
   6907   db eval {
   6908     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   6909      WHERE t2.a=20
   6910      ORDER BY x
   6911   }
   6912 } {51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6913 do_test boundary3-2.36.gt.10 {
   6914   db eval {
   6915     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6916      WHERE t2.a=20
   6917      ORDER BY t1.rowid
   6918   }
   6919 } {51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6920 do_test boundary3-2.36.gt.11 {
   6921   db eval {
   6922     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   6923      WHERE t2.a=20
   6924      ORDER BY t1.rowid DESC
   6925   }
   6926 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51}
   6927 do_test boundary3-2.36.ge.1 {
   6928   db eval {
   6929     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6930      WHERE t1.rowid >= 2147483647 ORDER BY t2.a
   6931   }
   6932 } {3 7 10 13 14 17 19 20 22 25 26 27 28 34 35 36 39 43 45 46 51 56 57}
   6933 do_test boundary3-2.36.ge.2 {
   6934   db eval {
   6935     SELECT t2.a FROM t2 NATURAL JOIN t1
   6936      WHERE t1.rowid >= 2147483647 ORDER BY t1.a DESC
   6937   }
   6938 } {57 56 51 46 45 43 39 36 35 34 28 27 26 25 22 20 19 17 14 13 10 7 3}
   6939 do_test boundary3-2.36.ge.3 {
   6940   db eval {
   6941     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6942      WHERE t2.a=20
   6943      ORDER BY t1.rowid
   6944   }
   6945 } {20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6946 do_test boundary3-2.36.ge.4 {
   6947   db eval {
   6948     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6949      WHERE t2.a=20
   6950      ORDER BY t1.rowid DESC
   6951   }
   6952 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20}
   6953 do_test boundary3-2.36.ge.5 {
   6954   db eval {
   6955     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   6956      WHERE t2.a=20
   6957      ORDER BY x
   6958   }
   6959 } {20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6960 do_test boundary3-2.36.ge.10 {
   6961   db eval {
   6962     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6963      WHERE t2.a=20
   6964      ORDER BY t1.rowid
   6965   }
   6966 } {20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   6967 do_test boundary3-2.36.ge.11 {
   6968   db eval {
   6969     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   6970      WHERE t2.a=20
   6971      ORDER BY t1.rowid DESC
   6972   }
   6973 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20}
   6974 do_test boundary3-2.36.lt.1 {
   6975   db eval {
   6976     SELECT t2.a FROM t1 JOIN t2 USING(a)
   6977      WHERE t1.rowid < 2147483647 ORDER BY t2.a
   6978   }
   6979 } {1 2 4 5 6 8 9 11 12 15 16 18 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   6980 do_test boundary3-2.36.lt.2 {
   6981   db eval {
   6982     SELECT t2.a FROM t2 NATURAL JOIN t1
   6983      WHERE t1.rowid < 2147483647 ORDER BY t1.a DESC
   6984   }
   6985 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 18 16 15 12 11 9 8 6 5 4 2 1}
   6986 do_test boundary3-2.36.lt.3 {
   6987   db eval {
   6988     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6989      WHERE t2.a=20
   6990      ORDER BY t1.rowid
   6991   }
   6992 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40}
   6993 do_test boundary3-2.36.lt.4 {
   6994   db eval {
   6995     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   6996      WHERE t2.a=20
   6997      ORDER BY t1.rowid DESC
   6998   }
   6999 } {40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7000 do_test boundary3-2.36.lt.5 {
   7001   db eval {
   7002     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7003      WHERE t2.a=20
   7004      ORDER BY x
   7005   }
   7006 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7007 do_test boundary3-2.36.lt.10 {
   7008   db eval {
   7009     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7010      WHERE t2.a=20
   7011      ORDER BY t1.rowid
   7012   }
   7013 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40}
   7014 do_test boundary3-2.36.lt.11 {
   7015   db eval {
   7016     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7017      WHERE t2.a=20
   7018      ORDER BY t1.rowid DESC
   7019   }
   7020 } {40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7021 do_test boundary3-2.36.le.1 {
   7022   db eval {
   7023     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7024      WHERE t1.rowid <= 2147483647 ORDER BY t2.a
   7025   }
   7026 } {1 2 4 5 6 8 9 11 12 15 16 18 20 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   7027 do_test boundary3-2.36.le.2 {
   7028   db eval {
   7029     SELECT t2.a FROM t2 NATURAL JOIN t1
   7030      WHERE t1.rowid <= 2147483647 ORDER BY t1.a DESC
   7031   }
   7032 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 20 18 16 15 12 11 9 8 6 5 4 2 1}
   7033 do_test boundary3-2.36.le.3 {
   7034   db eval {
   7035     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7036      WHERE t2.a=20
   7037      ORDER BY t1.rowid
   7038   }
   7039 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20}
   7040 do_test boundary3-2.36.le.4 {
   7041   db eval {
   7042     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7043      WHERE t2.a=20
   7044      ORDER BY t1.rowid DESC
   7045   }
   7046 } {20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7047 do_test boundary3-2.36.le.5 {
   7048   db eval {
   7049     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7050      WHERE t2.a=20
   7051      ORDER BY x
   7052   }
   7053 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7054 do_test boundary3-2.36.le.10 {
   7055   db eval {
   7056     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7057      WHERE t2.a=20
   7058      ORDER BY t1.rowid
   7059   }
   7060 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20}
   7061 do_test boundary3-2.36.le.11 {
   7062   db eval {
   7063     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7064      WHERE t2.a=20
   7065      ORDER BY t1.rowid DESC
   7066   }
   7067 } {20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7068 do_test boundary3-2.37.1 {
   7069   db eval {
   7070     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-129 AND t2.a=t1.a
   7071   }
   7072 } {54 ffffffffffffff7f}
   7073 do_test boundary3-2.37.2 {
   7074   db eval {
   7075     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffffffff7f'
   7076   }
   7077 } {-129 54}
   7078 do_test boundary3-2.37.3 {
   7079   db eval {
   7080     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=54
   7081   }
   7082 } {-129 ffffffffffffff7f}
   7083 do_test boundary3-2.37.gt.1 {
   7084   db eval {
   7085     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7086      WHERE t1.rowid > -129 ORDER BY t2.a
   7087   }
   7088 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 56 57 59 60 61 62}
   7089 do_test boundary3-2.37.gt.2 {
   7090   db eval {
   7091     SELECT t2.a FROM t2 NATURAL JOIN t1
   7092      WHERE t1.rowid > -129 ORDER BY t1.a DESC
   7093   }
   7094 } {62 61 60 59 57 56 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   7095 do_test boundary3-2.37.gt.3 {
   7096   db eval {
   7097     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7098      WHERE t2.a=54
   7099      ORDER BY t1.rowid
   7100   }
   7101 } {53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7102 do_test boundary3-2.37.gt.4 {
   7103   db eval {
   7104     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7105      WHERE t2.a=54
   7106      ORDER BY t1.rowid DESC
   7107   }
   7108 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53}
   7109 do_test boundary3-2.37.gt.5 {
   7110   db eval {
   7111     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7112      WHERE t2.a=54
   7113      ORDER BY x
   7114   }
   7115 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 53 52 33 38}
   7116 do_test boundary3-2.37.gt.10 {
   7117   db eval {
   7118     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7119      WHERE t2.a=54
   7120      ORDER BY t1.rowid
   7121   }
   7122 } {53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7123 do_test boundary3-2.37.gt.11 {
   7124   db eval {
   7125     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7126      WHERE t2.a=54
   7127      ORDER BY t1.rowid DESC
   7128   }
   7129 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53}
   7130 do_test boundary3-2.37.ge.1 {
   7131   db eval {
   7132     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7133      WHERE t1.rowid >= -129 ORDER BY t2.a
   7134   }
   7135 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   7136 do_test boundary3-2.37.ge.2 {
   7137   db eval {
   7138     SELECT t2.a FROM t2 NATURAL JOIN t1
   7139      WHERE t1.rowid >= -129 ORDER BY t1.a DESC
   7140   }
   7141 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   7142 do_test boundary3-2.37.ge.3 {
   7143   db eval {
   7144     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7145      WHERE t2.a=54
   7146      ORDER BY t1.rowid
   7147   }
   7148 } {54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7149 do_test boundary3-2.37.ge.4 {
   7150   db eval {
   7151     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7152      WHERE t2.a=54
   7153      ORDER BY t1.rowid DESC
   7154   }
   7155 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54}
   7156 do_test boundary3-2.37.ge.5 {
   7157   db eval {
   7158     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7159      WHERE t2.a=54
   7160      ORDER BY x
   7161   }
   7162 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 54 53 52 33 38}
   7163 do_test boundary3-2.37.ge.10 {
   7164   db eval {
   7165     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7166      WHERE t2.a=54
   7167      ORDER BY t1.rowid
   7168   }
   7169 } {54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7170 do_test boundary3-2.37.ge.11 {
   7171   db eval {
   7172     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7173      WHERE t2.a=54
   7174      ORDER BY t1.rowid DESC
   7175   }
   7176 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54}
   7177 do_test boundary3-2.37.lt.1 {
   7178   db eval {
   7179     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7180      WHERE t1.rowid < -129 ORDER BY t2.a
   7181   }
   7182 } {1 2 11 21 29 32 37 44 47 55 58 63 64}
   7183 do_test boundary3-2.37.lt.2 {
   7184   db eval {
   7185     SELECT t2.a FROM t2 NATURAL JOIN t1
   7186      WHERE t1.rowid < -129 ORDER BY t1.a DESC
   7187   }
   7188 } {64 63 58 55 47 44 37 32 29 21 11 2 1}
   7189 do_test boundary3-2.37.lt.3 {
   7190   db eval {
   7191     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7192      WHERE t2.a=54
   7193      ORDER BY t1.rowid
   7194   }
   7195 } {55 2 64 21 44 58 63 47 11 1 37 29 32}
   7196 do_test boundary3-2.37.lt.4 {
   7197   db eval {
   7198     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7199      WHERE t2.a=54
   7200      ORDER BY t1.rowid DESC
   7201   }
   7202 } {32 29 37 1 11 47 63 58 44 21 64 2 55}
   7203 do_test boundary3-2.37.lt.5 {
   7204   db eval {
   7205     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7206      WHERE t2.a=54
   7207      ORDER BY x
   7208   }
   7209 } {55 2 64 21 44 58 63 47 11 1 37 29 32}
   7210 do_test boundary3-2.37.lt.10 {
   7211   db eval {
   7212     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7213      WHERE t2.a=54
   7214      ORDER BY t1.rowid
   7215   }
   7216 } {55 2 64 21 44 58 63 47 11 1 37 29 32}
   7217 do_test boundary3-2.37.lt.11 {
   7218   db eval {
   7219     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7220      WHERE t2.a=54
   7221      ORDER BY t1.rowid DESC
   7222   }
   7223 } {32 29 37 1 11 47 63 58 44 21 64 2 55}
   7224 do_test boundary3-2.37.le.1 {
   7225   db eval {
   7226     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7227      WHERE t1.rowid <= -129 ORDER BY t2.a
   7228   }
   7229 } {1 2 11 21 29 32 37 44 47 54 55 58 63 64}
   7230 do_test boundary3-2.37.le.2 {
   7231   db eval {
   7232     SELECT t2.a FROM t2 NATURAL JOIN t1
   7233      WHERE t1.rowid <= -129 ORDER BY t1.a DESC
   7234   }
   7235 } {64 63 58 55 54 47 44 37 32 29 21 11 2 1}
   7236 do_test boundary3-2.37.le.3 {
   7237   db eval {
   7238     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7239      WHERE t2.a=54
   7240      ORDER BY t1.rowid
   7241   }
   7242 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54}
   7243 do_test boundary3-2.37.le.4 {
   7244   db eval {
   7245     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7246      WHERE t2.a=54
   7247      ORDER BY t1.rowid DESC
   7248   }
   7249 } {54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7250 do_test boundary3-2.37.le.5 {
   7251   db eval {
   7252     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7253      WHERE t2.a=54
   7254      ORDER BY x
   7255   }
   7256 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54}
   7257 do_test boundary3-2.37.le.10 {
   7258   db eval {
   7259     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7260      WHERE t2.a=54
   7261      ORDER BY t1.rowid
   7262   }
   7263 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54}
   7264 do_test boundary3-2.37.le.11 {
   7265   db eval {
   7266     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7267      WHERE t2.a=54
   7268      ORDER BY t1.rowid DESC
   7269   }
   7270 } {54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7271 do_test boundary3-2.38.1 {
   7272   db eval {
   7273     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-128 AND t2.a=t1.a
   7274   }
   7275 } {53 ffffffffffffff80}
   7276 do_test boundary3-2.38.2 {
   7277   db eval {
   7278     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffffffff80'
   7279   }
   7280 } {-128 53}
   7281 do_test boundary3-2.38.3 {
   7282   db eval {
   7283     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=53
   7284   }
   7285 } {-128 ffffffffffffff80}
   7286 do_test boundary3-2.38.gt.1 {
   7287   db eval {
   7288     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7289      WHERE t1.rowid > -128 ORDER BY t2.a
   7290   }
   7291 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 56 57 59 60 61 62}
   7292 do_test boundary3-2.38.gt.2 {
   7293   db eval {
   7294     SELECT t2.a FROM t2 NATURAL JOIN t1
   7295      WHERE t1.rowid > -128 ORDER BY t1.a DESC
   7296   }
   7297 } {62 61 60 59 57 56 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   7298 do_test boundary3-2.38.gt.3 {
   7299   db eval {
   7300     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7301      WHERE t2.a=53
   7302      ORDER BY t1.rowid
   7303   }
   7304 } {52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7305 do_test boundary3-2.38.gt.4 {
   7306   db eval {
   7307     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7308      WHERE t2.a=53
   7309      ORDER BY t1.rowid DESC
   7310   }
   7311 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52}
   7312 do_test boundary3-2.38.gt.5 {
   7313   db eval {
   7314     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7315      WHERE t2.a=53
   7316      ORDER BY x
   7317   }
   7318 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 52 33 38}
   7319 do_test boundary3-2.38.gt.10 {
   7320   db eval {
   7321     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7322      WHERE t2.a=53
   7323      ORDER BY t1.rowid
   7324   }
   7325 } {52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7326 do_test boundary3-2.38.gt.11 {
   7327   db eval {
   7328     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7329      WHERE t2.a=53
   7330      ORDER BY t1.rowid DESC
   7331   }
   7332 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52}
   7333 do_test boundary3-2.38.ge.1 {
   7334   db eval {
   7335     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7336      WHERE t1.rowid >= -128 ORDER BY t2.a
   7337   }
   7338 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 33 34 35 36 38 39 40 41 42 43 45 46 48 49 50 51 52 53 56 57 59 60 61 62}
   7339 do_test boundary3-2.38.ge.2 {
   7340   db eval {
   7341     SELECT t2.a FROM t2 NATURAL JOIN t1
   7342      WHERE t1.rowid >= -128 ORDER BY t1.a DESC
   7343   }
   7344 } {62 61 60 59 57 56 53 52 51 50 49 48 46 45 43 42 41 40 39 38 36 35 34 33 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   7345 do_test boundary3-2.38.ge.3 {
   7346   db eval {
   7347     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7348      WHERE t2.a=53
   7349      ORDER BY t1.rowid
   7350   }
   7351 } {53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7352 do_test boundary3-2.38.ge.4 {
   7353   db eval {
   7354     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7355      WHERE t2.a=53
   7356      ORDER BY t1.rowid DESC
   7357   }
   7358 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53}
   7359 do_test boundary3-2.38.ge.5 {
   7360   db eval {
   7361     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7362      WHERE t2.a=53
   7363      ORDER BY x
   7364   }
   7365 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 53 52 33 38}
   7366 do_test boundary3-2.38.ge.10 {
   7367   db eval {
   7368     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7369      WHERE t2.a=53
   7370      ORDER BY t1.rowid
   7371   }
   7372 } {53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7373 do_test boundary3-2.38.ge.11 {
   7374   db eval {
   7375     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7376      WHERE t2.a=53
   7377      ORDER BY t1.rowid DESC
   7378   }
   7379 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53}
   7380 do_test boundary3-2.38.lt.1 {
   7381   db eval {
   7382     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7383      WHERE t1.rowid < -128 ORDER BY t2.a
   7384   }
   7385 } {1 2 11 21 29 32 37 44 47 54 55 58 63 64}
   7386 do_test boundary3-2.38.lt.2 {
   7387   db eval {
   7388     SELECT t2.a FROM t2 NATURAL JOIN t1
   7389      WHERE t1.rowid < -128 ORDER BY t1.a DESC
   7390   }
   7391 } {64 63 58 55 54 47 44 37 32 29 21 11 2 1}
   7392 do_test boundary3-2.38.lt.3 {
   7393   db eval {
   7394     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7395      WHERE t2.a=53
   7396      ORDER BY t1.rowid
   7397   }
   7398 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54}
   7399 do_test boundary3-2.38.lt.4 {
   7400   db eval {
   7401     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7402      WHERE t2.a=53
   7403      ORDER BY t1.rowid DESC
   7404   }
   7405 } {54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7406 do_test boundary3-2.38.lt.5 {
   7407   db eval {
   7408     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7409      WHERE t2.a=53
   7410      ORDER BY x
   7411   }
   7412 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54}
   7413 do_test boundary3-2.38.lt.10 {
   7414   db eval {
   7415     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7416      WHERE t2.a=53
   7417      ORDER BY t1.rowid
   7418   }
   7419 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54}
   7420 do_test boundary3-2.38.lt.11 {
   7421   db eval {
   7422     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7423      WHERE t2.a=53
   7424      ORDER BY t1.rowid DESC
   7425   }
   7426 } {54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7427 do_test boundary3-2.38.le.1 {
   7428   db eval {
   7429     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7430      WHERE t1.rowid <= -128 ORDER BY t2.a
   7431   }
   7432 } {1 2 11 21 29 32 37 44 47 53 54 55 58 63 64}
   7433 do_test boundary3-2.38.le.2 {
   7434   db eval {
   7435     SELECT t2.a FROM t2 NATURAL JOIN t1
   7436      WHERE t1.rowid <= -128 ORDER BY t1.a DESC
   7437   }
   7438 } {64 63 58 55 54 53 47 44 37 32 29 21 11 2 1}
   7439 do_test boundary3-2.38.le.3 {
   7440   db eval {
   7441     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7442      WHERE t2.a=53
   7443      ORDER BY t1.rowid
   7444   }
   7445 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53}
   7446 do_test boundary3-2.38.le.4 {
   7447   db eval {
   7448     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7449      WHERE t2.a=53
   7450      ORDER BY t1.rowid DESC
   7451   }
   7452 } {53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7453 do_test boundary3-2.38.le.5 {
   7454   db eval {
   7455     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7456      WHERE t2.a=53
   7457      ORDER BY x
   7458   }
   7459 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53}
   7460 do_test boundary3-2.38.le.10 {
   7461   db eval {
   7462     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7463      WHERE t2.a=53
   7464      ORDER BY t1.rowid
   7465   }
   7466 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53}
   7467 do_test boundary3-2.38.le.11 {
   7468   db eval {
   7469     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7470      WHERE t2.a=53
   7471      ORDER BY t1.rowid DESC
   7472   }
   7473 } {53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7474 do_test boundary3-2.39.1 {
   7475   db eval {
   7476     SELECT t1.* FROM t1, t2 WHERE t1.rowid=72057594037927936 AND t2.a=t1.a
   7477   }
   7478 } {28 0100000000000000}
   7479 do_test boundary3-2.39.2 {
   7480   db eval {
   7481     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0100000000000000'
   7482   }
   7483 } {72057594037927936 28}
   7484 do_test boundary3-2.39.3 {
   7485   db eval {
   7486     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=28
   7487   }
   7488 } {72057594037927936 0100000000000000}
   7489 do_test boundary3-2.39.gt.1 {
   7490   db eval {
   7491     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7492      WHERE t1.rowid > 72057594037927936 ORDER BY t2.a
   7493   }
   7494 } {3}
   7495 do_test boundary3-2.39.gt.2 {
   7496   db eval {
   7497     SELECT t2.a FROM t2 NATURAL JOIN t1
   7498      WHERE t1.rowid > 72057594037927936 ORDER BY t1.a DESC
   7499   }
   7500 } {3}
   7501 do_test boundary3-2.39.gt.3 {
   7502   db eval {
   7503     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7504      WHERE t2.a=28
   7505      ORDER BY t1.rowid
   7506   }
   7507 } {3}
   7508 do_test boundary3-2.39.gt.4 {
   7509   db eval {
   7510     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7511      WHERE t2.a=28
   7512      ORDER BY t1.rowid DESC
   7513   }
   7514 } {3}
   7515 do_test boundary3-2.39.gt.5 {
   7516   db eval {
   7517     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7518      WHERE t2.a=28
   7519      ORDER BY x
   7520   }
   7521 } {3}
   7522 do_test boundary3-2.39.ge.1 {
   7523   db eval {
   7524     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7525      WHERE t1.rowid >= 72057594037927936 ORDER BY t2.a
   7526   }
   7527 } {3 28}
   7528 do_test boundary3-2.39.ge.2 {
   7529   db eval {
   7530     SELECT t2.a FROM t2 NATURAL JOIN t1
   7531      WHERE t1.rowid >= 72057594037927936 ORDER BY t1.a DESC
   7532   }
   7533 } {28 3}
   7534 do_test boundary3-2.39.ge.3 {
   7535   db eval {
   7536     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7537      WHERE t2.a=28
   7538      ORDER BY t1.rowid
   7539   }
   7540 } {28 3}
   7541 do_test boundary3-2.39.ge.4 {
   7542   db eval {
   7543     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7544      WHERE t2.a=28
   7545      ORDER BY t1.rowid DESC
   7546   }
   7547 } {3 28}
   7548 do_test boundary3-2.39.ge.5 {
   7549   db eval {
   7550     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7551      WHERE t2.a=28
   7552      ORDER BY x
   7553   }
   7554 } {28 3}
   7555 do_test boundary3-2.39.lt.1 {
   7556   db eval {
   7557     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7558      WHERE t1.rowid < 72057594037927936 ORDER BY t2.a
   7559   }
   7560 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   7561 do_test boundary3-2.39.lt.2 {
   7562   db eval {
   7563     SELECT t2.a FROM t2 NATURAL JOIN t1
   7564      WHERE t1.rowid < 72057594037927936 ORDER BY t1.a DESC
   7565   }
   7566 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   7567 do_test boundary3-2.39.lt.3 {
   7568   db eval {
   7569     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7570      WHERE t2.a=28
   7571      ORDER BY t1.rowid
   7572   }
   7573 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17}
   7574 do_test boundary3-2.39.lt.4 {
   7575   db eval {
   7576     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7577      WHERE t2.a=28
   7578      ORDER BY t1.rowid DESC
   7579   }
   7580 } {17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7581 do_test boundary3-2.39.lt.5 {
   7582   db eval {
   7583     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7584      WHERE t2.a=28
   7585      ORDER BY x
   7586   }
   7587 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7588 do_test boundary3-2.39.le.1 {
   7589   db eval {
   7590     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7591      WHERE t1.rowid <= 72057594037927936 ORDER BY t2.a
   7592   }
   7593 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   7594 do_test boundary3-2.39.le.2 {
   7595   db eval {
   7596     SELECT t2.a FROM t2 NATURAL JOIN t1
   7597      WHERE t1.rowid <= 72057594037927936 ORDER BY t1.a DESC
   7598   }
   7599 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   7600 do_test boundary3-2.39.le.3 {
   7601   db eval {
   7602     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7603      WHERE t2.a=28
   7604      ORDER BY t1.rowid
   7605   }
   7606 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28}
   7607 do_test boundary3-2.39.le.4 {
   7608   db eval {
   7609     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7610      WHERE t2.a=28
   7611      ORDER BY t1.rowid DESC
   7612   }
   7613 } {28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7614 do_test boundary3-2.39.le.5 {
   7615   db eval {
   7616     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7617      WHERE t2.a=28
   7618      ORDER BY x
   7619   }
   7620 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7621 do_test boundary3-2.40.1 {
   7622   db eval {
   7623     SELECT t1.* FROM t1, t2 WHERE t1.rowid=2147483648 AND t2.a=t1.a
   7624   }
   7625 } {51 0000000080000000}
   7626 do_test boundary3-2.40.2 {
   7627   db eval {
   7628     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000080000000'
   7629   }
   7630 } {2147483648 51}
   7631 do_test boundary3-2.40.3 {
   7632   db eval {
   7633     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=51
   7634   }
   7635 } {2147483648 0000000080000000}
   7636 do_test boundary3-2.40.gt.1 {
   7637   db eval {
   7638     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7639      WHERE t1.rowid > 2147483648 ORDER BY t2.a
   7640   }
   7641 } {3 7 10 13 14 17 19 22 25 26 27 28 34 35 36 39 43 45 46 56 57}
   7642 do_test boundary3-2.40.gt.2 {
   7643   db eval {
   7644     SELECT t2.a FROM t2 NATURAL JOIN t1
   7645      WHERE t1.rowid > 2147483648 ORDER BY t1.a DESC
   7646   }
   7647 } {57 56 46 45 43 39 36 35 34 28 27 26 25 22 19 17 14 13 10 7 3}
   7648 do_test boundary3-2.40.gt.3 {
   7649   db eval {
   7650     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7651      WHERE t2.a=51
   7652      ORDER BY t1.rowid
   7653   }
   7654 } {14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7655 do_test boundary3-2.40.gt.4 {
   7656   db eval {
   7657     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7658      WHERE t2.a=51
   7659      ORDER BY t1.rowid DESC
   7660   }
   7661 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14}
   7662 do_test boundary3-2.40.gt.5 {
   7663   db eval {
   7664     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7665      WHERE t2.a=51
   7666      ORDER BY x
   7667   }
   7668 } {14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7669 do_test boundary3-2.40.gt.10 {
   7670   db eval {
   7671     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7672      WHERE t2.a=51
   7673      ORDER BY t1.rowid
   7674   }
   7675 } {14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7676 do_test boundary3-2.40.gt.11 {
   7677   db eval {
   7678     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7679      WHERE t2.a=51
   7680      ORDER BY t1.rowid DESC
   7681   }
   7682 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14}
   7683 do_test boundary3-2.40.ge.1 {
   7684   db eval {
   7685     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7686      WHERE t1.rowid >= 2147483648 ORDER BY t2.a
   7687   }
   7688 } {3 7 10 13 14 17 19 22 25 26 27 28 34 35 36 39 43 45 46 51 56 57}
   7689 do_test boundary3-2.40.ge.2 {
   7690   db eval {
   7691     SELECT t2.a FROM t2 NATURAL JOIN t1
   7692      WHERE t1.rowid >= 2147483648 ORDER BY t1.a DESC
   7693   }
   7694 } {57 56 51 46 45 43 39 36 35 34 28 27 26 25 22 19 17 14 13 10 7 3}
   7695 do_test boundary3-2.40.ge.3 {
   7696   db eval {
   7697     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7698      WHERE t2.a=51
   7699      ORDER BY t1.rowid
   7700   }
   7701 } {51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7702 do_test boundary3-2.40.ge.4 {
   7703   db eval {
   7704     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7705      WHERE t2.a=51
   7706      ORDER BY t1.rowid DESC
   7707   }
   7708 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51}
   7709 do_test boundary3-2.40.ge.5 {
   7710   db eval {
   7711     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7712      WHERE t2.a=51
   7713      ORDER BY x
   7714   }
   7715 } {51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7716 do_test boundary3-2.40.ge.10 {
   7717   db eval {
   7718     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7719      WHERE t2.a=51
   7720      ORDER BY t1.rowid
   7721   }
   7722 } {51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7723 do_test boundary3-2.40.ge.11 {
   7724   db eval {
   7725     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7726      WHERE t2.a=51
   7727      ORDER BY t1.rowid DESC
   7728   }
   7729 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51}
   7730 do_test boundary3-2.40.lt.1 {
   7731   db eval {
   7732     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7733      WHERE t1.rowid < 2147483648 ORDER BY t2.a
   7734   }
   7735 } {1 2 4 5 6 8 9 11 12 15 16 18 20 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   7736 do_test boundary3-2.40.lt.2 {
   7737   db eval {
   7738     SELECT t2.a FROM t2 NATURAL JOIN t1
   7739      WHERE t1.rowid < 2147483648 ORDER BY t1.a DESC
   7740   }
   7741 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 20 18 16 15 12 11 9 8 6 5 4 2 1}
   7742 do_test boundary3-2.40.lt.3 {
   7743   db eval {
   7744     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7745      WHERE t2.a=51
   7746      ORDER BY t1.rowid
   7747   }
   7748 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20}
   7749 do_test boundary3-2.40.lt.4 {
   7750   db eval {
   7751     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7752      WHERE t2.a=51
   7753      ORDER BY t1.rowid DESC
   7754   }
   7755 } {20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7756 do_test boundary3-2.40.lt.5 {
   7757   db eval {
   7758     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7759      WHERE t2.a=51
   7760      ORDER BY x
   7761   }
   7762 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7763 do_test boundary3-2.40.lt.10 {
   7764   db eval {
   7765     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7766      WHERE t2.a=51
   7767      ORDER BY t1.rowid
   7768   }
   7769 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20}
   7770 do_test boundary3-2.40.lt.11 {
   7771   db eval {
   7772     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7773      WHERE t2.a=51
   7774      ORDER BY t1.rowid DESC
   7775   }
   7776 } {20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7777 do_test boundary3-2.40.le.1 {
   7778   db eval {
   7779     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7780      WHERE t1.rowid <= 2147483648 ORDER BY t2.a
   7781   }
   7782 } {1 2 4 5 6 8 9 11 12 15 16 18 20 21 23 24 29 30 31 32 33 37 38 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   7783 do_test boundary3-2.40.le.2 {
   7784   db eval {
   7785     SELECT t2.a FROM t2 NATURAL JOIN t1
   7786      WHERE t1.rowid <= 2147483648 ORDER BY t1.a DESC
   7787   }
   7788 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 38 37 33 32 31 30 29 24 23 21 20 18 16 15 12 11 9 8 6 5 4 2 1}
   7789 do_test boundary3-2.40.le.3 {
   7790   db eval {
   7791     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7792      WHERE t2.a=51
   7793      ORDER BY t1.rowid
   7794   }
   7795 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51}
   7796 do_test boundary3-2.40.le.4 {
   7797   db eval {
   7798     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7799      WHERE t2.a=51
   7800      ORDER BY t1.rowid DESC
   7801   }
   7802 } {51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7803 do_test boundary3-2.40.le.5 {
   7804   db eval {
   7805     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7806      WHERE t2.a=51
   7807      ORDER BY x
   7808   }
   7809 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7810 do_test boundary3-2.40.le.10 {
   7811   db eval {
   7812     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7813      WHERE t2.a=51
   7814      ORDER BY t1.rowid
   7815   }
   7816 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51}
   7817 do_test boundary3-2.40.le.11 {
   7818   db eval {
   7819     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   7820      WHERE t2.a=51
   7821      ORDER BY t1.rowid DESC
   7822   }
   7823 } {51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7824 do_test boundary3-2.41.1 {
   7825   db eval {
   7826     SELECT t1.* FROM t1, t2 WHERE t1.rowid=549755813887 AND t2.a=t1.a
   7827   }
   7828 } {46 0000007fffffffff}
   7829 do_test boundary3-2.41.2 {
   7830   db eval {
   7831     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000007fffffffff'
   7832   }
   7833 } {549755813887 46}
   7834 do_test boundary3-2.41.3 {
   7835   db eval {
   7836     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=46
   7837   }
   7838 } {549755813887 0000007fffffffff}
   7839 do_test boundary3-2.41.gt.1 {
   7840   db eval {
   7841     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7842      WHERE t1.rowid > 549755813887 ORDER BY t2.a
   7843   }
   7844 } {3 7 10 13 17 19 25 26 27 28 34 35 43 45 56 57}
   7845 do_test boundary3-2.41.gt.2 {
   7846   db eval {
   7847     SELECT t2.a FROM t2 NATURAL JOIN t1
   7848      WHERE t1.rowid > 549755813887 ORDER BY t1.a DESC
   7849   }
   7850 } {57 56 45 43 35 34 28 27 26 25 19 17 13 10 7 3}
   7851 do_test boundary3-2.41.gt.3 {
   7852   db eval {
   7853     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7854      WHERE t2.a=46
   7855      ORDER BY t1.rowid
   7856   }
   7857 } {35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7858 do_test boundary3-2.41.gt.4 {
   7859   db eval {
   7860     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7861      WHERE t2.a=46
   7862      ORDER BY t1.rowid DESC
   7863   }
   7864 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35}
   7865 do_test boundary3-2.41.gt.5 {
   7866   db eval {
   7867     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   7868      WHERE t2.a=46
   7869      ORDER BY x
   7870   }
   7871 } {35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7872 do_test boundary3-2.41.gt.10 {
   7873   db eval {
   7874     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7875      WHERE t2.a=46
   7876      ORDER BY t1.rowid
   7877   }
   7878 } {35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7879 do_test boundary3-2.41.gt.11 {
   7880   db eval {
   7881     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   7882      WHERE t2.a=46
   7883      ORDER BY t1.rowid DESC
   7884   }
   7885 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35}
   7886 do_test boundary3-2.41.ge.1 {
   7887   db eval {
   7888     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7889      WHERE t1.rowid >= 549755813887 ORDER BY t2.a
   7890   }
   7891 } {3 7 10 13 17 19 25 26 27 28 34 35 43 45 46 56 57}
   7892 do_test boundary3-2.41.ge.2 {
   7893   db eval {
   7894     SELECT t2.a FROM t2 NATURAL JOIN t1
   7895      WHERE t1.rowid >= 549755813887 ORDER BY t1.a DESC
   7896   }
   7897 } {57 56 46 45 43 35 34 28 27 26 25 19 17 13 10 7 3}
   7898 do_test boundary3-2.41.ge.3 {
   7899   db eval {
   7900     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7901      WHERE t2.a=46
   7902      ORDER BY t1.rowid
   7903   }
   7904 } {46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7905 do_test boundary3-2.41.ge.4 {
   7906   db eval {
   7907     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7908      WHERE t2.a=46
   7909      ORDER BY t1.rowid DESC
   7910   }
   7911 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46}
   7912 do_test boundary3-2.41.ge.5 {
   7913   db eval {
   7914     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   7915      WHERE t2.a=46
   7916      ORDER BY x
   7917   }
   7918 } {46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7919 do_test boundary3-2.41.ge.10 {
   7920   db eval {
   7921     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7922      WHERE t2.a=46
   7923      ORDER BY t1.rowid
   7924   }
   7925 } {46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   7926 do_test boundary3-2.41.ge.11 {
   7927   db eval {
   7928     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   7929      WHERE t2.a=46
   7930      ORDER BY t1.rowid DESC
   7931   }
   7932 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46}
   7933 do_test boundary3-2.41.lt.1 {
   7934   db eval {
   7935     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7936      WHERE t1.rowid < 549755813887 ORDER BY t2.a
   7937   }
   7938 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 36 37 38 39 40 41 42 44 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   7939 do_test boundary3-2.41.lt.2 {
   7940   db eval {
   7941     SELECT t2.a FROM t2 NATURAL JOIN t1
   7942      WHERE t1.rowid < 549755813887 ORDER BY t1.a DESC
   7943   }
   7944 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 44 42 41 40 39 38 37 36 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   7945 do_test boundary3-2.41.lt.3 {
   7946   db eval {
   7947     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7948      WHERE t2.a=46
   7949      ORDER BY t1.rowid
   7950   }
   7951 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22}
   7952 do_test boundary3-2.41.lt.4 {
   7953   db eval {
   7954     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7955      WHERE t2.a=46
   7956      ORDER BY t1.rowid DESC
   7957   }
   7958 } {22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7959 do_test boundary3-2.41.lt.5 {
   7960   db eval {
   7961     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   7962      WHERE t2.a=46
   7963      ORDER BY x
   7964   }
   7965 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   7966 do_test boundary3-2.41.lt.10 {
   7967   db eval {
   7968     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7969      WHERE t2.a=46
   7970      ORDER BY t1.rowid
   7971   }
   7972 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22}
   7973 do_test boundary3-2.41.lt.11 {
   7974   db eval {
   7975     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   7976      WHERE t2.a=46
   7977      ORDER BY t1.rowid DESC
   7978   }
   7979 } {22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   7980 do_test boundary3-2.41.le.1 {
   7981   db eval {
   7982     SELECT t2.a FROM t1 JOIN t2 USING(a)
   7983      WHERE t1.rowid <= 549755813887 ORDER BY t2.a
   7984   }
   7985 } {1 2 4 5 6 8 9 11 12 14 15 16 18 20 21 22 23 24 29 30 31 32 33 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 58 59 60 61 62 63 64}
   7986 do_test boundary3-2.41.le.2 {
   7987   db eval {
   7988     SELECT t2.a FROM t2 NATURAL JOIN t1
   7989      WHERE t1.rowid <= 549755813887 ORDER BY t1.a DESC
   7990   }
   7991 } {64 63 62 61 60 59 58 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 33 32 31 30 29 24 23 22 21 20 18 16 15 14 12 11 9 8 6 5 4 2 1}
   7992 do_test boundary3-2.41.le.3 {
   7993   db eval {
   7994     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   7995      WHERE t2.a=46
   7996      ORDER BY t1.rowid
   7997   }
   7998 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46}
   7999 do_test boundary3-2.41.le.4 {
   8000   db eval {
   8001     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8002      WHERE t2.a=46
   8003      ORDER BY t1.rowid DESC
   8004   }
   8005 } {46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8006 do_test boundary3-2.41.le.5 {
   8007   db eval {
   8008     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8009      WHERE t2.a=46
   8010      ORDER BY x
   8011   }
   8012 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8013 do_test boundary3-2.41.le.10 {
   8014   db eval {
   8015     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8016      WHERE t2.a=46
   8017      ORDER BY t1.rowid
   8018   }
   8019 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46}
   8020 do_test boundary3-2.41.le.11 {
   8021   db eval {
   8022     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8023      WHERE t2.a=46
   8024      ORDER BY t1.rowid DESC
   8025   }
   8026 } {46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8027 do_test boundary3-2.42.1 {
   8028   db eval {
   8029     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-549755813888 AND t2.a=t1.a
   8030   }
   8031 } {63 ffffff8000000000}
   8032 do_test boundary3-2.42.2 {
   8033   db eval {
   8034     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffff8000000000'
   8035   }
   8036 } {-549755813888 63}
   8037 do_test boundary3-2.42.3 {
   8038   db eval {
   8039     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=63
   8040   }
   8041 } {-549755813888 ffffff8000000000}
   8042 do_test boundary3-2.42.gt.1 {
   8043   db eval {
   8044     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8045      WHERE t1.rowid > -549755813888 ORDER BY t2.a
   8046   }
   8047 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 56 57 59 60 61 62}
   8048 do_test boundary3-2.42.gt.2 {
   8049   db eval {
   8050     SELECT t2.a FROM t2 NATURAL JOIN t1
   8051      WHERE t1.rowid > -549755813888 ORDER BY t1.a DESC
   8052   }
   8053 } {62 61 60 59 57 56 54 53 52 51 50 49 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   8054 do_test boundary3-2.42.gt.3 {
   8055   db eval {
   8056     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8057      WHERE t2.a=63
   8058      ORDER BY t1.rowid
   8059   }
   8060 } {47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8061 do_test boundary3-2.42.gt.4 {
   8062   db eval {
   8063     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8064      WHERE t2.a=63
   8065      ORDER BY t1.rowid DESC
   8066   }
   8067 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47}
   8068 do_test boundary3-2.42.gt.5 {
   8069   db eval {
   8070     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8071      WHERE t2.a=63
   8072      ORDER BY x
   8073   }
   8074 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 47 11 1 37 29 32 54 53 52 33 38}
   8075 do_test boundary3-2.42.gt.10 {
   8076   db eval {
   8077     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   8078      WHERE t2.a=63
   8079      ORDER BY t1.rowid
   8080   }
   8081 } {47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8082 do_test boundary3-2.42.gt.11 {
   8083   db eval {
   8084     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   8085      WHERE t2.a=63
   8086      ORDER BY t1.rowid DESC
   8087   }
   8088 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47}
   8089 do_test boundary3-2.42.ge.1 {
   8090   db eval {
   8091     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8092      WHERE t1.rowid >= -549755813888 ORDER BY t2.a
   8093   }
   8094 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 56 57 59 60 61 62 63}
   8095 do_test boundary3-2.42.ge.2 {
   8096   db eval {
   8097     SELECT t2.a FROM t2 NATURAL JOIN t1
   8098      WHERE t1.rowid >= -549755813888 ORDER BY t1.a DESC
   8099   }
   8100 } {63 62 61 60 59 57 56 54 53 52 51 50 49 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   8101 do_test boundary3-2.42.ge.3 {
   8102   db eval {
   8103     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8104      WHERE t2.a=63
   8105      ORDER BY t1.rowid
   8106   }
   8107 } {63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8108 do_test boundary3-2.42.ge.4 {
   8109   db eval {
   8110     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8111      WHERE t2.a=63
   8112      ORDER BY t1.rowid DESC
   8113   }
   8114 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63}
   8115 do_test boundary3-2.42.ge.5 {
   8116   db eval {
   8117     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8118      WHERE t2.a=63
   8119      ORDER BY x
   8120   }
   8121 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 63 47 11 1 37 29 32 54 53 52 33 38}
   8122 do_test boundary3-2.42.ge.10 {
   8123   db eval {
   8124     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   8125      WHERE t2.a=63
   8126      ORDER BY t1.rowid
   8127   }
   8128 } {63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8129 do_test boundary3-2.42.ge.11 {
   8130   db eval {
   8131     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   8132      WHERE t2.a=63
   8133      ORDER BY t1.rowid DESC
   8134   }
   8135 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63}
   8136 do_test boundary3-2.42.lt.1 {
   8137   db eval {
   8138     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8139      WHERE t1.rowid < -549755813888 ORDER BY t2.a
   8140   }
   8141 } {2 21 44 55 58 64}
   8142 do_test boundary3-2.42.lt.2 {
   8143   db eval {
   8144     SELECT t2.a FROM t2 NATURAL JOIN t1
   8145      WHERE t1.rowid < -549755813888 ORDER BY t1.a DESC
   8146   }
   8147 } {64 58 55 44 21 2}
   8148 do_test boundary3-2.42.lt.3 {
   8149   db eval {
   8150     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8151      WHERE t2.a=63
   8152      ORDER BY t1.rowid
   8153   }
   8154 } {55 2 64 21 44 58}
   8155 do_test boundary3-2.42.lt.4 {
   8156   db eval {
   8157     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8158      WHERE t2.a=63
   8159      ORDER BY t1.rowid DESC
   8160   }
   8161 } {58 44 21 64 2 55}
   8162 do_test boundary3-2.42.lt.5 {
   8163   db eval {
   8164     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8165      WHERE t2.a=63
   8166      ORDER BY x
   8167   }
   8168 } {55 2 64 21 44 58}
   8169 do_test boundary3-2.42.lt.10 {
   8170   db eval {
   8171     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   8172      WHERE t2.a=63
   8173      ORDER BY t1.rowid
   8174   }
   8175 } {55 2 64 21 44 58}
   8176 do_test boundary3-2.42.lt.11 {
   8177   db eval {
   8178     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   8179      WHERE t2.a=63
   8180      ORDER BY t1.rowid DESC
   8181   }
   8182 } {58 44 21 64 2 55}
   8183 do_test boundary3-2.42.le.1 {
   8184   db eval {
   8185     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8186      WHERE t1.rowid <= -549755813888 ORDER BY t2.a
   8187   }
   8188 } {2 21 44 55 58 63 64}
   8189 do_test boundary3-2.42.le.2 {
   8190   db eval {
   8191     SELECT t2.a FROM t2 NATURAL JOIN t1
   8192      WHERE t1.rowid <= -549755813888 ORDER BY t1.a DESC
   8193   }
   8194 } {64 63 58 55 44 21 2}
   8195 do_test boundary3-2.42.le.3 {
   8196   db eval {
   8197     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8198      WHERE t2.a=63
   8199      ORDER BY t1.rowid
   8200   }
   8201 } {55 2 64 21 44 58 63}
   8202 do_test boundary3-2.42.le.4 {
   8203   db eval {
   8204     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8205      WHERE t2.a=63
   8206      ORDER BY t1.rowid DESC
   8207   }
   8208 } {63 58 44 21 64 2 55}
   8209 do_test boundary3-2.42.le.5 {
   8210   db eval {
   8211     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8212      WHERE t2.a=63
   8213      ORDER BY x
   8214   }
   8215 } {55 2 64 21 44 58 63}
   8216 do_test boundary3-2.42.le.10 {
   8217   db eval {
   8218     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8219      WHERE t2.a=63
   8220      ORDER BY t1.rowid
   8221   }
   8222 } {55 2 64 21 44 58 63}
   8223 do_test boundary3-2.42.le.11 {
   8224   db eval {
   8225     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8226      WHERE t2.a=63
   8227      ORDER BY t1.rowid DESC
   8228   }
   8229 } {63 58 44 21 64 2 55}
   8230 do_test boundary3-2.43.1 {
   8231   db eval {
   8232     SELECT t1.* FROM t1, t2 WHERE t1.rowid=281474976710655 AND t2.a=t1.a
   8233   }
   8234 } {10 0000ffffffffffff}
   8235 do_test boundary3-2.43.2 {
   8236   db eval {
   8237     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000ffffffffffff'
   8238   }
   8239 } {281474976710655 10}
   8240 do_test boundary3-2.43.3 {
   8241   db eval {
   8242     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=10
   8243   }
   8244 } {281474976710655 0000ffffffffffff}
   8245 do_test boundary3-2.43.gt.1 {
   8246   db eval {
   8247     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8248      WHERE t1.rowid > 281474976710655 ORDER BY t2.a
   8249   }
   8250 } {3 13 17 26 27 28 43 45}
   8251 do_test boundary3-2.43.gt.2 {
   8252   db eval {
   8253     SELECT t2.a FROM t2 NATURAL JOIN t1
   8254      WHERE t1.rowid > 281474976710655 ORDER BY t1.a DESC
   8255   }
   8256 } {45 43 28 27 26 17 13 3}
   8257 do_test boundary3-2.43.gt.3 {
   8258   db eval {
   8259     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8260      WHERE t2.a=10
   8261      ORDER BY t1.rowid
   8262   }
   8263 } {26 13 43 27 45 17 28 3}
   8264 do_test boundary3-2.43.gt.4 {
   8265   db eval {
   8266     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8267      WHERE t2.a=10
   8268      ORDER BY t1.rowid DESC
   8269   }
   8270 } {3 28 17 45 27 43 13 26}
   8271 do_test boundary3-2.43.gt.5 {
   8272   db eval {
   8273     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8274      WHERE t2.a=10
   8275      ORDER BY x
   8276   }
   8277 } {26 13 43 27 45 17 28 3}
   8278 do_test boundary3-2.43.ge.1 {
   8279   db eval {
   8280     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8281      WHERE t1.rowid >= 281474976710655 ORDER BY t2.a
   8282   }
   8283 } {3 10 13 17 26 27 28 43 45}
   8284 do_test boundary3-2.43.ge.2 {
   8285   db eval {
   8286     SELECT t2.a FROM t2 NATURAL JOIN t1
   8287      WHERE t1.rowid >= 281474976710655 ORDER BY t1.a DESC
   8288   }
   8289 } {45 43 28 27 26 17 13 10 3}
   8290 do_test boundary3-2.43.ge.3 {
   8291   db eval {
   8292     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8293      WHERE t2.a=10
   8294      ORDER BY t1.rowid
   8295   }
   8296 } {10 26 13 43 27 45 17 28 3}
   8297 do_test boundary3-2.43.ge.4 {
   8298   db eval {
   8299     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8300      WHERE t2.a=10
   8301      ORDER BY t1.rowid DESC
   8302   }
   8303 } {3 28 17 45 27 43 13 26 10}
   8304 do_test boundary3-2.43.ge.5 {
   8305   db eval {
   8306     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8307      WHERE t2.a=10
   8308      ORDER BY x
   8309   }
   8310 } {10 26 13 43 27 45 17 28 3}
   8311 do_test boundary3-2.43.lt.1 {
   8312   db eval {
   8313     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8314      WHERE t1.rowid < 281474976710655 ORDER BY t2.a
   8315   }
   8316 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 25 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   8317 do_test boundary3-2.43.lt.2 {
   8318   db eval {
   8319     SELECT t2.a FROM t2 NATURAL JOIN t1
   8320      WHERE t1.rowid < 281474976710655 ORDER BY t1.a DESC
   8321   }
   8322 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 25 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   8323 do_test boundary3-2.43.lt.3 {
   8324   db eval {
   8325     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8326      WHERE t2.a=10
   8327      ORDER BY t1.rowid
   8328   }
   8329 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34}
   8330 do_test boundary3-2.43.lt.4 {
   8331   db eval {
   8332     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8333      WHERE t2.a=10
   8334      ORDER BY t1.rowid DESC
   8335   }
   8336 } {34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8337 do_test boundary3-2.43.lt.5 {
   8338   db eval {
   8339     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8340      WHERE t2.a=10
   8341      ORDER BY x
   8342   }
   8343 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8344 do_test boundary3-2.43.le.1 {
   8345   db eval {
   8346     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8347      WHERE t1.rowid <= 281474976710655 ORDER BY t2.a
   8348   }
   8349 } {1 2 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 22 23 24 25 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   8350 do_test boundary3-2.43.le.2 {
   8351   db eval {
   8352     SELECT t2.a FROM t2 NATURAL JOIN t1
   8353      WHERE t1.rowid <= 281474976710655 ORDER BY t1.a DESC
   8354   }
   8355 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 25 24 23 22 21 20 19 18 16 15 14 12 11 10 9 8 7 6 5 4 2 1}
   8356 do_test boundary3-2.43.le.3 {
   8357   db eval {
   8358     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8359      WHERE t2.a=10
   8360      ORDER BY t1.rowid
   8361   }
   8362 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10}
   8363 do_test boundary3-2.43.le.4 {
   8364   db eval {
   8365     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8366      WHERE t2.a=10
   8367      ORDER BY t1.rowid DESC
   8368   }
   8369 } {10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8370 do_test boundary3-2.43.le.5 {
   8371   db eval {
   8372     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8373      WHERE t2.a=10
   8374      ORDER BY x
   8375   }
   8376 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8377 do_test boundary3-2.44.1 {
   8378   db eval {
   8379     SELECT t1.* FROM t1, t2 WHERE t1.rowid=4398046511103 AND t2.a=t1.a
   8380   }
   8381 } {7 000003ffffffffff}
   8382 do_test boundary3-2.44.2 {
   8383   db eval {
   8384     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='000003ffffffffff'
   8385   }
   8386 } {4398046511103 7}
   8387 do_test boundary3-2.44.3 {
   8388   db eval {
   8389     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=7
   8390   }
   8391 } {4398046511103 000003ffffffffff}
   8392 do_test boundary3-2.44.gt.1 {
   8393   db eval {
   8394     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8395      WHERE t1.rowid > 4398046511103 ORDER BY t2.a
   8396   }
   8397 } {3 10 13 17 25 26 27 28 34 43 45 56}
   8398 do_test boundary3-2.44.gt.2 {
   8399   db eval {
   8400     SELECT t2.a FROM t2 NATURAL JOIN t1
   8401      WHERE t1.rowid > 4398046511103 ORDER BY t1.a DESC
   8402   }
   8403 } {56 45 43 34 28 27 26 25 17 13 10 3}
   8404 do_test boundary3-2.44.gt.3 {
   8405   db eval {
   8406     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8407      WHERE t2.a=7
   8408      ORDER BY t1.rowid
   8409   }
   8410 } {56 25 34 10 26 13 43 27 45 17 28 3}
   8411 do_test boundary3-2.44.gt.4 {
   8412   db eval {
   8413     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8414      WHERE t2.a=7
   8415      ORDER BY t1.rowid DESC
   8416   }
   8417 } {3 28 17 45 27 43 13 26 10 34 25 56}
   8418 do_test boundary3-2.44.gt.5 {
   8419   db eval {
   8420     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8421      WHERE t2.a=7
   8422      ORDER BY x
   8423   }
   8424 } {56 25 34 10 26 13 43 27 45 17 28 3}
   8425 do_test boundary3-2.44.gt.10 {
   8426   db eval {
   8427     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   8428      WHERE t2.a=7
   8429      ORDER BY t1.rowid
   8430   }
   8431 } {56 25 34 10 26 13 43 27 45 17 28 3}
   8432 do_test boundary3-2.44.gt.11 {
   8433   db eval {
   8434     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   8435      WHERE t2.a=7
   8436      ORDER BY t1.rowid DESC
   8437   }
   8438 } {3 28 17 45 27 43 13 26 10 34 25 56}
   8439 do_test boundary3-2.44.ge.1 {
   8440   db eval {
   8441     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8442      WHERE t1.rowid >= 4398046511103 ORDER BY t2.a
   8443   }
   8444 } {3 7 10 13 17 25 26 27 28 34 43 45 56}
   8445 do_test boundary3-2.44.ge.2 {
   8446   db eval {
   8447     SELECT t2.a FROM t2 NATURAL JOIN t1
   8448      WHERE t1.rowid >= 4398046511103 ORDER BY t1.a DESC
   8449   }
   8450 } {56 45 43 34 28 27 26 25 17 13 10 7 3}
   8451 do_test boundary3-2.44.ge.3 {
   8452   db eval {
   8453     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8454      WHERE t2.a=7
   8455      ORDER BY t1.rowid
   8456   }
   8457 } {7 56 25 34 10 26 13 43 27 45 17 28 3}
   8458 do_test boundary3-2.44.ge.4 {
   8459   db eval {
   8460     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8461      WHERE t2.a=7
   8462      ORDER BY t1.rowid DESC
   8463   }
   8464 } {3 28 17 45 27 43 13 26 10 34 25 56 7}
   8465 do_test boundary3-2.44.ge.5 {
   8466   db eval {
   8467     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8468      WHERE t2.a=7
   8469      ORDER BY x
   8470   }
   8471 } {7 56 25 34 10 26 13 43 27 45 17 28 3}
   8472 do_test boundary3-2.44.ge.10 {
   8473   db eval {
   8474     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   8475      WHERE t2.a=7
   8476      ORDER BY t1.rowid
   8477   }
   8478 } {7 56 25 34 10 26 13 43 27 45 17 28 3}
   8479 do_test boundary3-2.44.ge.11 {
   8480   db eval {
   8481     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   8482      WHERE t2.a=7
   8483      ORDER BY t1.rowid DESC
   8484   }
   8485 } {3 28 17 45 27 43 13 26 10 34 25 56 7}
   8486 do_test boundary3-2.44.lt.1 {
   8487   db eval {
   8488     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8489      WHERE t1.rowid < 4398046511103 ORDER BY t2.a
   8490   }
   8491 } {1 2 4 5 6 8 9 11 12 14 15 16 18 19 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64}
   8492 do_test boundary3-2.44.lt.2 {
   8493   db eval {
   8494     SELECT t2.a FROM t2 NATURAL JOIN t1
   8495      WHERE t1.rowid < 4398046511103 ORDER BY t1.a DESC
   8496   }
   8497 } {64 63 62 61 60 59 58 57 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 19 18 16 15 14 12 11 9 8 6 5 4 2 1}
   8498 do_test boundary3-2.44.lt.3 {
   8499   db eval {
   8500     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8501      WHERE t2.a=7
   8502      ORDER BY t1.rowid
   8503   }
   8504 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19}
   8505 do_test boundary3-2.44.lt.4 {
   8506   db eval {
   8507     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8508      WHERE t2.a=7
   8509      ORDER BY t1.rowid DESC
   8510   }
   8511 } {19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8512 do_test boundary3-2.44.lt.5 {
   8513   db eval {
   8514     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8515      WHERE t2.a=7
   8516      ORDER BY x
   8517   }
   8518 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8519 do_test boundary3-2.44.lt.10 {
   8520   db eval {
   8521     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   8522      WHERE t2.a=7
   8523      ORDER BY t1.rowid
   8524   }
   8525 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19}
   8526 do_test boundary3-2.44.lt.11 {
   8527   db eval {
   8528     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   8529      WHERE t2.a=7
   8530      ORDER BY t1.rowid DESC
   8531   }
   8532 } {19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8533 do_test boundary3-2.44.le.1 {
   8534   db eval {
   8535     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8536      WHERE t1.rowid <= 4398046511103 ORDER BY t2.a
   8537   }
   8538 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64}
   8539 do_test boundary3-2.44.le.2 {
   8540   db eval {
   8541     SELECT t2.a FROM t2 NATURAL JOIN t1
   8542      WHERE t1.rowid <= 4398046511103 ORDER BY t1.a DESC
   8543   }
   8544 } {64 63 62 61 60 59 58 57 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   8545 do_test boundary3-2.44.le.3 {
   8546   db eval {
   8547     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8548      WHERE t2.a=7
   8549      ORDER BY t1.rowid
   8550   }
   8551 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7}
   8552 do_test boundary3-2.44.le.4 {
   8553   db eval {
   8554     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8555      WHERE t2.a=7
   8556      ORDER BY t1.rowid DESC
   8557   }
   8558 } {7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8559 do_test boundary3-2.44.le.5 {
   8560   db eval {
   8561     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8562      WHERE t2.a=7
   8563      ORDER BY x
   8564   }
   8565 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8566 do_test boundary3-2.44.le.10 {
   8567   db eval {
   8568     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8569      WHERE t2.a=7
   8570      ORDER BY t1.rowid
   8571   }
   8572 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7}
   8573 do_test boundary3-2.44.le.11 {
   8574   db eval {
   8575     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8576      WHERE t2.a=7
   8577      ORDER BY t1.rowid DESC
   8578   }
   8579 } {7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8580 do_test boundary3-2.45.1 {
   8581   db eval {
   8582     SELECT t1.* FROM t1, t2 WHERE t1.rowid=268435455 AND t2.a=t1.a
   8583   }
   8584 } {12 000000000fffffff}
   8585 do_test boundary3-2.45.2 {
   8586   db eval {
   8587     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='000000000fffffff'
   8588   }
   8589 } {268435455 12}
   8590 do_test boundary3-2.45.3 {
   8591   db eval {
   8592     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=12
   8593   }
   8594 } {268435455 000000000fffffff}
   8595 do_test boundary3-2.45.gt.1 {
   8596   db eval {
   8597     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8598      WHERE t1.rowid > 268435455 ORDER BY t2.a
   8599   }
   8600 } {3 7 10 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   8601 do_test boundary3-2.45.gt.2 {
   8602   db eval {
   8603     SELECT t2.a FROM t2 NATURAL JOIN t1
   8604      WHERE t1.rowid > 268435455 ORDER BY t1.a DESC
   8605   }
   8606 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 10 7 3}
   8607 do_test boundary3-2.45.gt.3 {
   8608   db eval {
   8609     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8610      WHERE t2.a=12
   8611      ORDER BY t1.rowid
   8612   }
   8613 } {40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8614 do_test boundary3-2.45.gt.4 {
   8615   db eval {
   8616     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8617      WHERE t2.a=12
   8618      ORDER BY t1.rowid DESC
   8619   }
   8620 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40}
   8621 do_test boundary3-2.45.gt.5 {
   8622   db eval {
   8623     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8624      WHERE t2.a=12
   8625      ORDER BY x
   8626   }
   8627 } {40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8628 do_test boundary3-2.45.gt.10 {
   8629   db eval {
   8630     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   8631      WHERE t2.a=12
   8632      ORDER BY t1.rowid
   8633   }
   8634 } {40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8635 do_test boundary3-2.45.gt.11 {
   8636   db eval {
   8637     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   8638      WHERE t2.a=12
   8639      ORDER BY t1.rowid DESC
   8640   }
   8641 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40}
   8642 do_test boundary3-2.45.ge.1 {
   8643   db eval {
   8644     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8645      WHERE t1.rowid >= 268435455 ORDER BY t2.a
   8646   }
   8647 } {3 7 10 12 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   8648 do_test boundary3-2.45.ge.2 {
   8649   db eval {
   8650     SELECT t2.a FROM t2 NATURAL JOIN t1
   8651      WHERE t1.rowid >= 268435455 ORDER BY t1.a DESC
   8652   }
   8653 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 12 10 7 3}
   8654 do_test boundary3-2.45.ge.3 {
   8655   db eval {
   8656     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8657      WHERE t2.a=12
   8658      ORDER BY t1.rowid
   8659   }
   8660 } {12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8661 do_test boundary3-2.45.ge.4 {
   8662   db eval {
   8663     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8664      WHERE t2.a=12
   8665      ORDER BY t1.rowid DESC
   8666   }
   8667 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12}
   8668 do_test boundary3-2.45.ge.5 {
   8669   db eval {
   8670     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8671      WHERE t2.a=12
   8672      ORDER BY x
   8673   }
   8674 } {12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8675 do_test boundary3-2.45.ge.10 {
   8676   db eval {
   8677     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   8678      WHERE t2.a=12
   8679      ORDER BY t1.rowid
   8680   }
   8681 } {12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8682 do_test boundary3-2.45.ge.11 {
   8683   db eval {
   8684     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   8685      WHERE t2.a=12
   8686      ORDER BY t1.rowid DESC
   8687   }
   8688 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12}
   8689 do_test boundary3-2.45.lt.1 {
   8690   db eval {
   8691     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8692      WHERE t1.rowid < 268435455 ORDER BY t2.a
   8693   }
   8694 } {1 2 4 5 6 8 9 11 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   8695 do_test boundary3-2.45.lt.2 {
   8696   db eval {
   8697     SELECT t2.a FROM t2 NATURAL JOIN t1
   8698      WHERE t1.rowid < 268435455 ORDER BY t1.a DESC
   8699   }
   8700 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 11 9 8 6 5 4 2 1}
   8701 do_test boundary3-2.45.lt.3 {
   8702   db eval {
   8703     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8704      WHERE t2.a=12
   8705      ORDER BY t1.rowid
   8706   }
   8707 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6}
   8708 do_test boundary3-2.45.lt.4 {
   8709   db eval {
   8710     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8711      WHERE t2.a=12
   8712      ORDER BY t1.rowid DESC
   8713   }
   8714 } {6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8715 do_test boundary3-2.45.lt.5 {
   8716   db eval {
   8717     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8718      WHERE t2.a=12
   8719      ORDER BY x
   8720   }
   8721 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8722 do_test boundary3-2.45.lt.10 {
   8723   db eval {
   8724     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   8725      WHERE t2.a=12
   8726      ORDER BY t1.rowid
   8727   }
   8728 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6}
   8729 do_test boundary3-2.45.lt.11 {
   8730   db eval {
   8731     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   8732      WHERE t2.a=12
   8733      ORDER BY t1.rowid DESC
   8734   }
   8735 } {6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8736 do_test boundary3-2.45.le.1 {
   8737   db eval {
   8738     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8739      WHERE t1.rowid <= 268435455 ORDER BY t2.a
   8740   }
   8741 } {1 2 4 5 6 8 9 11 12 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   8742 do_test boundary3-2.45.le.2 {
   8743   db eval {
   8744     SELECT t2.a FROM t2 NATURAL JOIN t1
   8745      WHERE t1.rowid <= 268435455 ORDER BY t1.a DESC
   8746   }
   8747 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 12 11 9 8 6 5 4 2 1}
   8748 do_test boundary3-2.45.le.3 {
   8749   db eval {
   8750     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8751      WHERE t2.a=12
   8752      ORDER BY t1.rowid
   8753   }
   8754 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12}
   8755 do_test boundary3-2.45.le.4 {
   8756   db eval {
   8757     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8758      WHERE t2.a=12
   8759      ORDER BY t1.rowid DESC
   8760   }
   8761 } {12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8762 do_test boundary3-2.45.le.5 {
   8763   db eval {
   8764     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8765      WHERE t2.a=12
   8766      ORDER BY x
   8767   }
   8768 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8769 do_test boundary3-2.45.le.10 {
   8770   db eval {
   8771     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8772      WHERE t2.a=12
   8773      ORDER BY t1.rowid
   8774   }
   8775 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12}
   8776 do_test boundary3-2.45.le.11 {
   8777   db eval {
   8778     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   8779      WHERE t2.a=12
   8780      ORDER BY t1.rowid DESC
   8781   }
   8782 } {12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8783 do_test boundary3-2.46.1 {
   8784   db eval {
   8785     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-9223372036854775808 AND t2.a=t1.a
   8786   }
   8787 } {55 8000000000000000}
   8788 do_test boundary3-2.46.2 {
   8789   db eval {
   8790     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='8000000000000000'
   8791   }
   8792 } {-9223372036854775808 55}
   8793 do_test boundary3-2.46.3 {
   8794   db eval {
   8795     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=55
   8796   }
   8797 } {-9223372036854775808 8000000000000000}
   8798 do_test boundary3-2.46.gt.1 {
   8799   db eval {
   8800     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8801      WHERE t1.rowid > -9223372036854775808 ORDER BY t2.a
   8802   }
   8803 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64}
   8804 do_test boundary3-2.46.gt.2 {
   8805   db eval {
   8806     SELECT t2.a FROM t2 NATURAL JOIN t1
   8807      WHERE t1.rowid > -9223372036854775808 ORDER BY t1.a DESC
   8808   }
   8809 } {64 63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   8810 do_test boundary3-2.46.gt.3 {
   8811   db eval {
   8812     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8813      WHERE t2.a=55
   8814      ORDER BY t1.rowid
   8815   }
   8816 } {2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8817 do_test boundary3-2.46.gt.4 {
   8818   db eval {
   8819     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8820      WHERE t2.a=55
   8821      ORDER BY t1.rowid DESC
   8822   }
   8823 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2}
   8824 do_test boundary3-2.46.gt.5 {
   8825   db eval {
   8826     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8827      WHERE t2.a=55
   8828      ORDER BY x
   8829   }
   8830 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8831 do_test boundary3-2.46.ge.1 {
   8832   db eval {
   8833     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8834      WHERE t1.rowid >= -9223372036854775808 ORDER BY t2.a
   8835   }
   8836 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   8837 do_test boundary3-2.46.ge.2 {
   8838   db eval {
   8839     SELECT t2.a FROM t2 NATURAL JOIN t1
   8840      WHERE t1.rowid >= -9223372036854775808 ORDER BY t1.a DESC
   8841   }
   8842 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   8843 do_test boundary3-2.46.ge.3 {
   8844   db eval {
   8845     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8846      WHERE t2.a=55
   8847      ORDER BY t1.rowid
   8848   }
   8849 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   8850 do_test boundary3-2.46.ge.4 {
   8851   db eval {
   8852     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8853      WHERE t2.a=55
   8854      ORDER BY t1.rowid DESC
   8855   }
   8856 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   8857 do_test boundary3-2.46.ge.5 {
   8858   db eval {
   8859     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8860      WHERE t2.a=55
   8861      ORDER BY x
   8862   }
   8863 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   8864 do_test boundary3-2.46.lt.1 {
   8865   db eval {
   8866     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8867      WHERE t1.rowid < -9223372036854775808 ORDER BY t2.a
   8868   }
   8869 } {}
   8870 do_test boundary3-2.46.lt.2 {
   8871   db eval {
   8872     SELECT t2.a FROM t2 NATURAL JOIN t1
   8873      WHERE t1.rowid < -9223372036854775808 ORDER BY t1.a DESC
   8874   }
   8875 } {}
   8876 do_test boundary3-2.46.lt.3 {
   8877   db eval {
   8878     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8879      WHERE t2.a=55
   8880      ORDER BY t1.rowid
   8881   }
   8882 } {}
   8883 do_test boundary3-2.46.lt.4 {
   8884   db eval {
   8885     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8886      WHERE t2.a=55
   8887      ORDER BY t1.rowid DESC
   8888   }
   8889 } {}
   8890 do_test boundary3-2.46.lt.5 {
   8891   db eval {
   8892     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   8893      WHERE t2.a=55
   8894      ORDER BY x
   8895   }
   8896 } {}
   8897 do_test boundary3-2.46.le.1 {
   8898   db eval {
   8899     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8900      WHERE t1.rowid <= -9223372036854775808 ORDER BY t2.a
   8901   }
   8902 } {55}
   8903 do_test boundary3-2.46.le.2 {
   8904   db eval {
   8905     SELECT t2.a FROM t2 NATURAL JOIN t1
   8906      WHERE t1.rowid <= -9223372036854775808 ORDER BY t1.a DESC
   8907   }
   8908 } {55}
   8909 do_test boundary3-2.46.le.3 {
   8910   db eval {
   8911     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8912      WHERE t2.a=55
   8913      ORDER BY t1.rowid
   8914   }
   8915 } {55}
   8916 do_test boundary3-2.46.le.4 {
   8917   db eval {
   8918     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8919      WHERE t2.a=55
   8920      ORDER BY t1.rowid DESC
   8921   }
   8922 } {55}
   8923 do_test boundary3-2.46.le.5 {
   8924   db eval {
   8925     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   8926      WHERE t2.a=55
   8927      ORDER BY x
   8928   }
   8929 } {55}
   8930 do_test boundary3-2.47.1 {
   8931   db eval {
   8932     SELECT t1.* FROM t1, t2 WHERE t1.rowid=562949953421312 AND t2.a=t1.a
   8933   }
   8934 } {43 0002000000000000}
   8935 do_test boundary3-2.47.2 {
   8936   db eval {
   8937     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0002000000000000'
   8938   }
   8939 } {562949953421312 43}
   8940 do_test boundary3-2.47.3 {
   8941   db eval {
   8942     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=43
   8943   }
   8944 } {562949953421312 0002000000000000}
   8945 do_test boundary3-2.47.gt.1 {
   8946   db eval {
   8947     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8948      WHERE t1.rowid > 562949953421312 ORDER BY t2.a
   8949   }
   8950 } {3 17 27 28 45}
   8951 do_test boundary3-2.47.gt.2 {
   8952   db eval {
   8953     SELECT t2.a FROM t2 NATURAL JOIN t1
   8954      WHERE t1.rowid > 562949953421312 ORDER BY t1.a DESC
   8955   }
   8956 } {45 28 27 17 3}
   8957 do_test boundary3-2.47.gt.3 {
   8958   db eval {
   8959     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8960      WHERE t2.a=43
   8961      ORDER BY t1.rowid
   8962   }
   8963 } {27 45 17 28 3}
   8964 do_test boundary3-2.47.gt.4 {
   8965   db eval {
   8966     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8967      WHERE t2.a=43
   8968      ORDER BY t1.rowid DESC
   8969   }
   8970 } {3 28 17 45 27}
   8971 do_test boundary3-2.47.gt.5 {
   8972   db eval {
   8973     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   8974      WHERE t2.a=43
   8975      ORDER BY x
   8976   }
   8977 } {27 45 17 28 3}
   8978 do_test boundary3-2.47.ge.1 {
   8979   db eval {
   8980     SELECT t2.a FROM t1 JOIN t2 USING(a)
   8981      WHERE t1.rowid >= 562949953421312 ORDER BY t2.a
   8982   }
   8983 } {3 17 27 28 43 45}
   8984 do_test boundary3-2.47.ge.2 {
   8985   db eval {
   8986     SELECT t2.a FROM t2 NATURAL JOIN t1
   8987      WHERE t1.rowid >= 562949953421312 ORDER BY t1.a DESC
   8988   }
   8989 } {45 43 28 27 17 3}
   8990 do_test boundary3-2.47.ge.3 {
   8991   db eval {
   8992     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   8993      WHERE t2.a=43
   8994      ORDER BY t1.rowid
   8995   }
   8996 } {43 27 45 17 28 3}
   8997 do_test boundary3-2.47.ge.4 {
   8998   db eval {
   8999     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9000      WHERE t2.a=43
   9001      ORDER BY t1.rowid DESC
   9002   }
   9003 } {3 28 17 45 27 43}
   9004 do_test boundary3-2.47.ge.5 {
   9005   db eval {
   9006     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9007      WHERE t2.a=43
   9008      ORDER BY x
   9009   }
   9010 } {43 27 45 17 28 3}
   9011 do_test boundary3-2.47.lt.1 {
   9012   db eval {
   9013     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9014      WHERE t1.rowid < 562949953421312 ORDER BY t2.a
   9015   }
   9016 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   9017 do_test boundary3-2.47.lt.2 {
   9018   db eval {
   9019     SELECT t2.a FROM t2 NATURAL JOIN t1
   9020      WHERE t1.rowid < 562949953421312 ORDER BY t1.a DESC
   9021   }
   9022 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   9023 do_test boundary3-2.47.lt.3 {
   9024   db eval {
   9025     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9026      WHERE t2.a=43
   9027      ORDER BY t1.rowid
   9028   }
   9029 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13}
   9030 do_test boundary3-2.47.lt.4 {
   9031   db eval {
   9032     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9033      WHERE t2.a=43
   9034      ORDER BY t1.rowid DESC
   9035   }
   9036 } {13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9037 do_test boundary3-2.47.lt.5 {
   9038   db eval {
   9039     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9040      WHERE t2.a=43
   9041      ORDER BY x
   9042   }
   9043 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9044 do_test boundary3-2.47.le.1 {
   9045   db eval {
   9046     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9047      WHERE t1.rowid <= 562949953421312 ORDER BY t2.a
   9048   }
   9049 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   9050 do_test boundary3-2.47.le.2 {
   9051   db eval {
   9052     SELECT t2.a FROM t2 NATURAL JOIN t1
   9053      WHERE t1.rowid <= 562949953421312 ORDER BY t1.a DESC
   9054   }
   9055 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   9056 do_test boundary3-2.47.le.3 {
   9057   db eval {
   9058     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9059      WHERE t2.a=43
   9060      ORDER BY t1.rowid
   9061   }
   9062 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43}
   9063 do_test boundary3-2.47.le.4 {
   9064   db eval {
   9065     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9066      WHERE t2.a=43
   9067      ORDER BY t1.rowid DESC
   9068   }
   9069 } {43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9070 do_test boundary3-2.47.le.5 {
   9071   db eval {
   9072     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9073      WHERE t2.a=43
   9074      ORDER BY x
   9075   }
   9076 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9077 do_test boundary3-2.48.1 {
   9078   db eval {
   9079     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-8388609 AND t2.a=t1.a
   9080   }
   9081 } {1 ffffffffff7fffff}
   9082 do_test boundary3-2.48.2 {
   9083   db eval {
   9084     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffffff7fffff'
   9085   }
   9086 } {-8388609 1}
   9087 do_test boundary3-2.48.3 {
   9088   db eval {
   9089     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=1
   9090   }
   9091 } {-8388609 ffffffffff7fffff}
   9092 do_test boundary3-2.48.gt.1 {
   9093   db eval {
   9094     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9095      WHERE t1.rowid > -8388609 ORDER BY t2.a
   9096   }
   9097 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   9098 do_test boundary3-2.48.gt.2 {
   9099   db eval {
   9100     SELECT t2.a FROM t2 NATURAL JOIN t1
   9101      WHERE t1.rowid > -8388609 ORDER BY t1.a DESC
   9102   }
   9103 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   9104 do_test boundary3-2.48.gt.3 {
   9105   db eval {
   9106     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9107      WHERE t2.a=1
   9108      ORDER BY t1.rowid
   9109   }
   9110 } {37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9111 do_test boundary3-2.48.gt.4 {
   9112   db eval {
   9113     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9114      WHERE t2.a=1
   9115      ORDER BY t1.rowid DESC
   9116   }
   9117 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37}
   9118 do_test boundary3-2.48.gt.5 {
   9119   db eval {
   9120     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9121      WHERE t2.a=1
   9122      ORDER BY x
   9123   }
   9124 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 37 29 32 54 53 52 33 38}
   9125 do_test boundary3-2.48.gt.10 {
   9126   db eval {
   9127     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9128      WHERE t2.a=1
   9129      ORDER BY t1.rowid
   9130   }
   9131 } {37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9132 do_test boundary3-2.48.gt.11 {
   9133   db eval {
   9134     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9135      WHERE t2.a=1
   9136      ORDER BY t1.rowid DESC
   9137   }
   9138 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37}
   9139 do_test boundary3-2.48.ge.1 {
   9140   db eval {
   9141     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9142      WHERE t1.rowid >= -8388609 ORDER BY t2.a
   9143   }
   9144 } {1 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   9145 do_test boundary3-2.48.ge.2 {
   9146   db eval {
   9147     SELECT t2.a FROM t2 NATURAL JOIN t1
   9148      WHERE t1.rowid >= -8388609 ORDER BY t1.a DESC
   9149   }
   9150 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3 1}
   9151 do_test boundary3-2.48.ge.3 {
   9152   db eval {
   9153     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9154      WHERE t2.a=1
   9155      ORDER BY t1.rowid
   9156   }
   9157 } {1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9158 do_test boundary3-2.48.ge.4 {
   9159   db eval {
   9160     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9161      WHERE t2.a=1
   9162      ORDER BY t1.rowid DESC
   9163   }
   9164 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1}
   9165 do_test boundary3-2.48.ge.5 {
   9166   db eval {
   9167     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9168      WHERE t2.a=1
   9169      ORDER BY x
   9170   }
   9171 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 1 37 29 32 54 53 52 33 38}
   9172 do_test boundary3-2.48.ge.10 {
   9173   db eval {
   9174     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9175      WHERE t2.a=1
   9176      ORDER BY t1.rowid
   9177   }
   9178 } {1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9179 do_test boundary3-2.48.ge.11 {
   9180   db eval {
   9181     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9182      WHERE t2.a=1
   9183      ORDER BY t1.rowid DESC
   9184   }
   9185 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1}
   9186 do_test boundary3-2.48.lt.1 {
   9187   db eval {
   9188     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9189      WHERE t1.rowid < -8388609 ORDER BY t2.a
   9190   }
   9191 } {2 11 21 44 47 55 58 63 64}
   9192 do_test boundary3-2.48.lt.2 {
   9193   db eval {
   9194     SELECT t2.a FROM t2 NATURAL JOIN t1
   9195      WHERE t1.rowid < -8388609 ORDER BY t1.a DESC
   9196   }
   9197 } {64 63 58 55 47 44 21 11 2}
   9198 do_test boundary3-2.48.lt.3 {
   9199   db eval {
   9200     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9201      WHERE t2.a=1
   9202      ORDER BY t1.rowid
   9203   }
   9204 } {55 2 64 21 44 58 63 47 11}
   9205 do_test boundary3-2.48.lt.4 {
   9206   db eval {
   9207     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9208      WHERE t2.a=1
   9209      ORDER BY t1.rowid DESC
   9210   }
   9211 } {11 47 63 58 44 21 64 2 55}
   9212 do_test boundary3-2.48.lt.5 {
   9213   db eval {
   9214     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9215      WHERE t2.a=1
   9216      ORDER BY x
   9217   }
   9218 } {55 2 64 21 44 58 63 47 11}
   9219 do_test boundary3-2.48.lt.10 {
   9220   db eval {
   9221     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9222      WHERE t2.a=1
   9223      ORDER BY t1.rowid
   9224   }
   9225 } {55 2 64 21 44 58 63 47 11}
   9226 do_test boundary3-2.48.lt.11 {
   9227   db eval {
   9228     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9229      WHERE t2.a=1
   9230      ORDER BY t1.rowid DESC
   9231   }
   9232 } {11 47 63 58 44 21 64 2 55}
   9233 do_test boundary3-2.48.le.1 {
   9234   db eval {
   9235     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9236      WHERE t1.rowid <= -8388609 ORDER BY t2.a
   9237   }
   9238 } {1 2 11 21 44 47 55 58 63 64}
   9239 do_test boundary3-2.48.le.2 {
   9240   db eval {
   9241     SELECT t2.a FROM t2 NATURAL JOIN t1
   9242      WHERE t1.rowid <= -8388609 ORDER BY t1.a DESC
   9243   }
   9244 } {64 63 58 55 47 44 21 11 2 1}
   9245 do_test boundary3-2.48.le.3 {
   9246   db eval {
   9247     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9248      WHERE t2.a=1
   9249      ORDER BY t1.rowid
   9250   }
   9251 } {55 2 64 21 44 58 63 47 11 1}
   9252 do_test boundary3-2.48.le.4 {
   9253   db eval {
   9254     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9255      WHERE t2.a=1
   9256      ORDER BY t1.rowid DESC
   9257   }
   9258 } {1 11 47 63 58 44 21 64 2 55}
   9259 do_test boundary3-2.48.le.5 {
   9260   db eval {
   9261     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9262      WHERE t2.a=1
   9263      ORDER BY x
   9264   }
   9265 } {55 2 64 21 44 58 63 47 11 1}
   9266 do_test boundary3-2.48.le.10 {
   9267   db eval {
   9268     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9269      WHERE t2.a=1
   9270      ORDER BY t1.rowid
   9271   }
   9272 } {55 2 64 21 44 58 63 47 11 1}
   9273 do_test boundary3-2.48.le.11 {
   9274   db eval {
   9275     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9276      WHERE t2.a=1
   9277      ORDER BY t1.rowid DESC
   9278   }
   9279 } {1 11 47 63 58 44 21 64 2 55}
   9280 do_test boundary3-2.49.1 {
   9281   db eval {
   9282     SELECT t1.* FROM t1, t2 WHERE t1.rowid=16777215 AND t2.a=t1.a
   9283   }
   9284 } {9 0000000000ffffff}
   9285 do_test boundary3-2.49.2 {
   9286   db eval {
   9287     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000ffffff'
   9288   }
   9289 } {16777215 9}
   9290 do_test boundary3-2.49.3 {
   9291   db eval {
   9292     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=9
   9293   }
   9294 } {16777215 0000000000ffffff}
   9295 do_test boundary3-2.49.gt.1 {
   9296   db eval {
   9297     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9298      WHERE t1.rowid > 16777215 ORDER BY t2.a
   9299   }
   9300 } {3 6 7 10 12 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   9301 do_test boundary3-2.49.gt.2 {
   9302   db eval {
   9303     SELECT t2.a FROM t2 NATURAL JOIN t1
   9304      WHERE t1.rowid > 16777215 ORDER BY t1.a DESC
   9305   }
   9306 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 12 10 7 6 3}
   9307 do_test boundary3-2.49.gt.3 {
   9308   db eval {
   9309     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9310      WHERE t2.a=9
   9311      ORDER BY t1.rowid
   9312   }
   9313 } {6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9314 do_test boundary3-2.49.gt.4 {
   9315   db eval {
   9316     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9317      WHERE t2.a=9
   9318      ORDER BY t1.rowid DESC
   9319   }
   9320 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6}
   9321 do_test boundary3-2.49.gt.5 {
   9322   db eval {
   9323     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9324      WHERE t2.a=9
   9325      ORDER BY x
   9326   }
   9327 } {6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9328 do_test boundary3-2.49.gt.10 {
   9329   db eval {
   9330     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9331      WHERE t2.a=9
   9332      ORDER BY t1.rowid
   9333   }
   9334 } {6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9335 do_test boundary3-2.49.gt.11 {
   9336   db eval {
   9337     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9338      WHERE t2.a=9
   9339      ORDER BY t1.rowid DESC
   9340   }
   9341 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6}
   9342 do_test boundary3-2.49.ge.1 {
   9343   db eval {
   9344     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9345      WHERE t1.rowid >= 16777215 ORDER BY t2.a
   9346   }
   9347 } {3 6 7 9 10 12 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   9348 do_test boundary3-2.49.ge.2 {
   9349   db eval {
   9350     SELECT t2.a FROM t2 NATURAL JOIN t1
   9351      WHERE t1.rowid >= 16777215 ORDER BY t1.a DESC
   9352   }
   9353 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 12 10 9 7 6 3}
   9354 do_test boundary3-2.49.ge.3 {
   9355   db eval {
   9356     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9357      WHERE t2.a=9
   9358      ORDER BY t1.rowid
   9359   }
   9360 } {9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9361 do_test boundary3-2.49.ge.4 {
   9362   db eval {
   9363     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9364      WHERE t2.a=9
   9365      ORDER BY t1.rowid DESC
   9366   }
   9367 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9}
   9368 do_test boundary3-2.49.ge.5 {
   9369   db eval {
   9370     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9371      WHERE t2.a=9
   9372      ORDER BY x
   9373   }
   9374 } {9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9375 do_test boundary3-2.49.ge.10 {
   9376   db eval {
   9377     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9378      WHERE t2.a=9
   9379      ORDER BY t1.rowid
   9380   }
   9381 } {9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9382 do_test boundary3-2.49.ge.11 {
   9383   db eval {
   9384     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9385      WHERE t2.a=9
   9386      ORDER BY t1.rowid DESC
   9387   }
   9388 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9}
   9389 do_test boundary3-2.49.lt.1 {
   9390   db eval {
   9391     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9392      WHERE t1.rowid < 16777215 ORDER BY t2.a
   9393   }
   9394 } {1 2 4 5 8 11 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   9395 do_test boundary3-2.49.lt.2 {
   9396   db eval {
   9397     SELECT t2.a FROM t2 NATURAL JOIN t1
   9398      WHERE t1.rowid < 16777215 ORDER BY t1.a DESC
   9399   }
   9400 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 11 8 5 4 2 1}
   9401 do_test boundary3-2.49.lt.3 {
   9402   db eval {
   9403     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9404      WHERE t2.a=9
   9405      ORDER BY t1.rowid
   9406   }
   9407 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24}
   9408 do_test boundary3-2.49.lt.4 {
   9409   db eval {
   9410     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9411      WHERE t2.a=9
   9412      ORDER BY t1.rowid DESC
   9413   }
   9414 } {24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9415 do_test boundary3-2.49.lt.5 {
   9416   db eval {
   9417     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9418      WHERE t2.a=9
   9419      ORDER BY x
   9420   }
   9421 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9422 do_test boundary3-2.49.lt.10 {
   9423   db eval {
   9424     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9425      WHERE t2.a=9
   9426      ORDER BY t1.rowid
   9427   }
   9428 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24}
   9429 do_test boundary3-2.49.lt.11 {
   9430   db eval {
   9431     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9432      WHERE t2.a=9
   9433      ORDER BY t1.rowid DESC
   9434   }
   9435 } {24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9436 do_test boundary3-2.49.le.1 {
   9437   db eval {
   9438     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9439      WHERE t1.rowid <= 16777215 ORDER BY t2.a
   9440   }
   9441 } {1 2 4 5 8 9 11 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   9442 do_test boundary3-2.49.le.2 {
   9443   db eval {
   9444     SELECT t2.a FROM t2 NATURAL JOIN t1
   9445      WHERE t1.rowid <= 16777215 ORDER BY t1.a DESC
   9446   }
   9447 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 11 9 8 5 4 2 1}
   9448 do_test boundary3-2.49.le.3 {
   9449   db eval {
   9450     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9451      WHERE t2.a=9
   9452      ORDER BY t1.rowid
   9453   }
   9454 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9}
   9455 do_test boundary3-2.49.le.4 {
   9456   db eval {
   9457     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9458      WHERE t2.a=9
   9459      ORDER BY t1.rowid DESC
   9460   }
   9461 } {9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9462 do_test boundary3-2.49.le.5 {
   9463   db eval {
   9464     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9465      WHERE t2.a=9
   9466      ORDER BY x
   9467   }
   9468 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9469 do_test boundary3-2.49.le.10 {
   9470   db eval {
   9471     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9472      WHERE t2.a=9
   9473      ORDER BY t1.rowid
   9474   }
   9475 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9}
   9476 do_test boundary3-2.49.le.11 {
   9477   db eval {
   9478     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9479      WHERE t2.a=9
   9480      ORDER BY t1.rowid DESC
   9481   }
   9482 } {9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9483 do_test boundary3-2.50.1 {
   9484   db eval {
   9485     SELECT t1.* FROM t1, t2 WHERE t1.rowid=8388608 AND t2.a=t1.a
   9486   }
   9487 } {24 0000000000800000}
   9488 do_test boundary3-2.50.2 {
   9489   db eval {
   9490     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000800000'
   9491   }
   9492 } {8388608 24}
   9493 do_test boundary3-2.50.3 {
   9494   db eval {
   9495     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=24
   9496   }
   9497 } {8388608 0000000000800000}
   9498 do_test boundary3-2.50.gt.1 {
   9499   db eval {
   9500     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9501      WHERE t1.rowid > 8388608 ORDER BY t2.a
   9502   }
   9503 } {3 6 7 9 10 12 13 14 17 19 20 22 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   9504 do_test boundary3-2.50.gt.2 {
   9505   db eval {
   9506     SELECT t2.a FROM t2 NATURAL JOIN t1
   9507      WHERE t1.rowid > 8388608 ORDER BY t1.a DESC
   9508   }
   9509 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 22 20 19 17 14 13 12 10 9 7 6 3}
   9510 do_test boundary3-2.50.gt.3 {
   9511   db eval {
   9512     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9513      WHERE t2.a=24
   9514      ORDER BY t1.rowid
   9515   }
   9516 } {9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9517 do_test boundary3-2.50.gt.4 {
   9518   db eval {
   9519     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9520      WHERE t2.a=24
   9521      ORDER BY t1.rowid DESC
   9522   }
   9523 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9}
   9524 do_test boundary3-2.50.gt.5 {
   9525   db eval {
   9526     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9527      WHERE t2.a=24
   9528      ORDER BY x
   9529   }
   9530 } {9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9531 do_test boundary3-2.50.gt.10 {
   9532   db eval {
   9533     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9534      WHERE t2.a=24
   9535      ORDER BY t1.rowid
   9536   }
   9537 } {9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9538 do_test boundary3-2.50.gt.11 {
   9539   db eval {
   9540     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9541      WHERE t2.a=24
   9542      ORDER BY t1.rowid DESC
   9543   }
   9544 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9}
   9545 do_test boundary3-2.50.ge.1 {
   9546   db eval {
   9547     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9548      WHERE t1.rowid >= 8388608 ORDER BY t2.a
   9549   }
   9550 } {3 6 7 9 10 12 13 14 17 19 20 22 24 25 26 27 28 34 35 36 39 40 43 45 46 51 56 57}
   9551 do_test boundary3-2.50.ge.2 {
   9552   db eval {
   9553     SELECT t2.a FROM t2 NATURAL JOIN t1
   9554      WHERE t1.rowid >= 8388608 ORDER BY t1.a DESC
   9555   }
   9556 } {57 56 51 46 45 43 40 39 36 35 34 28 27 26 25 24 22 20 19 17 14 13 12 10 9 7 6 3}
   9557 do_test boundary3-2.50.ge.3 {
   9558   db eval {
   9559     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9560      WHERE t2.a=24
   9561      ORDER BY t1.rowid
   9562   }
   9563 } {24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9564 do_test boundary3-2.50.ge.4 {
   9565   db eval {
   9566     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9567      WHERE t2.a=24
   9568      ORDER BY t1.rowid DESC
   9569   }
   9570 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24}
   9571 do_test boundary3-2.50.ge.5 {
   9572   db eval {
   9573     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9574      WHERE t2.a=24
   9575      ORDER BY x
   9576   }
   9577 } {24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9578 do_test boundary3-2.50.ge.10 {
   9579   db eval {
   9580     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9581      WHERE t2.a=24
   9582      ORDER BY t1.rowid
   9583   }
   9584 } {24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9585 do_test boundary3-2.50.ge.11 {
   9586   db eval {
   9587     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9588      WHERE t2.a=24
   9589      ORDER BY t1.rowid DESC
   9590   }
   9591 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24}
   9592 do_test boundary3-2.50.lt.1 {
   9593   db eval {
   9594     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9595      WHERE t1.rowid < 8388608 ORDER BY t2.a
   9596   }
   9597 } {1 2 4 5 8 11 15 16 18 21 23 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   9598 do_test boundary3-2.50.lt.2 {
   9599   db eval {
   9600     SELECT t2.a FROM t2 NATURAL JOIN t1
   9601      WHERE t1.rowid < 8388608 ORDER BY t1.a DESC
   9602   }
   9603 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 23 21 18 16 15 11 8 5 4 2 1}
   9604 do_test boundary3-2.50.lt.3 {
   9605   db eval {
   9606     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9607      WHERE t2.a=24
   9608      ORDER BY t1.rowid
   9609   }
   9610 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18}
   9611 do_test boundary3-2.50.lt.4 {
   9612   db eval {
   9613     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9614      WHERE t2.a=24
   9615      ORDER BY t1.rowid DESC
   9616   }
   9617 } {18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9618 do_test boundary3-2.50.lt.5 {
   9619   db eval {
   9620     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9621      WHERE t2.a=24
   9622      ORDER BY x
   9623   }
   9624 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9625 do_test boundary3-2.50.lt.10 {
   9626   db eval {
   9627     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9628      WHERE t2.a=24
   9629      ORDER BY t1.rowid
   9630   }
   9631 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18}
   9632 do_test boundary3-2.50.lt.11 {
   9633   db eval {
   9634     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9635      WHERE t2.a=24
   9636      ORDER BY t1.rowid DESC
   9637   }
   9638 } {18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9639 do_test boundary3-2.50.le.1 {
   9640   db eval {
   9641     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9642      WHERE t1.rowid <= 8388608 ORDER BY t2.a
   9643   }
   9644 } {1 2 4 5 8 11 15 16 18 21 23 24 29 30 31 32 33 37 38 41 42 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   9645 do_test boundary3-2.50.le.2 {
   9646   db eval {
   9647     SELECT t2.a FROM t2 NATURAL JOIN t1
   9648      WHERE t1.rowid <= 8388608 ORDER BY t1.a DESC
   9649   }
   9650 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 42 41 38 37 33 32 31 30 29 24 23 21 18 16 15 11 8 5 4 2 1}
   9651 do_test boundary3-2.50.le.3 {
   9652   db eval {
   9653     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9654      WHERE t2.a=24
   9655      ORDER BY t1.rowid
   9656   }
   9657 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24}
   9658 do_test boundary3-2.50.le.4 {
   9659   db eval {
   9660     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9661      WHERE t2.a=24
   9662      ORDER BY t1.rowid DESC
   9663   }
   9664 } {24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9665 do_test boundary3-2.50.le.5 {
   9666   db eval {
   9667     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9668      WHERE t2.a=24
   9669      ORDER BY x
   9670   }
   9671 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9672 do_test boundary3-2.50.le.10 {
   9673   db eval {
   9674     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9675      WHERE t2.a=24
   9676      ORDER BY t1.rowid
   9677   }
   9678 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24}
   9679 do_test boundary3-2.50.le.11 {
   9680   db eval {
   9681     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9682      WHERE t2.a=24
   9683      ORDER BY t1.rowid DESC
   9684   }
   9685 } {24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9686 do_test boundary3-2.51.1 {
   9687   db eval {
   9688     SELECT t1.* FROM t1, t2 WHERE t1.rowid=16383 AND t2.a=t1.a
   9689   }
   9690 } {8 0000000000003fff}
   9691 do_test boundary3-2.51.2 {
   9692   db eval {
   9693     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000003fff'
   9694   }
   9695 } {16383 8}
   9696 do_test boundary3-2.51.3 {
   9697   db eval {
   9698     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=8
   9699   }
   9700 } {16383 0000000000003fff}
   9701 do_test boundary3-2.51.gt.1 {
   9702   db eval {
   9703     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9704      WHERE t1.rowid > 16383 ORDER BY t2.a
   9705   }
   9706 } {3 6 7 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
   9707 do_test boundary3-2.51.gt.2 {
   9708   db eval {
   9709     SELECT t2.a FROM t2 NATURAL JOIN t1
   9710      WHERE t1.rowid > 16383 ORDER BY t1.a DESC
   9711   }
   9712 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 7 6 3}
   9713 do_test boundary3-2.51.gt.3 {
   9714   db eval {
   9715     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9716      WHERE t2.a=8
   9717      ORDER BY t1.rowid
   9718   }
   9719 } {16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9720 do_test boundary3-2.51.gt.4 {
   9721   db eval {
   9722     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9723      WHERE t2.a=8
   9724      ORDER BY t1.rowid DESC
   9725   }
   9726 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16}
   9727 do_test boundary3-2.51.gt.5 {
   9728   db eval {
   9729     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9730      WHERE t2.a=8
   9731      ORDER BY x
   9732   }
   9733 } {16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9734 do_test boundary3-2.51.gt.10 {
   9735   db eval {
   9736     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9737      WHERE t2.a=8
   9738      ORDER BY t1.rowid
   9739   }
   9740 } {16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9741 do_test boundary3-2.51.gt.11 {
   9742   db eval {
   9743     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   9744      WHERE t2.a=8
   9745      ORDER BY t1.rowid DESC
   9746   }
   9747 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16}
   9748 do_test boundary3-2.51.ge.1 {
   9749   db eval {
   9750     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9751      WHERE t1.rowid >= 16383 ORDER BY t2.a
   9752   }
   9753 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
   9754 do_test boundary3-2.51.ge.2 {
   9755   db eval {
   9756     SELECT t2.a FROM t2 NATURAL JOIN t1
   9757      WHERE t1.rowid >= 16383 ORDER BY t1.a DESC
   9758   }
   9759 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   9760 do_test boundary3-2.51.ge.3 {
   9761   db eval {
   9762     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9763      WHERE t2.a=8
   9764      ORDER BY t1.rowid
   9765   }
   9766 } {8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9767 do_test boundary3-2.51.ge.4 {
   9768   db eval {
   9769     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9770      WHERE t2.a=8
   9771      ORDER BY t1.rowid DESC
   9772   }
   9773 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8}
   9774 do_test boundary3-2.51.ge.5 {
   9775   db eval {
   9776     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9777      WHERE t2.a=8
   9778      ORDER BY x
   9779   }
   9780 } {8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9781 do_test boundary3-2.51.ge.10 {
   9782   db eval {
   9783     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9784      WHERE t2.a=8
   9785      ORDER BY t1.rowid
   9786   }
   9787 } {8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   9788 do_test boundary3-2.51.ge.11 {
   9789   db eval {
   9790     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   9791      WHERE t2.a=8
   9792      ORDER BY t1.rowid DESC
   9793   }
   9794 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8}
   9795 do_test boundary3-2.51.lt.1 {
   9796   db eval {
   9797     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9798      WHERE t1.rowid < 16383 ORDER BY t2.a
   9799   }
   9800 } {1 2 4 5 11 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
   9801 do_test boundary3-2.51.lt.2 {
   9802   db eval {
   9803     SELECT t2.a FROM t2 NATURAL JOIN t1
   9804      WHERE t1.rowid < 16383 ORDER BY t1.a DESC
   9805   }
   9806 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 11 5 4 2 1}
   9807 do_test boundary3-2.51.lt.3 {
   9808   db eval {
   9809     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9810      WHERE t2.a=8
   9811      ORDER BY t1.rowid
   9812   }
   9813 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61}
   9814 do_test boundary3-2.51.lt.4 {
   9815   db eval {
   9816     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9817      WHERE t2.a=8
   9818      ORDER BY t1.rowid DESC
   9819   }
   9820 } {61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9821 do_test boundary3-2.51.lt.5 {
   9822   db eval {
   9823     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9824      WHERE t2.a=8
   9825      ORDER BY x
   9826   }
   9827 } {59 60 41 5 31 4 49 30 61 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9828 do_test boundary3-2.51.lt.10 {
   9829   db eval {
   9830     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9831      WHERE t2.a=8
   9832      ORDER BY t1.rowid
   9833   }
   9834 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61}
   9835 do_test boundary3-2.51.lt.11 {
   9836   db eval {
   9837     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   9838      WHERE t2.a=8
   9839      ORDER BY t1.rowid DESC
   9840   }
   9841 } {61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9842 do_test boundary3-2.51.le.1 {
   9843   db eval {
   9844     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9845      WHERE t1.rowid <= 16383 ORDER BY t2.a
   9846   }
   9847 } {1 2 4 5 8 11 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
   9848 do_test boundary3-2.51.le.2 {
   9849   db eval {
   9850     SELECT t2.a FROM t2 NATURAL JOIN t1
   9851      WHERE t1.rowid <= 16383 ORDER BY t1.a DESC
   9852   }
   9853 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 11 8 5 4 2 1}
   9854 do_test boundary3-2.51.le.3 {
   9855   db eval {
   9856     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9857      WHERE t2.a=8
   9858      ORDER BY t1.rowid
   9859   }
   9860 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8}
   9861 do_test boundary3-2.51.le.4 {
   9862   db eval {
   9863     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9864      WHERE t2.a=8
   9865      ORDER BY t1.rowid DESC
   9866   }
   9867 } {8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9868 do_test boundary3-2.51.le.5 {
   9869   db eval {
   9870     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   9871      WHERE t2.a=8
   9872      ORDER BY x
   9873   }
   9874 } {59 60 41 5 31 4 49 30 61 8 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   9875 do_test boundary3-2.51.le.10 {
   9876   db eval {
   9877     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9878      WHERE t2.a=8
   9879      ORDER BY t1.rowid
   9880   }
   9881 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8}
   9882 do_test boundary3-2.51.le.11 {
   9883   db eval {
   9884     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   9885      WHERE t2.a=8
   9886      ORDER BY t1.rowid DESC
   9887   }
   9888 } {8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9889 do_test boundary3-2.52.1 {
   9890   db eval {
   9891     SELECT t1.* FROM t1, t2 WHERE t1.rowid=140737488355328 AND t2.a=t1.a
   9892   }
   9893 } {34 0000800000000000}
   9894 do_test boundary3-2.52.2 {
   9895   db eval {
   9896     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000800000000000'
   9897   }
   9898 } {140737488355328 34}
   9899 do_test boundary3-2.52.3 {
   9900   db eval {
   9901     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=34
   9902   }
   9903 } {140737488355328 0000800000000000}
   9904 do_test boundary3-2.52.gt.1 {
   9905   db eval {
   9906     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9907      WHERE t1.rowid > 140737488355328 ORDER BY t2.a
   9908   }
   9909 } {3 10 13 17 26 27 28 43 45}
   9910 do_test boundary3-2.52.gt.2 {
   9911   db eval {
   9912     SELECT t2.a FROM t2 NATURAL JOIN t1
   9913      WHERE t1.rowid > 140737488355328 ORDER BY t1.a DESC
   9914   }
   9915 } {45 43 28 27 26 17 13 10 3}
   9916 do_test boundary3-2.52.gt.3 {
   9917   db eval {
   9918     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9919      WHERE t2.a=34
   9920      ORDER BY t1.rowid
   9921   }
   9922 } {10 26 13 43 27 45 17 28 3}
   9923 do_test boundary3-2.52.gt.4 {
   9924   db eval {
   9925     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9926      WHERE t2.a=34
   9927      ORDER BY t1.rowid DESC
   9928   }
   9929 } {3 28 17 45 27 43 13 26 10}
   9930 do_test boundary3-2.52.gt.5 {
   9931   db eval {
   9932     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   9933      WHERE t2.a=34
   9934      ORDER BY x
   9935   }
   9936 } {10 26 13 43 27 45 17 28 3}
   9937 do_test boundary3-2.52.ge.1 {
   9938   db eval {
   9939     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9940      WHERE t1.rowid >= 140737488355328 ORDER BY t2.a
   9941   }
   9942 } {3 10 13 17 26 27 28 34 43 45}
   9943 do_test boundary3-2.52.ge.2 {
   9944   db eval {
   9945     SELECT t2.a FROM t2 NATURAL JOIN t1
   9946      WHERE t1.rowid >= 140737488355328 ORDER BY t1.a DESC
   9947   }
   9948 } {45 43 34 28 27 26 17 13 10 3}
   9949 do_test boundary3-2.52.ge.3 {
   9950   db eval {
   9951     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9952      WHERE t2.a=34
   9953      ORDER BY t1.rowid
   9954   }
   9955 } {34 10 26 13 43 27 45 17 28 3}
   9956 do_test boundary3-2.52.ge.4 {
   9957   db eval {
   9958     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9959      WHERE t2.a=34
   9960      ORDER BY t1.rowid DESC
   9961   }
   9962 } {3 28 17 45 27 43 13 26 10 34}
   9963 do_test boundary3-2.52.ge.5 {
   9964   db eval {
   9965     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   9966      WHERE t2.a=34
   9967      ORDER BY x
   9968   }
   9969 } {34 10 26 13 43 27 45 17 28 3}
   9970 do_test boundary3-2.52.lt.1 {
   9971   db eval {
   9972     SELECT t2.a FROM t1 JOIN t2 USING(a)
   9973      WHERE t1.rowid < 140737488355328 ORDER BY t2.a
   9974   }
   9975 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 25 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   9976 do_test boundary3-2.52.lt.2 {
   9977   db eval {
   9978     SELECT t2.a FROM t2 NATURAL JOIN t1
   9979      WHERE t1.rowid < 140737488355328 ORDER BY t1.a DESC
   9980   }
   9981 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 25 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   9982 do_test boundary3-2.52.lt.3 {
   9983   db eval {
   9984     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9985      WHERE t2.a=34
   9986      ORDER BY t1.rowid
   9987   }
   9988 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25}
   9989 do_test boundary3-2.52.lt.4 {
   9990   db eval {
   9991     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9992      WHERE t2.a=34
   9993      ORDER BY t1.rowid DESC
   9994   }
   9995 } {25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   9996 do_test boundary3-2.52.lt.5 {
   9997   db eval {
   9998     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   9999      WHERE t2.a=34
   10000      ORDER BY x
   10001   }
   10002 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10003 do_test boundary3-2.52.le.1 {
   10004   db eval {
   10005     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10006      WHERE t1.rowid <= 140737488355328 ORDER BY t2.a
   10007   }
   10008 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 25 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   10009 do_test boundary3-2.52.le.2 {
   10010   db eval {
   10011     SELECT t2.a FROM t2 NATURAL JOIN t1
   10012      WHERE t1.rowid <= 140737488355328 ORDER BY t1.a DESC
   10013   }
   10014 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 25 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   10015 do_test boundary3-2.52.le.3 {
   10016   db eval {
   10017     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10018      WHERE t2.a=34
   10019      ORDER BY t1.rowid
   10020   }
   10021 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34}
   10022 do_test boundary3-2.52.le.4 {
   10023   db eval {
   10024     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10025      WHERE t2.a=34
   10026      ORDER BY t1.rowid DESC
   10027   }
   10028 } {34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10029 do_test boundary3-2.52.le.5 {
   10030   db eval {
   10031     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10032      WHERE t2.a=34
   10033      ORDER BY x
   10034   }
   10035 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10036 do_test boundary3-2.53.1 {
   10037   db eval {
   10038     SELECT t1.* FROM t1, t2 WHERE t1.rowid=2097151 AND t2.a=t1.a
   10039   }
   10040 } {15 00000000001fffff}
   10041 do_test boundary3-2.53.2 {
   10042   db eval {
   10043     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00000000001fffff'
   10044   }
   10045 } {2097151 15}
   10046 do_test boundary3-2.53.3 {
   10047   db eval {
   10048     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=15
   10049   }
   10050 } {2097151 00000000001fffff}
   10051 do_test boundary3-2.53.gt.1 {
   10052   db eval {
   10053     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10054      WHERE t1.rowid > 2097151 ORDER BY t2.a
   10055   }
   10056 } {3 6 7 9 10 12 13 14 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 51 56 57}
   10057 do_test boundary3-2.53.gt.2 {
   10058   db eval {
   10059     SELECT t2.a FROM t2 NATURAL JOIN t1
   10060      WHERE t1.rowid > 2097151 ORDER BY t1.a DESC
   10061   }
   10062 } {57 56 51 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 14 13 12 10 9 7 6 3}
   10063 do_test boundary3-2.53.gt.3 {
   10064   db eval {
   10065     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10066      WHERE t2.a=15
   10067      ORDER BY t1.rowid
   10068   }
   10069 } {42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10070 do_test boundary3-2.53.gt.4 {
   10071   db eval {
   10072     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10073      WHERE t2.a=15
   10074      ORDER BY t1.rowid DESC
   10075   }
   10076 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42}
   10077 do_test boundary3-2.53.gt.5 {
   10078   db eval {
   10079     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10080      WHERE t2.a=15
   10081      ORDER BY x
   10082   }
   10083 } {42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10084 do_test boundary3-2.53.gt.10 {
   10085   db eval {
   10086     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   10087      WHERE t2.a=15
   10088      ORDER BY t1.rowid
   10089   }
   10090 } {42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10091 do_test boundary3-2.53.gt.11 {
   10092   db eval {
   10093     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   10094      WHERE t2.a=15
   10095      ORDER BY t1.rowid DESC
   10096   }
   10097 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42}
   10098 do_test boundary3-2.53.ge.1 {
   10099   db eval {
   10100     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10101      WHERE t1.rowid >= 2097151 ORDER BY t2.a
   10102   }
   10103 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 51 56 57}
   10104 do_test boundary3-2.53.ge.2 {
   10105   db eval {
   10106     SELECT t2.a FROM t2 NATURAL JOIN t1
   10107      WHERE t1.rowid >= 2097151 ORDER BY t1.a DESC
   10108   }
   10109 } {57 56 51 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   10110 do_test boundary3-2.53.ge.3 {
   10111   db eval {
   10112     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10113      WHERE t2.a=15
   10114      ORDER BY t1.rowid
   10115   }
   10116 } {15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10117 do_test boundary3-2.53.ge.4 {
   10118   db eval {
   10119     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10120      WHERE t2.a=15
   10121      ORDER BY t1.rowid DESC
   10122   }
   10123 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15}
   10124 do_test boundary3-2.53.ge.5 {
   10125   db eval {
   10126     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10127      WHERE t2.a=15
   10128      ORDER BY x
   10129   }
   10130 } {15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10131 do_test boundary3-2.53.ge.10 {
   10132   db eval {
   10133     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   10134      WHERE t2.a=15
   10135      ORDER BY t1.rowid
   10136   }
   10137 } {15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10138 do_test boundary3-2.53.ge.11 {
   10139   db eval {
   10140     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   10141      WHERE t2.a=15
   10142      ORDER BY t1.rowid DESC
   10143   }
   10144 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15}
   10145 do_test boundary3-2.53.lt.1 {
   10146   db eval {
   10147     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10148      WHERE t1.rowid < 2097151 ORDER BY t2.a
   10149   }
   10150 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   10151 do_test boundary3-2.53.lt.2 {
   10152   db eval {
   10153     SELECT t2.a FROM t2 NATURAL JOIN t1
   10154      WHERE t1.rowid < 2097151 ORDER BY t1.a DESC
   10155   }
   10156 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   10157 do_test boundary3-2.53.lt.3 {
   10158   db eval {
   10159     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10160      WHERE t2.a=15
   10161      ORDER BY t1.rowid
   10162   }
   10163 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62}
   10164 do_test boundary3-2.53.lt.4 {
   10165   db eval {
   10166     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10167      WHERE t2.a=15
   10168      ORDER BY t1.rowid DESC
   10169   }
   10170 } {62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10171 do_test boundary3-2.53.lt.5 {
   10172   db eval {
   10173     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10174      WHERE t2.a=15
   10175      ORDER BY x
   10176   }
   10177 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10178 do_test boundary3-2.53.lt.10 {
   10179   db eval {
   10180     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   10181      WHERE t2.a=15
   10182      ORDER BY t1.rowid
   10183   }
   10184 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62}
   10185 do_test boundary3-2.53.lt.11 {
   10186   db eval {
   10187     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   10188      WHERE t2.a=15
   10189      ORDER BY t1.rowid DESC
   10190   }
   10191 } {62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10192 do_test boundary3-2.53.le.1 {
   10193   db eval {
   10194     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10195      WHERE t1.rowid <= 2097151 ORDER BY t2.a
   10196   }
   10197 } {1 2 4 5 8 11 15 16 21 23 29 30 31 32 33 37 38 41 44 47 48 49 50 52 53 54 55 58 59 60 61 62 63 64}
   10198 do_test boundary3-2.53.le.2 {
   10199   db eval {
   10200     SELECT t2.a FROM t2 NATURAL JOIN t1
   10201      WHERE t1.rowid <= 2097151 ORDER BY t1.a DESC
   10202   }
   10203 } {64 63 62 61 60 59 58 55 54 53 52 50 49 48 47 44 41 38 37 33 32 31 30 29 23 21 16 15 11 8 5 4 2 1}
   10204 do_test boundary3-2.53.le.3 {
   10205   db eval {
   10206     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10207      WHERE t2.a=15
   10208      ORDER BY t1.rowid
   10209   }
   10210 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15}
   10211 do_test boundary3-2.53.le.4 {
   10212   db eval {
   10213     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10214      WHERE t2.a=15
   10215      ORDER BY t1.rowid DESC
   10216   }
   10217 } {15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10218 do_test boundary3-2.53.le.5 {
   10219   db eval {
   10220     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10221      WHERE t2.a=15
   10222      ORDER BY x
   10223   }
   10224 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10225 do_test boundary3-2.53.le.10 {
   10226   db eval {
   10227     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   10228      WHERE t2.a=15
   10229      ORDER BY t1.rowid
   10230   }
   10231 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15}
   10232 do_test boundary3-2.53.le.11 {
   10233   db eval {
   10234     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   10235      WHERE t2.a=15
   10236      ORDER BY t1.rowid DESC
   10237   }
   10238 } {15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10239 do_test boundary3-2.54.1 {
   10240   db eval {
   10241     SELECT t1.* FROM t1, t2 WHERE t1.rowid=140737488355327 AND t2.a=t1.a
   10242   }
   10243 } {25 00007fffffffffff}
   10244 do_test boundary3-2.54.2 {
   10245   db eval {
   10246     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='00007fffffffffff'
   10247   }
   10248 } {140737488355327 25}
   10249 do_test boundary3-2.54.3 {
   10250   db eval {
   10251     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=25
   10252   }
   10253 } {140737488355327 00007fffffffffff}
   10254 do_test boundary3-2.54.gt.1 {
   10255   db eval {
   10256     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10257      WHERE t1.rowid > 140737488355327 ORDER BY t2.a
   10258   }
   10259 } {3 10 13 17 26 27 28 34 43 45}
   10260 do_test boundary3-2.54.gt.2 {
   10261   db eval {
   10262     SELECT t2.a FROM t2 NATURAL JOIN t1
   10263      WHERE t1.rowid > 140737488355327 ORDER BY t1.a DESC
   10264   }
   10265 } {45 43 34 28 27 26 17 13 10 3}
   10266 do_test boundary3-2.54.gt.3 {
   10267   db eval {
   10268     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10269      WHERE t2.a=25
   10270      ORDER BY t1.rowid
   10271   }
   10272 } {34 10 26 13 43 27 45 17 28 3}
   10273 do_test boundary3-2.54.gt.4 {
   10274   db eval {
   10275     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10276      WHERE t2.a=25
   10277      ORDER BY t1.rowid DESC
   10278   }
   10279 } {3 28 17 45 27 43 13 26 10 34}
   10280 do_test boundary3-2.54.gt.5 {
   10281   db eval {
   10282     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10283      WHERE t2.a=25
   10284      ORDER BY x
   10285   }
   10286 } {34 10 26 13 43 27 45 17 28 3}
   10287 do_test boundary3-2.54.ge.1 {
   10288   db eval {
   10289     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10290      WHERE t1.rowid >= 140737488355327 ORDER BY t2.a
   10291   }
   10292 } {3 10 13 17 25 26 27 28 34 43 45}
   10293 do_test boundary3-2.54.ge.2 {
   10294   db eval {
   10295     SELECT t2.a FROM t2 NATURAL JOIN t1
   10296      WHERE t1.rowid >= 140737488355327 ORDER BY t1.a DESC
   10297   }
   10298 } {45 43 34 28 27 26 25 17 13 10 3}
   10299 do_test boundary3-2.54.ge.3 {
   10300   db eval {
   10301     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10302      WHERE t2.a=25
   10303      ORDER BY t1.rowid
   10304   }
   10305 } {25 34 10 26 13 43 27 45 17 28 3}
   10306 do_test boundary3-2.54.ge.4 {
   10307   db eval {
   10308     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10309      WHERE t2.a=25
   10310      ORDER BY t1.rowid DESC
   10311   }
   10312 } {3 28 17 45 27 43 13 26 10 34 25}
   10313 do_test boundary3-2.54.ge.5 {
   10314   db eval {
   10315     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10316      WHERE t2.a=25
   10317      ORDER BY x
   10318   }
   10319 } {25 34 10 26 13 43 27 45 17 28 3}
   10320 do_test boundary3-2.54.lt.1 {
   10321   db eval {
   10322     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10323      WHERE t1.rowid < 140737488355327 ORDER BY t2.a
   10324   }
   10325 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   10326 do_test boundary3-2.54.lt.2 {
   10327   db eval {
   10328     SELECT t2.a FROM t2 NATURAL JOIN t1
   10329      WHERE t1.rowid < 140737488355327 ORDER BY t1.a DESC
   10330   }
   10331 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   10332 do_test boundary3-2.54.lt.3 {
   10333   db eval {
   10334     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10335      WHERE t2.a=25
   10336      ORDER BY t1.rowid
   10337   }
   10338 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56}
   10339 do_test boundary3-2.54.lt.4 {
   10340   db eval {
   10341     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10342      WHERE t2.a=25
   10343      ORDER BY t1.rowid DESC
   10344   }
   10345 } {56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10346 do_test boundary3-2.54.lt.5 {
   10347   db eval {
   10348     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10349      WHERE t2.a=25
   10350      ORDER BY x
   10351   }
   10352 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10353 do_test boundary3-2.54.le.1 {
   10354   db eval {
   10355     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10356      WHERE t1.rowid <= 140737488355327 ORDER BY t2.a
   10357   }
   10358 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 25 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   10359 do_test boundary3-2.54.le.2 {
   10360   db eval {
   10361     SELECT t2.a FROM t2 NATURAL JOIN t1
   10362      WHERE t1.rowid <= 140737488355327 ORDER BY t1.a DESC
   10363   }
   10364 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 25 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   10365 do_test boundary3-2.54.le.3 {
   10366   db eval {
   10367     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10368      WHERE t2.a=25
   10369      ORDER BY t1.rowid
   10370   }
   10371 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25}
   10372 do_test boundary3-2.54.le.4 {
   10373   db eval {
   10374     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10375      WHERE t2.a=25
   10376      ORDER BY t1.rowid DESC
   10377   }
   10378 } {25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10379 do_test boundary3-2.54.le.5 {
   10380   db eval {
   10381     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10382      WHERE t2.a=25
   10383      ORDER BY x
   10384   }
   10385 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10386 do_test boundary3-2.55.1 {
   10387   db eval {
   10388     SELECT t1.* FROM t1, t2 WHERE t1.rowid=281474976710656 AND t2.a=t1.a
   10389   }
   10390 } {26 0001000000000000}
   10391 do_test boundary3-2.55.2 {
   10392   db eval {
   10393     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0001000000000000'
   10394   }
   10395 } {281474976710656 26}
   10396 do_test boundary3-2.55.3 {
   10397   db eval {
   10398     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=26
   10399   }
   10400 } {281474976710656 0001000000000000}
   10401 do_test boundary3-2.55.gt.1 {
   10402   db eval {
   10403     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10404      WHERE t1.rowid > 281474976710656 ORDER BY t2.a
   10405   }
   10406 } {3 13 17 27 28 43 45}
   10407 do_test boundary3-2.55.gt.2 {
   10408   db eval {
   10409     SELECT t2.a FROM t2 NATURAL JOIN t1
   10410      WHERE t1.rowid > 281474976710656 ORDER BY t1.a DESC
   10411   }
   10412 } {45 43 28 27 17 13 3}
   10413 do_test boundary3-2.55.gt.3 {
   10414   db eval {
   10415     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10416      WHERE t2.a=26
   10417      ORDER BY t1.rowid
   10418   }
   10419 } {13 43 27 45 17 28 3}
   10420 do_test boundary3-2.55.gt.4 {
   10421   db eval {
   10422     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10423      WHERE t2.a=26
   10424      ORDER BY t1.rowid DESC
   10425   }
   10426 } {3 28 17 45 27 43 13}
   10427 do_test boundary3-2.55.gt.5 {
   10428   db eval {
   10429     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10430      WHERE t2.a=26
   10431      ORDER BY x
   10432   }
   10433 } {13 43 27 45 17 28 3}
   10434 do_test boundary3-2.55.ge.1 {
   10435   db eval {
   10436     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10437      WHERE t1.rowid >= 281474976710656 ORDER BY t2.a
   10438   }
   10439 } {3 13 17 26 27 28 43 45}
   10440 do_test boundary3-2.55.ge.2 {
   10441   db eval {
   10442     SELECT t2.a FROM t2 NATURAL JOIN t1
   10443      WHERE t1.rowid >= 281474976710656 ORDER BY t1.a DESC
   10444   }
   10445 } {45 43 28 27 26 17 13 3}
   10446 do_test boundary3-2.55.ge.3 {
   10447   db eval {
   10448     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10449      WHERE t2.a=26
   10450      ORDER BY t1.rowid
   10451   }
   10452 } {26 13 43 27 45 17 28 3}
   10453 do_test boundary3-2.55.ge.4 {
   10454   db eval {
   10455     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10456      WHERE t2.a=26
   10457      ORDER BY t1.rowid DESC
   10458   }
   10459 } {3 28 17 45 27 43 13 26}
   10460 do_test boundary3-2.55.ge.5 {
   10461   db eval {
   10462     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10463      WHERE t2.a=26
   10464      ORDER BY x
   10465   }
   10466 } {26 13 43 27 45 17 28 3}
   10467 do_test boundary3-2.55.lt.1 {
   10468   db eval {
   10469     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10470      WHERE t1.rowid < 281474976710656 ORDER BY t2.a
   10471   }
   10472 } {1 2 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 22 23 24 25 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   10473 do_test boundary3-2.55.lt.2 {
   10474   db eval {
   10475     SELECT t2.a FROM t2 NATURAL JOIN t1
   10476      WHERE t1.rowid < 281474976710656 ORDER BY t1.a DESC
   10477   }
   10478 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 25 24 23 22 21 20 19 18 16 15 14 12 11 10 9 8 7 6 5 4 2 1}
   10479 do_test boundary3-2.55.lt.3 {
   10480   db eval {
   10481     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10482      WHERE t2.a=26
   10483      ORDER BY t1.rowid
   10484   }
   10485 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10}
   10486 do_test boundary3-2.55.lt.4 {
   10487   db eval {
   10488     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10489      WHERE t2.a=26
   10490      ORDER BY t1.rowid DESC
   10491   }
   10492 } {10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10493 do_test boundary3-2.55.lt.5 {
   10494   db eval {
   10495     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10496      WHERE t2.a=26
   10497      ORDER BY x
   10498   }
   10499 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10500 do_test boundary3-2.55.le.1 {
   10501   db eval {
   10502     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10503      WHERE t1.rowid <= 281474976710656 ORDER BY t2.a
   10504   }
   10505 } {1 2 4 5 6 7 8 9 10 11 12 14 15 16 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   10506 do_test boundary3-2.55.le.2 {
   10507   db eval {
   10508     SELECT t2.a FROM t2 NATURAL JOIN t1
   10509      WHERE t1.rowid <= 281474976710656 ORDER BY t1.a DESC
   10510   }
   10511 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 34 33 32 31 30 29 26 25 24 23 22 21 20 19 18 16 15 14 12 11 10 9 8 7 6 5 4 2 1}
   10512 do_test boundary3-2.55.le.3 {
   10513   db eval {
   10514     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10515      WHERE t2.a=26
   10516      ORDER BY t1.rowid
   10517   }
   10518 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26}
   10519 do_test boundary3-2.55.le.4 {
   10520   db eval {
   10521     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10522      WHERE t2.a=26
   10523      ORDER BY t1.rowid DESC
   10524   }
   10525 } {26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10526 do_test boundary3-2.55.le.5 {
   10527   db eval {
   10528     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10529      WHERE t2.a=26
   10530      ORDER BY x
   10531   }
   10532 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10533 do_test boundary3-2.56.1 {
   10534   db eval {
   10535     SELECT t1.* FROM t1, t2 WHERE t1.rowid=32767 AND t2.a=t1.a
   10536   }
   10537 } {23 0000000000007fff}
   10538 do_test boundary3-2.56.2 {
   10539   db eval {
   10540     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000007fff'
   10541   }
   10542 } {32767 23}
   10543 do_test boundary3-2.56.3 {
   10544   db eval {
   10545     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=23
   10546   }
   10547 } {32767 0000000000007fff}
   10548 do_test boundary3-2.56.gt.1 {
   10549   db eval {
   10550     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10551      WHERE t1.rowid > 32767 ORDER BY t2.a
   10552   }
   10553 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
   10554 do_test boundary3-2.56.gt.2 {
   10555   db eval {
   10556     SELECT t2.a FROM t2 NATURAL JOIN t1
   10557      WHERE t1.rowid > 32767 ORDER BY t1.a DESC
   10558   }
   10559 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   10560 do_test boundary3-2.56.gt.3 {
   10561   db eval {
   10562     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10563      WHERE t2.a=23
   10564      ORDER BY t1.rowid
   10565   }
   10566 } {50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10567 do_test boundary3-2.56.gt.4 {
   10568   db eval {
   10569     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10570      WHERE t2.a=23
   10571      ORDER BY t1.rowid DESC
   10572   }
   10573 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50}
   10574 do_test boundary3-2.56.gt.5 {
   10575   db eval {
   10576     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10577      WHERE t2.a=23
   10578      ORDER BY x
   10579   }
   10580 } {50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10581 do_test boundary3-2.56.gt.10 {
   10582   db eval {
   10583     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   10584      WHERE t2.a=23
   10585      ORDER BY t1.rowid
   10586   }
   10587 } {50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10588 do_test boundary3-2.56.gt.11 {
   10589   db eval {
   10590     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   10591      WHERE t2.a=23
   10592      ORDER BY t1.rowid DESC
   10593   }
   10594 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50}
   10595 do_test boundary3-2.56.ge.1 {
   10596   db eval {
   10597     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10598      WHERE t1.rowid >= 32767 ORDER BY t2.a
   10599   }
   10600 } {3 6 7 9 10 12 13 14 15 17 18 19 20 22 23 24 25 26 27 28 34 35 36 39 40 42 43 45 46 48 50 51 56 57 62}
   10601 do_test boundary3-2.56.ge.2 {
   10602   db eval {
   10603     SELECT t2.a FROM t2 NATURAL JOIN t1
   10604      WHERE t1.rowid >= 32767 ORDER BY t1.a DESC
   10605   }
   10606 } {62 57 56 51 50 48 46 45 43 42 40 39 36 35 34 28 27 26 25 24 23 22 20 19 18 17 15 14 13 12 10 9 7 6 3}
   10607 do_test boundary3-2.56.ge.3 {
   10608   db eval {
   10609     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10610      WHERE t2.a=23
   10611      ORDER BY t1.rowid
   10612   }
   10613 } {23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10614 do_test boundary3-2.56.ge.4 {
   10615   db eval {
   10616     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10617      WHERE t2.a=23
   10618      ORDER BY t1.rowid DESC
   10619   }
   10620 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23}
   10621 do_test boundary3-2.56.ge.5 {
   10622   db eval {
   10623     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10624      WHERE t2.a=23
   10625      ORDER BY x
   10626   }
   10627 } {23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10628 do_test boundary3-2.56.ge.10 {
   10629   db eval {
   10630     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   10631      WHERE t2.a=23
   10632      ORDER BY t1.rowid
   10633   }
   10634 } {23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10635 do_test boundary3-2.56.ge.11 {
   10636   db eval {
   10637     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   10638      WHERE t2.a=23
   10639      ORDER BY t1.rowid DESC
   10640   }
   10641 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23}
   10642 do_test boundary3-2.56.lt.1 {
   10643   db eval {
   10644     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10645      WHERE t1.rowid < 32767 ORDER BY t2.a
   10646   }
   10647 } {1 2 4 5 8 11 16 21 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
   10648 do_test boundary3-2.56.lt.2 {
   10649   db eval {
   10650     SELECT t2.a FROM t2 NATURAL JOIN t1
   10651      WHERE t1.rowid < 32767 ORDER BY t1.a DESC
   10652   }
   10653 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 21 16 11 8 5 4 2 1}
   10654 do_test boundary3-2.56.lt.3 {
   10655   db eval {
   10656     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10657      WHERE t2.a=23
   10658      ORDER BY t1.rowid
   10659   }
   10660 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16}
   10661 do_test boundary3-2.56.lt.4 {
   10662   db eval {
   10663     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10664      WHERE t2.a=23
   10665      ORDER BY t1.rowid DESC
   10666   }
   10667 } {16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10668 do_test boundary3-2.56.lt.5 {
   10669   db eval {
   10670     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10671      WHERE t2.a=23
   10672      ORDER BY x
   10673   }
   10674 } {59 60 41 5 31 4 49 30 61 8 16 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10675 do_test boundary3-2.56.lt.10 {
   10676   db eval {
   10677     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   10678      WHERE t2.a=23
   10679      ORDER BY t1.rowid
   10680   }
   10681 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16}
   10682 do_test boundary3-2.56.lt.11 {
   10683   db eval {
   10684     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   10685      WHERE t2.a=23
   10686      ORDER BY t1.rowid DESC
   10687   }
   10688 } {16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10689 do_test boundary3-2.56.le.1 {
   10690   db eval {
   10691     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10692      WHERE t1.rowid <= 32767 ORDER BY t2.a
   10693   }
   10694 } {1 2 4 5 8 11 16 21 23 29 30 31 32 33 37 38 41 44 47 49 52 53 54 55 58 59 60 61 63 64}
   10695 do_test boundary3-2.56.le.2 {
   10696   db eval {
   10697     SELECT t2.a FROM t2 NATURAL JOIN t1
   10698      WHERE t1.rowid <= 32767 ORDER BY t1.a DESC
   10699   }
   10700 } {64 63 61 60 59 58 55 54 53 52 49 47 44 41 38 37 33 32 31 30 29 23 21 16 11 8 5 4 2 1}
   10701 do_test boundary3-2.56.le.3 {
   10702   db eval {
   10703     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10704      WHERE t2.a=23
   10705      ORDER BY t1.rowid
   10706   }
   10707 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23}
   10708 do_test boundary3-2.56.le.4 {
   10709   db eval {
   10710     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10711      WHERE t2.a=23
   10712      ORDER BY t1.rowid DESC
   10713   }
   10714 } {23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10715 do_test boundary3-2.56.le.5 {
   10716   db eval {
   10717     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10718      WHERE t2.a=23
   10719      ORDER BY x
   10720   }
   10721 } {59 60 41 5 31 4 49 30 61 8 16 23 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10722 do_test boundary3-2.56.le.10 {
   10723   db eval {
   10724     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   10725      WHERE t2.a=23
   10726      ORDER BY t1.rowid
   10727   }
   10728 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23}
   10729 do_test boundary3-2.56.le.11 {
   10730   db eval {
   10731     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   10732      WHERE t2.a=23
   10733      ORDER BY t1.rowid DESC
   10734   }
   10735 } {23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10736 do_test boundary3-2.57.1 {
   10737   db eval {
   10738     SELECT t1.* FROM t1, t2 WHERE t1.rowid=127 AND t2.a=t1.a
   10739   }
   10740 } {4 000000000000007f}
   10741 do_test boundary3-2.57.2 {
   10742   db eval {
   10743     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='000000000000007f'
   10744   }
   10745 } {127 4}
   10746 do_test boundary3-2.57.3 {
   10747   db eval {
   10748     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=4
   10749   }
   10750 } {127 000000000000007f}
   10751 do_test boundary3-2.57.gt.1 {
   10752   db eval {
   10753     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10754      WHERE t1.rowid > 127 ORDER BY t2.a
   10755   }
   10756 } {3 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   10757 do_test boundary3-2.57.gt.2 {
   10758   db eval {
   10759     SELECT t2.a FROM t2 NATURAL JOIN t1
   10760      WHERE t1.rowid > 127 ORDER BY t1.a DESC
   10761   }
   10762 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 3}
   10763 do_test boundary3-2.57.gt.3 {
   10764   db eval {
   10765     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10766      WHERE t2.a=4
   10767      ORDER BY t1.rowid
   10768   }
   10769 } {49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10770 do_test boundary3-2.57.gt.4 {
   10771   db eval {
   10772     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10773      WHERE t2.a=4
   10774      ORDER BY t1.rowid DESC
   10775   }
   10776 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49}
   10777 do_test boundary3-2.57.gt.5 {
   10778   db eval {
   10779     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10780      WHERE t2.a=4
   10781      ORDER BY x
   10782   }
   10783 } {49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10784 do_test boundary3-2.57.gt.10 {
   10785   db eval {
   10786     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   10787      WHERE t2.a=4
   10788      ORDER BY t1.rowid
   10789   }
   10790 } {49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10791 do_test boundary3-2.57.gt.11 {
   10792   db eval {
   10793     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   10794      WHERE t2.a=4
   10795      ORDER BY t1.rowid DESC
   10796   }
   10797 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49}
   10798 do_test boundary3-2.57.ge.1 {
   10799   db eval {
   10800     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10801      WHERE t1.rowid >= 127 ORDER BY t2.a
   10802   }
   10803 } {3 4 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   10804 do_test boundary3-2.57.ge.2 {
   10805   db eval {
   10806     SELECT t2.a FROM t2 NATURAL JOIN t1
   10807      WHERE t1.rowid >= 127 ORDER BY t1.a DESC
   10808   }
   10809 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 4 3}
   10810 do_test boundary3-2.57.ge.3 {
   10811   db eval {
   10812     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10813      WHERE t2.a=4
   10814      ORDER BY t1.rowid
   10815   }
   10816 } {4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10817 do_test boundary3-2.57.ge.4 {
   10818   db eval {
   10819     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10820      WHERE t2.a=4
   10821      ORDER BY t1.rowid DESC
   10822   }
   10823 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4}
   10824 do_test boundary3-2.57.ge.5 {
   10825   db eval {
   10826     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   10827      WHERE t2.a=4
   10828      ORDER BY x
   10829   }
   10830 } {4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10831 do_test boundary3-2.57.ge.10 {
   10832   db eval {
   10833     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   10834      WHERE t2.a=4
   10835      ORDER BY t1.rowid
   10836   }
   10837 } {4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   10838 do_test boundary3-2.57.ge.11 {
   10839   db eval {
   10840     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   10841      WHERE t2.a=4
   10842      ORDER BY t1.rowid DESC
   10843   }
   10844 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4}
   10845 do_test boundary3-2.57.lt.1 {
   10846   db eval {
   10847     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10848      WHERE t1.rowid < 127 ORDER BY t2.a
   10849   }
   10850 } {1 2 5 11 21 29 31 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   10851 do_test boundary3-2.57.lt.2 {
   10852   db eval {
   10853     SELECT t2.a FROM t2 NATURAL JOIN t1
   10854      WHERE t1.rowid < 127 ORDER BY t1.a DESC
   10855   }
   10856 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 31 29 21 11 5 2 1}
   10857 do_test boundary3-2.57.lt.3 {
   10858   db eval {
   10859     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10860      WHERE t2.a=4
   10861      ORDER BY t1.rowid
   10862   }
   10863 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31}
   10864 do_test boundary3-2.57.lt.4 {
   10865   db eval {
   10866     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10867      WHERE t2.a=4
   10868      ORDER BY t1.rowid DESC
   10869   }
   10870 } {31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10871 do_test boundary3-2.57.lt.5 {
   10872   db eval {
   10873     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   10874      WHERE t2.a=4
   10875      ORDER BY x
   10876   }
   10877 } {59 60 41 5 31 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10878 do_test boundary3-2.57.lt.10 {
   10879   db eval {
   10880     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   10881      WHERE t2.a=4
   10882      ORDER BY t1.rowid
   10883   }
   10884 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31}
   10885 do_test boundary3-2.57.lt.11 {
   10886   db eval {
   10887     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   10888      WHERE t2.a=4
   10889      ORDER BY t1.rowid DESC
   10890   }
   10891 } {31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10892 do_test boundary3-2.57.le.1 {
   10893   db eval {
   10894     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10895      WHERE t1.rowid <= 127 ORDER BY t2.a
   10896   }
   10897 } {1 2 4 5 11 21 29 31 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   10898 do_test boundary3-2.57.le.2 {
   10899   db eval {
   10900     SELECT t2.a FROM t2 NATURAL JOIN t1
   10901      WHERE t1.rowid <= 127 ORDER BY t1.a DESC
   10902   }
   10903 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 31 29 21 11 5 4 2 1}
   10904 do_test boundary3-2.57.le.3 {
   10905   db eval {
   10906     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10907      WHERE t2.a=4
   10908      ORDER BY t1.rowid
   10909   }
   10910 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4}
   10911 do_test boundary3-2.57.le.4 {
   10912   db eval {
   10913     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10914      WHERE t2.a=4
   10915      ORDER BY t1.rowid DESC
   10916   }
   10917 } {4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10918 do_test boundary3-2.57.le.5 {
   10919   db eval {
   10920     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   10921      WHERE t2.a=4
   10922      ORDER BY x
   10923   }
   10924 } {59 60 41 5 31 4 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   10925 do_test boundary3-2.57.le.10 {
   10926   db eval {
   10927     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   10928      WHERE t2.a=4
   10929      ORDER BY t1.rowid
   10930   }
   10931 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4}
   10932 do_test boundary3-2.57.le.11 {
   10933   db eval {
   10934     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   10935      WHERE t2.a=4
   10936      ORDER BY t1.rowid DESC
   10937   }
   10938 } {4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   10939 do_test boundary3-2.58.1 {
   10940   db eval {
   10941     SELECT t1.* FROM t1, t2 WHERE t1.rowid=36028797018963967 AND t2.a=t1.a
   10942   }
   10943 } {27 007fffffffffffff}
   10944 do_test boundary3-2.58.2 {
   10945   db eval {
   10946     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='007fffffffffffff'
   10947   }
   10948 } {36028797018963967 27}
   10949 do_test boundary3-2.58.3 {
   10950   db eval {
   10951     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=27
   10952   }
   10953 } {36028797018963967 007fffffffffffff}
   10954 do_test boundary3-2.58.gt.1 {
   10955   db eval {
   10956     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10957      WHERE t1.rowid > 36028797018963967 ORDER BY t2.a
   10958   }
   10959 } {3 17 28 45}
   10960 do_test boundary3-2.58.gt.2 {
   10961   db eval {
   10962     SELECT t2.a FROM t2 NATURAL JOIN t1
   10963      WHERE t1.rowid > 36028797018963967 ORDER BY t1.a DESC
   10964   }
   10965 } {45 28 17 3}
   10966 do_test boundary3-2.58.gt.3 {
   10967   db eval {
   10968     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10969      WHERE t2.a=27
   10970      ORDER BY t1.rowid
   10971   }
   10972 } {45 17 28 3}
   10973 do_test boundary3-2.58.gt.4 {
   10974   db eval {
   10975     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10976      WHERE t2.a=27
   10977      ORDER BY t1.rowid DESC
   10978   }
   10979 } {3 28 17 45}
   10980 do_test boundary3-2.58.gt.5 {
   10981   db eval {
   10982     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   10983      WHERE t2.a=27
   10984      ORDER BY x
   10985   }
   10986 } {45 17 28 3}
   10987 do_test boundary3-2.58.ge.1 {
   10988   db eval {
   10989     SELECT t2.a FROM t1 JOIN t2 USING(a)
   10990      WHERE t1.rowid >= 36028797018963967 ORDER BY t2.a
   10991   }
   10992 } {3 17 27 28 45}
   10993 do_test boundary3-2.58.ge.2 {
   10994   db eval {
   10995     SELECT t2.a FROM t2 NATURAL JOIN t1
   10996      WHERE t1.rowid >= 36028797018963967 ORDER BY t1.a DESC
   10997   }
   10998 } {45 28 27 17 3}
   10999 do_test boundary3-2.58.ge.3 {
   11000   db eval {
   11001     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11002      WHERE t2.a=27
   11003      ORDER BY t1.rowid
   11004   }
   11005 } {27 45 17 28 3}
   11006 do_test boundary3-2.58.ge.4 {
   11007   db eval {
   11008     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11009      WHERE t2.a=27
   11010      ORDER BY t1.rowid DESC
   11011   }
   11012 } {3 28 17 45 27}
   11013 do_test boundary3-2.58.ge.5 {
   11014   db eval {
   11015     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11016      WHERE t2.a=27
   11017      ORDER BY x
   11018   }
   11019 } {27 45 17 28 3}
   11020 do_test boundary3-2.58.lt.1 {
   11021   db eval {
   11022     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11023      WHERE t1.rowid < 36028797018963967 ORDER BY t2.a
   11024   }
   11025 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   11026 do_test boundary3-2.58.lt.2 {
   11027   db eval {
   11028     SELECT t2.a FROM t2 NATURAL JOIN t1
   11029      WHERE t1.rowid < 36028797018963967 ORDER BY t1.a DESC
   11030   }
   11031 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   11032 do_test boundary3-2.58.lt.3 {
   11033   db eval {
   11034     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11035      WHERE t2.a=27
   11036      ORDER BY t1.rowid
   11037   }
   11038 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43}
   11039 do_test boundary3-2.58.lt.4 {
   11040   db eval {
   11041     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11042      WHERE t2.a=27
   11043      ORDER BY t1.rowid DESC
   11044   }
   11045 } {43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11046 do_test boundary3-2.58.lt.5 {
   11047   db eval {
   11048     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11049      WHERE t2.a=27
   11050      ORDER BY x
   11051   }
   11052 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11053 do_test boundary3-2.58.le.1 {
   11054   db eval {
   11055     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11056      WHERE t1.rowid <= 36028797018963967 ORDER BY t2.a
   11057   }
   11058 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   11059 do_test boundary3-2.58.le.2 {
   11060   db eval {
   11061     SELECT t2.a FROM t2 NATURAL JOIN t1
   11062      WHERE t1.rowid <= 36028797018963967 ORDER BY t1.a DESC
   11063   }
   11064 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 27 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   11065 do_test boundary3-2.58.le.3 {
   11066   db eval {
   11067     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11068      WHERE t2.a=27
   11069      ORDER BY t1.rowid
   11070   }
   11071 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27}
   11072 do_test boundary3-2.58.le.4 {
   11073   db eval {
   11074     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11075      WHERE t2.a=27
   11076      ORDER BY t1.rowid DESC
   11077   }
   11078 } {27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11079 do_test boundary3-2.58.le.5 {
   11080   db eval {
   11081     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11082      WHERE t2.a=27
   11083      ORDER BY x
   11084   }
   11085 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11086 do_test boundary3-2.59.1 {
   11087   db eval {
   11088     SELECT t1.* FROM t1, t2 WHERE t1.rowid=4398046511104 AND t2.a=t1.a
   11089   }
   11090 } {56 0000040000000000}
   11091 do_test boundary3-2.59.2 {
   11092   db eval {
   11093     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000040000000000'
   11094   }
   11095 } {4398046511104 56}
   11096 do_test boundary3-2.59.3 {
   11097   db eval {
   11098     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=56
   11099   }
   11100 } {4398046511104 0000040000000000}
   11101 do_test boundary3-2.59.gt.1 {
   11102   db eval {
   11103     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11104      WHERE t1.rowid > 4398046511104 ORDER BY t2.a
   11105   }
   11106 } {3 10 13 17 25 26 27 28 34 43 45}
   11107 do_test boundary3-2.59.gt.2 {
   11108   db eval {
   11109     SELECT t2.a FROM t2 NATURAL JOIN t1
   11110      WHERE t1.rowid > 4398046511104 ORDER BY t1.a DESC
   11111   }
   11112 } {45 43 34 28 27 26 25 17 13 10 3}
   11113 do_test boundary3-2.59.gt.3 {
   11114   db eval {
   11115     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11116      WHERE t2.a=56
   11117      ORDER BY t1.rowid
   11118   }
   11119 } {25 34 10 26 13 43 27 45 17 28 3}
   11120 do_test boundary3-2.59.gt.4 {
   11121   db eval {
   11122     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11123      WHERE t2.a=56
   11124      ORDER BY t1.rowid DESC
   11125   }
   11126 } {3 28 17 45 27 43 13 26 10 34 25}
   11127 do_test boundary3-2.59.gt.5 {
   11128   db eval {
   11129     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11130      WHERE t2.a=56
   11131      ORDER BY x
   11132   }
   11133 } {25 34 10 26 13 43 27 45 17 28 3}
   11134 do_test boundary3-2.59.gt.10 {
   11135   db eval {
   11136     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   11137      WHERE t2.a=56
   11138      ORDER BY t1.rowid
   11139   }
   11140 } {25 34 10 26 13 43 27 45 17 28 3}
   11141 do_test boundary3-2.59.gt.11 {
   11142   db eval {
   11143     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   11144      WHERE t2.a=56
   11145      ORDER BY t1.rowid DESC
   11146   }
   11147 } {3 28 17 45 27 43 13 26 10 34 25}
   11148 do_test boundary3-2.59.ge.1 {
   11149   db eval {
   11150     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11151      WHERE t1.rowid >= 4398046511104 ORDER BY t2.a
   11152   }
   11153 } {3 10 13 17 25 26 27 28 34 43 45 56}
   11154 do_test boundary3-2.59.ge.2 {
   11155   db eval {
   11156     SELECT t2.a FROM t2 NATURAL JOIN t1
   11157      WHERE t1.rowid >= 4398046511104 ORDER BY t1.a DESC
   11158   }
   11159 } {56 45 43 34 28 27 26 25 17 13 10 3}
   11160 do_test boundary3-2.59.ge.3 {
   11161   db eval {
   11162     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11163      WHERE t2.a=56
   11164      ORDER BY t1.rowid
   11165   }
   11166 } {56 25 34 10 26 13 43 27 45 17 28 3}
   11167 do_test boundary3-2.59.ge.4 {
   11168   db eval {
   11169     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11170      WHERE t2.a=56
   11171      ORDER BY t1.rowid DESC
   11172   }
   11173 } {3 28 17 45 27 43 13 26 10 34 25 56}
   11174 do_test boundary3-2.59.ge.5 {
   11175   db eval {
   11176     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11177      WHERE t2.a=56
   11178      ORDER BY x
   11179   }
   11180 } {56 25 34 10 26 13 43 27 45 17 28 3}
   11181 do_test boundary3-2.59.ge.10 {
   11182   db eval {
   11183     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   11184      WHERE t2.a=56
   11185      ORDER BY t1.rowid
   11186   }
   11187 } {56 25 34 10 26 13 43 27 45 17 28 3}
   11188 do_test boundary3-2.59.ge.11 {
   11189   db eval {
   11190     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   11191      WHERE t2.a=56
   11192      ORDER BY t1.rowid DESC
   11193   }
   11194 } {3 28 17 45 27 43 13 26 10 34 25 56}
   11195 do_test boundary3-2.59.lt.1 {
   11196   db eval {
   11197     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11198      WHERE t1.rowid < 4398046511104 ORDER BY t2.a
   11199   }
   11200 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 57 58 59 60 61 62 63 64}
   11201 do_test boundary3-2.59.lt.2 {
   11202   db eval {
   11203     SELECT t2.a FROM t2 NATURAL JOIN t1
   11204      WHERE t1.rowid < 4398046511104 ORDER BY t1.a DESC
   11205   }
   11206 } {64 63 62 61 60 59 58 57 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   11207 do_test boundary3-2.59.lt.3 {
   11208   db eval {
   11209     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11210      WHERE t2.a=56
   11211      ORDER BY t1.rowid
   11212   }
   11213 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7}
   11214 do_test boundary3-2.59.lt.4 {
   11215   db eval {
   11216     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11217      WHERE t2.a=56
   11218      ORDER BY t1.rowid DESC
   11219   }
   11220 } {7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11221 do_test boundary3-2.59.lt.5 {
   11222   db eval {
   11223     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11224      WHERE t2.a=56
   11225      ORDER BY x
   11226   }
   11227 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11228 do_test boundary3-2.59.lt.10 {
   11229   db eval {
   11230     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   11231      WHERE t2.a=56
   11232      ORDER BY t1.rowid
   11233   }
   11234 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7}
   11235 do_test boundary3-2.59.lt.11 {
   11236   db eval {
   11237     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   11238      WHERE t2.a=56
   11239      ORDER BY t1.rowid DESC
   11240   }
   11241 } {7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11242 do_test boundary3-2.59.le.1 {
   11243   db eval {
   11244     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11245      WHERE t1.rowid <= 4398046511104 ORDER BY t2.a
   11246   }
   11247 } {1 2 4 5 6 7 8 9 11 12 14 15 16 18 19 20 21 22 23 24 29 30 31 32 33 35 36 37 38 39 40 41 42 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   11248 do_test boundary3-2.59.le.2 {
   11249   db eval {
   11250     SELECT t2.a FROM t2 NATURAL JOIN t1
   11251      WHERE t1.rowid <= 4398046511104 ORDER BY t1.a DESC
   11252   }
   11253 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 42 41 40 39 38 37 36 35 33 32 31 30 29 24 23 22 21 20 19 18 16 15 14 12 11 9 8 7 6 5 4 2 1}
   11254 do_test boundary3-2.59.le.3 {
   11255   db eval {
   11256     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11257      WHERE t2.a=56
   11258      ORDER BY t1.rowid
   11259   }
   11260 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56}
   11261 do_test boundary3-2.59.le.4 {
   11262   db eval {
   11263     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11264      WHERE t2.a=56
   11265      ORDER BY t1.rowid DESC
   11266   }
   11267 } {56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11268 do_test boundary3-2.59.le.5 {
   11269   db eval {
   11270     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11271      WHERE t2.a=56
   11272      ORDER BY x
   11273   }
   11274 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11275 do_test boundary3-2.59.le.10 {
   11276   db eval {
   11277     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   11278      WHERE t2.a=56
   11279      ORDER BY t1.rowid
   11280   }
   11281 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56}
   11282 do_test boundary3-2.59.le.11 {
   11283   db eval {
   11284     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   11285      WHERE t2.a=56
   11286      ORDER BY t1.rowid DESC
   11287   }
   11288 } {56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11289 do_test boundary3-2.60.1 {
   11290   db eval {
   11291     SELECT t1.* FROM t1, t2 WHERE t1.rowid=1 AND t2.a=t1.a
   11292   }
   11293 } {60 0000000000000001}
   11294 do_test boundary3-2.60.2 {
   11295   db eval {
   11296     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000001'
   11297   }
   11298 } {1 60}
   11299 do_test boundary3-2.60.3 {
   11300   db eval {
   11301     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=60
   11302   }
   11303 } {1 0000000000000001}
   11304 do_test boundary3-2.60.gt.1 {
   11305   db eval {
   11306     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11307      WHERE t1.rowid > 1 ORDER BY t2.a
   11308   }
   11309 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 41 42 43 45 46 48 49 50 51 56 57 61 62}
   11310 do_test boundary3-2.60.gt.2 {
   11311   db eval {
   11312     SELECT t2.a FROM t2 NATURAL JOIN t1
   11313      WHERE t1.rowid > 1 ORDER BY t1.a DESC
   11314   }
   11315 } {62 61 57 56 51 50 49 48 46 45 43 42 41 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   11316 do_test boundary3-2.60.gt.3 {
   11317   db eval {
   11318     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11319      WHERE t2.a=60
   11320      ORDER BY t1.rowid
   11321   }
   11322 } {41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11323 do_test boundary3-2.60.gt.4 {
   11324   db eval {
   11325     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11326      WHERE t2.a=60
   11327      ORDER BY t1.rowid DESC
   11328   }
   11329 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41}
   11330 do_test boundary3-2.60.gt.5 {
   11331   db eval {
   11332     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11333      WHERE t2.a=60
   11334      ORDER BY x
   11335   }
   11336 } {41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11337 do_test boundary3-2.60.gt.10 {
   11338   db eval {
   11339     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   11340      WHERE t2.a=60
   11341      ORDER BY t1.rowid
   11342   }
   11343 } {41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11344 do_test boundary3-2.60.gt.11 {
   11345   db eval {
   11346     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   11347      WHERE t2.a=60
   11348      ORDER BY t1.rowid DESC
   11349   }
   11350 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41}
   11351 do_test boundary3-2.60.ge.1 {
   11352   db eval {
   11353     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11354      WHERE t1.rowid >= 1 ORDER BY t2.a
   11355   }
   11356 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 41 42 43 45 46 48 49 50 51 56 57 60 61 62}
   11357 do_test boundary3-2.60.ge.2 {
   11358   db eval {
   11359     SELECT t2.a FROM t2 NATURAL JOIN t1
   11360      WHERE t1.rowid >= 1 ORDER BY t1.a DESC
   11361   }
   11362 } {62 61 60 57 56 51 50 49 48 46 45 43 42 41 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   11363 do_test boundary3-2.60.ge.3 {
   11364   db eval {
   11365     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11366      WHERE t2.a=60
   11367      ORDER BY t1.rowid
   11368   }
   11369 } {60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11370 do_test boundary3-2.60.ge.4 {
   11371   db eval {
   11372     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11373      WHERE t2.a=60
   11374      ORDER BY t1.rowid DESC
   11375   }
   11376 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60}
   11377 do_test boundary3-2.60.ge.5 {
   11378   db eval {
   11379     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11380      WHERE t2.a=60
   11381      ORDER BY x
   11382   }
   11383 } {60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11384 do_test boundary3-2.60.ge.10 {
   11385   db eval {
   11386     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   11387      WHERE t2.a=60
   11388      ORDER BY t1.rowid
   11389   }
   11390 } {60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11391 do_test boundary3-2.60.ge.11 {
   11392   db eval {
   11393     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   11394      WHERE t2.a=60
   11395      ORDER BY t1.rowid DESC
   11396   }
   11397 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60}
   11398 do_test boundary3-2.60.lt.1 {
   11399   db eval {
   11400     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11401      WHERE t1.rowid < 1 ORDER BY t2.a
   11402   }
   11403 } {1 2 11 21 29 32 33 37 38 44 47 52 53 54 55 58 59 63 64}
   11404 do_test boundary3-2.60.lt.2 {
   11405   db eval {
   11406     SELECT t2.a FROM t2 NATURAL JOIN t1
   11407      WHERE t1.rowid < 1 ORDER BY t1.a DESC
   11408   }
   11409 } {64 63 59 58 55 54 53 52 47 44 38 37 33 32 29 21 11 2 1}
   11410 do_test boundary3-2.60.lt.3 {
   11411   db eval {
   11412     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11413      WHERE t2.a=60
   11414      ORDER BY t1.rowid
   11415   }
   11416 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59}
   11417 do_test boundary3-2.60.lt.4 {
   11418   db eval {
   11419     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11420      WHERE t2.a=60
   11421      ORDER BY t1.rowid DESC
   11422   }
   11423 } {59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11424 do_test boundary3-2.60.lt.5 {
   11425   db eval {
   11426     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11427      WHERE t2.a=60
   11428      ORDER BY x
   11429   }
   11430 } {59 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11431 do_test boundary3-2.60.lt.10 {
   11432   db eval {
   11433     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   11434      WHERE t2.a=60
   11435      ORDER BY t1.rowid
   11436   }
   11437 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59}
   11438 do_test boundary3-2.60.lt.11 {
   11439   db eval {
   11440     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   11441      WHERE t2.a=60
   11442      ORDER BY t1.rowid DESC
   11443   }
   11444 } {59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11445 do_test boundary3-2.60.le.1 {
   11446   db eval {
   11447     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11448      WHERE t1.rowid <= 1 ORDER BY t2.a
   11449   }
   11450 } {1 2 11 21 29 32 33 37 38 44 47 52 53 54 55 58 59 60 63 64}
   11451 do_test boundary3-2.60.le.2 {
   11452   db eval {
   11453     SELECT t2.a FROM t2 NATURAL JOIN t1
   11454      WHERE t1.rowid <= 1 ORDER BY t1.a DESC
   11455   }
   11456 } {64 63 60 59 58 55 54 53 52 47 44 38 37 33 32 29 21 11 2 1}
   11457 do_test boundary3-2.60.le.3 {
   11458   db eval {
   11459     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11460      WHERE t2.a=60
   11461      ORDER BY t1.rowid
   11462   }
   11463 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60}
   11464 do_test boundary3-2.60.le.4 {
   11465   db eval {
   11466     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11467      WHERE t2.a=60
   11468      ORDER BY t1.rowid DESC
   11469   }
   11470 } {60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11471 do_test boundary3-2.60.le.5 {
   11472   db eval {
   11473     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11474      WHERE t2.a=60
   11475      ORDER BY x
   11476   }
   11477 } {59 60 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11478 do_test boundary3-2.60.le.10 {
   11479   db eval {
   11480     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   11481      WHERE t2.a=60
   11482      ORDER BY t1.rowid
   11483   }
   11484 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60}
   11485 do_test boundary3-2.60.le.11 {
   11486   db eval {
   11487     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   11488      WHERE t2.a=60
   11489      ORDER BY t1.rowid DESC
   11490   }
   11491 } {60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11492 do_test boundary3-2.61.1 {
   11493   db eval {
   11494     SELECT t1.* FROM t1, t2 WHERE t1.rowid=36028797018963968 AND t2.a=t1.a
   11495   }
   11496 } {45 0080000000000000}
   11497 do_test boundary3-2.61.2 {
   11498   db eval {
   11499     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0080000000000000'
   11500   }
   11501 } {36028797018963968 45}
   11502 do_test boundary3-2.61.3 {
   11503   db eval {
   11504     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=45
   11505   }
   11506 } {36028797018963968 0080000000000000}
   11507 do_test boundary3-2.61.gt.1 {
   11508   db eval {
   11509     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11510      WHERE t1.rowid > 36028797018963968 ORDER BY t2.a
   11511   }
   11512 } {3 17 28}
   11513 do_test boundary3-2.61.gt.2 {
   11514   db eval {
   11515     SELECT t2.a FROM t2 NATURAL JOIN t1
   11516      WHERE t1.rowid > 36028797018963968 ORDER BY t1.a DESC
   11517   }
   11518 } {28 17 3}
   11519 do_test boundary3-2.61.gt.3 {
   11520   db eval {
   11521     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11522      WHERE t2.a=45
   11523      ORDER BY t1.rowid
   11524   }
   11525 } {17 28 3}
   11526 do_test boundary3-2.61.gt.4 {
   11527   db eval {
   11528     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11529      WHERE t2.a=45
   11530      ORDER BY t1.rowid DESC
   11531   }
   11532 } {3 28 17}
   11533 do_test boundary3-2.61.gt.5 {
   11534   db eval {
   11535     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11536      WHERE t2.a=45
   11537      ORDER BY x
   11538   }
   11539 } {17 28 3}
   11540 do_test boundary3-2.61.ge.1 {
   11541   db eval {
   11542     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11543      WHERE t1.rowid >= 36028797018963968 ORDER BY t2.a
   11544   }
   11545 } {3 17 28 45}
   11546 do_test boundary3-2.61.ge.2 {
   11547   db eval {
   11548     SELECT t2.a FROM t2 NATURAL JOIN t1
   11549      WHERE t1.rowid >= 36028797018963968 ORDER BY t1.a DESC
   11550   }
   11551 } {45 28 17 3}
   11552 do_test boundary3-2.61.ge.3 {
   11553   db eval {
   11554     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11555      WHERE t2.a=45
   11556      ORDER BY t1.rowid
   11557   }
   11558 } {45 17 28 3}
   11559 do_test boundary3-2.61.ge.4 {
   11560   db eval {
   11561     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11562      WHERE t2.a=45
   11563      ORDER BY t1.rowid DESC
   11564   }
   11565 } {3 28 17 45}
   11566 do_test boundary3-2.61.ge.5 {
   11567   db eval {
   11568     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11569      WHERE t2.a=45
   11570      ORDER BY x
   11571   }
   11572 } {45 17 28 3}
   11573 do_test boundary3-2.61.lt.1 {
   11574   db eval {
   11575     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11576      WHERE t1.rowid < 36028797018963968 ORDER BY t2.a
   11577   }
   11578 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   11579 do_test boundary3-2.61.lt.2 {
   11580   db eval {
   11581     SELECT t2.a FROM t2 NATURAL JOIN t1
   11582      WHERE t1.rowid < 36028797018963968 ORDER BY t1.a DESC
   11583   }
   11584 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 27 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   11585 do_test boundary3-2.61.lt.3 {
   11586   db eval {
   11587     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11588      WHERE t2.a=45
   11589      ORDER BY t1.rowid
   11590   }
   11591 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27}
   11592 do_test boundary3-2.61.lt.4 {
   11593   db eval {
   11594     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11595      WHERE t2.a=45
   11596      ORDER BY t1.rowid DESC
   11597   }
   11598 } {27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11599 do_test boundary3-2.61.lt.5 {
   11600   db eval {
   11601     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11602      WHERE t2.a=45
   11603      ORDER BY x
   11604   }
   11605 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11606 do_test boundary3-2.61.le.1 {
   11607   db eval {
   11608     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11609      WHERE t1.rowid <= 36028797018963968 ORDER BY t2.a
   11610   }
   11611 } {1 2 4 5 6 7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 27 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   11612 do_test boundary3-2.61.le.2 {
   11613   db eval {
   11614     SELECT t2.a FROM t2 NATURAL JOIN t1
   11615      WHERE t1.rowid <= 36028797018963968 ORDER BY t1.a DESC
   11616   }
   11617 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 27 26 25 24 23 22 21 20 19 18 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1}
   11618 do_test boundary3-2.61.le.3 {
   11619   db eval {
   11620     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11621      WHERE t2.a=45
   11622      ORDER BY t1.rowid
   11623   }
   11624 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45}
   11625 do_test boundary3-2.61.le.4 {
   11626   db eval {
   11627     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11628      WHERE t2.a=45
   11629      ORDER BY t1.rowid DESC
   11630   }
   11631 } {45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   11632 do_test boundary3-2.61.le.5 {
   11633   db eval {
   11634     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11635      WHERE t2.a=45
   11636      ORDER BY x
   11637   }
   11638 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11639 do_test boundary3-2.62.1 {
   11640   db eval {
   11641     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-2147483649 AND t2.a=t1.a
   11642   }
   11643 } {47 ffffffff7fffffff}
   11644 do_test boundary3-2.62.2 {
   11645   db eval {
   11646     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ffffffff7fffffff'
   11647   }
   11648 } {-2147483649 47}
   11649 do_test boundary3-2.62.3 {
   11650   db eval {
   11651     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=47
   11652   }
   11653 } {-2147483649 ffffffff7fffffff}
   11654 do_test boundary3-2.62.gt.1 {
   11655   db eval {
   11656     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11657      WHERE t1.rowid > -2147483649 ORDER BY t2.a
   11658   }
   11659 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 48 49 50 51 52 53 54 56 57 59 60 61 62}
   11660 do_test boundary3-2.62.gt.2 {
   11661   db eval {
   11662     SELECT t2.a FROM t2 NATURAL JOIN t1
   11663      WHERE t1.rowid > -2147483649 ORDER BY t1.a DESC
   11664   }
   11665 } {62 61 60 59 57 56 54 53 52 51 50 49 48 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   11666 do_test boundary3-2.62.gt.3 {
   11667   db eval {
   11668     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11669      WHERE t2.a=47
   11670      ORDER BY t1.rowid
   11671   }
   11672 } {11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11673 do_test boundary3-2.62.gt.4 {
   11674   db eval {
   11675     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11676      WHERE t2.a=47
   11677      ORDER BY t1.rowid DESC
   11678   }
   11679 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11}
   11680 do_test boundary3-2.62.gt.5 {
   11681   db eval {
   11682     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11683      WHERE t2.a=47
   11684      ORDER BY x
   11685   }
   11686 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 11 1 37 29 32 54 53 52 33 38}
   11687 do_test boundary3-2.62.gt.10 {
   11688   db eval {
   11689     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   11690      WHERE t2.a=47
   11691      ORDER BY t1.rowid
   11692   }
   11693 } {11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11694 do_test boundary3-2.62.gt.11 {
   11695   db eval {
   11696     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   11697      WHERE t2.a=47
   11698      ORDER BY t1.rowid DESC
   11699   }
   11700 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11}
   11701 do_test boundary3-2.62.ge.1 {
   11702   db eval {
   11703     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11704      WHERE t1.rowid >= -2147483649 ORDER BY t2.a
   11705   }
   11706 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 56 57 59 60 61 62}
   11707 do_test boundary3-2.62.ge.2 {
   11708   db eval {
   11709     SELECT t2.a FROM t2 NATURAL JOIN t1
   11710      WHERE t1.rowid >= -2147483649 ORDER BY t1.a DESC
   11711   }
   11712 } {62 61 60 59 57 56 54 53 52 51 50 49 48 47 46 45 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   11713 do_test boundary3-2.62.ge.3 {
   11714   db eval {
   11715     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11716      WHERE t2.a=47
   11717      ORDER BY t1.rowid
   11718   }
   11719 } {47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11720 do_test boundary3-2.62.ge.4 {
   11721   db eval {
   11722     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11723      WHERE t2.a=47
   11724      ORDER BY t1.rowid DESC
   11725   }
   11726 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47}
   11727 do_test boundary3-2.62.ge.5 {
   11728   db eval {
   11729     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11730      WHERE t2.a=47
   11731      ORDER BY x
   11732   }
   11733 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 47 11 1 37 29 32 54 53 52 33 38}
   11734 do_test boundary3-2.62.ge.10 {
   11735   db eval {
   11736     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   11737      WHERE t2.a=47
   11738      ORDER BY t1.rowid
   11739   }
   11740 } {47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11741 do_test boundary3-2.62.ge.11 {
   11742   db eval {
   11743     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   11744      WHERE t2.a=47
   11745      ORDER BY t1.rowid DESC
   11746   }
   11747 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47}
   11748 do_test boundary3-2.62.lt.1 {
   11749   db eval {
   11750     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11751      WHERE t1.rowid < -2147483649 ORDER BY t2.a
   11752   }
   11753 } {2 21 44 55 58 63 64}
   11754 do_test boundary3-2.62.lt.2 {
   11755   db eval {
   11756     SELECT t2.a FROM t2 NATURAL JOIN t1
   11757      WHERE t1.rowid < -2147483649 ORDER BY t1.a DESC
   11758   }
   11759 } {64 63 58 55 44 21 2}
   11760 do_test boundary3-2.62.lt.3 {
   11761   db eval {
   11762     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11763      WHERE t2.a=47
   11764      ORDER BY t1.rowid
   11765   }
   11766 } {55 2 64 21 44 58 63}
   11767 do_test boundary3-2.62.lt.4 {
   11768   db eval {
   11769     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11770      WHERE t2.a=47
   11771      ORDER BY t1.rowid DESC
   11772   }
   11773 } {63 58 44 21 64 2 55}
   11774 do_test boundary3-2.62.lt.5 {
   11775   db eval {
   11776     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11777      WHERE t2.a=47
   11778      ORDER BY x
   11779   }
   11780 } {55 2 64 21 44 58 63}
   11781 do_test boundary3-2.62.lt.10 {
   11782   db eval {
   11783     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   11784      WHERE t2.a=47
   11785      ORDER BY t1.rowid
   11786   }
   11787 } {55 2 64 21 44 58 63}
   11788 do_test boundary3-2.62.lt.11 {
   11789   db eval {
   11790     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   11791      WHERE t2.a=47
   11792      ORDER BY t1.rowid DESC
   11793   }
   11794 } {63 58 44 21 64 2 55}
   11795 do_test boundary3-2.62.le.1 {
   11796   db eval {
   11797     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11798      WHERE t1.rowid <= -2147483649 ORDER BY t2.a
   11799   }
   11800 } {2 21 44 47 55 58 63 64}
   11801 do_test boundary3-2.62.le.2 {
   11802   db eval {
   11803     SELECT t2.a FROM t2 NATURAL JOIN t1
   11804      WHERE t1.rowid <= -2147483649 ORDER BY t1.a DESC
   11805   }
   11806 } {64 63 58 55 47 44 21 2}
   11807 do_test boundary3-2.62.le.3 {
   11808   db eval {
   11809     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11810      WHERE t2.a=47
   11811      ORDER BY t1.rowid
   11812   }
   11813 } {55 2 64 21 44 58 63 47}
   11814 do_test boundary3-2.62.le.4 {
   11815   db eval {
   11816     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11817      WHERE t2.a=47
   11818      ORDER BY t1.rowid DESC
   11819   }
   11820 } {47 63 58 44 21 64 2 55}
   11821 do_test boundary3-2.62.le.5 {
   11822   db eval {
   11823     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11824      WHERE t2.a=47
   11825      ORDER BY x
   11826   }
   11827 } {55 2 64 21 44 58 63 47}
   11828 do_test boundary3-2.62.le.10 {
   11829   db eval {
   11830     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   11831      WHERE t2.a=47
   11832      ORDER BY t1.rowid
   11833   }
   11834 } {55 2 64 21 44 58 63 47}
   11835 do_test boundary3-2.62.le.11 {
   11836   db eval {
   11837     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   11838      WHERE t2.a=47
   11839      ORDER BY t1.rowid DESC
   11840   }
   11841 } {47 63 58 44 21 64 2 55}
   11842 do_test boundary3-2.63.1 {
   11843   db eval {
   11844     SELECT t1.* FROM t1, t2 WHERE t1.rowid=-36028797018963969 AND t2.a=t1.a
   11845   }
   11846 } {2 ff7fffffffffffff}
   11847 do_test boundary3-2.63.2 {
   11848   db eval {
   11849     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='ff7fffffffffffff'
   11850   }
   11851 } {-36028797018963969 2}
   11852 do_test boundary3-2.63.3 {
   11853   db eval {
   11854     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=2
   11855   }
   11856 } {-36028797018963969 ff7fffffffffffff}
   11857 do_test boundary3-2.63.gt.1 {
   11858   db eval {
   11859     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11860      WHERE t1.rowid > -36028797018963969 ORDER BY t2.a
   11861   }
   11862 } {1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64}
   11863 do_test boundary3-2.63.gt.2 {
   11864   db eval {
   11865     SELECT t2.a FROM t2 NATURAL JOIN t1
   11866      WHERE t1.rowid > -36028797018963969 ORDER BY t1.a DESC
   11867   }
   11868 } {64 63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1}
   11869 do_test boundary3-2.63.gt.3 {
   11870   db eval {
   11871     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11872      WHERE t2.a=2
   11873      ORDER BY t1.rowid
   11874   }
   11875 } {64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11876 do_test boundary3-2.63.gt.4 {
   11877   db eval {
   11878     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11879      WHERE t2.a=2
   11880      ORDER BY t1.rowid DESC
   11881   }
   11882 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64}
   11883 do_test boundary3-2.63.gt.5 {
   11884   db eval {
   11885     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   11886      WHERE t2.a=2
   11887      ORDER BY x
   11888   }
   11889 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11890 do_test boundary3-2.63.ge.1 {
   11891   db eval {
   11892     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11893      WHERE t1.rowid >= -36028797018963969 ORDER BY t2.a
   11894   }
   11895 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 56 57 58 59 60 61 62 63 64}
   11896 do_test boundary3-2.63.ge.2 {
   11897   db eval {
   11898     SELECT t2.a FROM t2 NATURAL JOIN t1
   11899      WHERE t1.rowid >= -36028797018963969 ORDER BY t1.a DESC
   11900   }
   11901 } {64 63 62 61 60 59 58 57 56 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   11902 do_test boundary3-2.63.ge.3 {
   11903   db eval {
   11904     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11905      WHERE t2.a=2
   11906      ORDER BY t1.rowid
   11907   }
   11908 } {2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   11909 do_test boundary3-2.63.ge.4 {
   11910   db eval {
   11911     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11912      WHERE t2.a=2
   11913      ORDER BY t1.rowid DESC
   11914   }
   11915 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2}
   11916 do_test boundary3-2.63.ge.5 {
   11917   db eval {
   11918     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   11919      WHERE t2.a=2
   11920      ORDER BY x
   11921   }
   11922 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   11923 do_test boundary3-2.63.lt.1 {
   11924   db eval {
   11925     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11926      WHERE t1.rowid < -36028797018963969 ORDER BY t2.a
   11927   }
   11928 } {55}
   11929 do_test boundary3-2.63.lt.2 {
   11930   db eval {
   11931     SELECT t2.a FROM t2 NATURAL JOIN t1
   11932      WHERE t1.rowid < -36028797018963969 ORDER BY t1.a DESC
   11933   }
   11934 } {55}
   11935 do_test boundary3-2.63.lt.3 {
   11936   db eval {
   11937     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11938      WHERE t2.a=2
   11939      ORDER BY t1.rowid
   11940   }
   11941 } {55}
   11942 do_test boundary3-2.63.lt.4 {
   11943   db eval {
   11944     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11945      WHERE t2.a=2
   11946      ORDER BY t1.rowid DESC
   11947   }
   11948 } {55}
   11949 do_test boundary3-2.63.lt.5 {
   11950   db eval {
   11951     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   11952      WHERE t2.a=2
   11953      ORDER BY x
   11954   }
   11955 } {55}
   11956 do_test boundary3-2.63.le.1 {
   11957   db eval {
   11958     SELECT t2.a FROM t1 JOIN t2 USING(a)
   11959      WHERE t1.rowid <= -36028797018963969 ORDER BY t2.a
   11960   }
   11961 } {2 55}
   11962 do_test boundary3-2.63.le.2 {
   11963   db eval {
   11964     SELECT t2.a FROM t2 NATURAL JOIN t1
   11965      WHERE t1.rowid <= -36028797018963969 ORDER BY t1.a DESC
   11966   }
   11967 } {55 2}
   11968 do_test boundary3-2.63.le.3 {
   11969   db eval {
   11970     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11971      WHERE t2.a=2
   11972      ORDER BY t1.rowid
   11973   }
   11974 } {55 2}
   11975 do_test boundary3-2.63.le.4 {
   11976   db eval {
   11977     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11978      WHERE t2.a=2
   11979      ORDER BY t1.rowid DESC
   11980   }
   11981 } {2 55}
   11982 do_test boundary3-2.63.le.5 {
   11983   db eval {
   11984     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   11985      WHERE t2.a=2
   11986      ORDER BY x
   11987   }
   11988 } {55 2}
   11989 do_test boundary3-2.64.1 {
   11990   db eval {
   11991     SELECT t1.* FROM t1, t2 WHERE t1.rowid=3 AND t2.a=t1.a
   11992   }
   11993 } {5 0000000000000003}
   11994 do_test boundary3-2.64.2 {
   11995   db eval {
   11996     SELECT t2.* FROM t1 JOIN t2 USING(a) WHERE x='0000000000000003'
   11997   }
   11998 } {3 5}
   11999 do_test boundary3-2.64.3 {
   12000   db eval {
   12001     SELECT t1.rowid, x FROM t1 JOIN t2 ON t2.r=t1.rowid WHERE t2.a=5
   12002   }
   12003 } {3 0000000000000003}
   12004 do_test boundary3-2.64.gt.1 {
   12005   db eval {
   12006     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12007      WHERE t1.rowid > 3 ORDER BY t2.a
   12008   }
   12009 } {3 4 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   12010 do_test boundary3-2.64.gt.2 {
   12011   db eval {
   12012     SELECT t2.a FROM t2 NATURAL JOIN t1
   12013      WHERE t1.rowid > 3 ORDER BY t1.a DESC
   12014   }
   12015 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 4 3}
   12016 do_test boundary3-2.64.gt.3 {
   12017   db eval {
   12018     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12019      WHERE t2.a=5
   12020      ORDER BY t1.rowid
   12021   }
   12022 } {31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12023 do_test boundary3-2.64.gt.4 {
   12024   db eval {
   12025     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12026      WHERE t2.a=5
   12027      ORDER BY t1.rowid DESC
   12028   }
   12029 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31}
   12030 do_test boundary3-2.64.gt.5 {
   12031   db eval {
   12032     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12033      WHERE t2.a=5
   12034      ORDER BY x
   12035   }
   12036 } {31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12037 do_test boundary3-2.64.gt.10 {
   12038   db eval {
   12039     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   12040      WHERE t2.a=5
   12041      ORDER BY t1.rowid
   12042   }
   12043 } {31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12044 do_test boundary3-2.64.gt.11 {
   12045   db eval {
   12046     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > CAST(t2.r AS real)
   12047      WHERE t2.a=5
   12048      ORDER BY t1.rowid DESC
   12049   }
   12050 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31}
   12051 do_test boundary3-2.64.ge.1 {
   12052   db eval {
   12053     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12054      WHERE t1.rowid >= 3 ORDER BY t2.a
   12055   }
   12056 } {3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 34 35 36 39 40 42 43 45 46 48 49 50 51 56 57 61 62}
   12057 do_test boundary3-2.64.ge.2 {
   12058   db eval {
   12059     SELECT t2.a FROM t2 NATURAL JOIN t1
   12060      WHERE t1.rowid >= 3 ORDER BY t1.a DESC
   12061   }
   12062 } {62 61 57 56 51 50 49 48 46 45 43 42 40 39 36 35 34 31 30 28 27 26 25 24 23 22 20 19 18 17 16 15 14 13 12 10 9 8 7 6 5 4 3}
   12063 do_test boundary3-2.64.ge.3 {
   12064   db eval {
   12065     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12066      WHERE t2.a=5
   12067      ORDER BY t1.rowid
   12068   }
   12069 } {5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12070 do_test boundary3-2.64.ge.4 {
   12071   db eval {
   12072     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12073      WHERE t2.a=5
   12074      ORDER BY t1.rowid DESC
   12075   }
   12076 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5}
   12077 do_test boundary3-2.64.ge.5 {
   12078   db eval {
   12079     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12080      WHERE t2.a=5
   12081      ORDER BY x
   12082   }
   12083 } {5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12084 do_test boundary3-2.64.ge.10 {
   12085   db eval {
   12086     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   12087      WHERE t2.a=5
   12088      ORDER BY t1.rowid
   12089   }
   12090 } {5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12091 do_test boundary3-2.64.ge.11 {
   12092   db eval {
   12093     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= CAST(t2.r AS real)
   12094      WHERE t2.a=5
   12095      ORDER BY t1.rowid DESC
   12096   }
   12097 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5}
   12098 do_test boundary3-2.64.lt.1 {
   12099   db eval {
   12100     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12101      WHERE t1.rowid < 3 ORDER BY t2.a
   12102   }
   12103 } {1 2 11 21 29 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   12104 do_test boundary3-2.64.lt.2 {
   12105   db eval {
   12106     SELECT t2.a FROM t2 NATURAL JOIN t1
   12107      WHERE t1.rowid < 3 ORDER BY t1.a DESC
   12108   }
   12109 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 29 21 11 2 1}
   12110 do_test boundary3-2.64.lt.3 {
   12111   db eval {
   12112     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12113      WHERE t2.a=5
   12114      ORDER BY t1.rowid
   12115   }
   12116 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41}
   12117 do_test boundary3-2.64.lt.4 {
   12118   db eval {
   12119     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12120      WHERE t2.a=5
   12121      ORDER BY t1.rowid DESC
   12122   }
   12123 } {41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12124 do_test boundary3-2.64.lt.5 {
   12125   db eval {
   12126     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12127      WHERE t2.a=5
   12128      ORDER BY x
   12129   }
   12130 } {59 60 41 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   12131 do_test boundary3-2.64.lt.10 {
   12132   db eval {
   12133     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   12134      WHERE t2.a=5
   12135      ORDER BY t1.rowid
   12136   }
   12137 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41}
   12138 do_test boundary3-2.64.lt.11 {
   12139   db eval {
   12140     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < CAST(t2.r AS real)
   12141      WHERE t2.a=5
   12142      ORDER BY t1.rowid DESC
   12143   }
   12144 } {41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12145 do_test boundary3-2.64.le.1 {
   12146   db eval {
   12147     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12148      WHERE t1.rowid <= 3 ORDER BY t2.a
   12149   }
   12150 } {1 2 5 11 21 29 32 33 37 38 41 44 47 52 53 54 55 58 59 60 63 64}
   12151 do_test boundary3-2.64.le.2 {
   12152   db eval {
   12153     SELECT t2.a FROM t2 NATURAL JOIN t1
   12154      WHERE t1.rowid <= 3 ORDER BY t1.a DESC
   12155   }
   12156 } {64 63 60 59 58 55 54 53 52 47 44 41 38 37 33 32 29 21 11 5 2 1}
   12157 do_test boundary3-2.64.le.3 {
   12158   db eval {
   12159     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12160      WHERE t2.a=5
   12161      ORDER BY t1.rowid
   12162   }
   12163 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5}
   12164 do_test boundary3-2.64.le.4 {
   12165   db eval {
   12166     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12167      WHERE t2.a=5
   12168      ORDER BY t1.rowid DESC
   12169   }
   12170 } {5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12171 do_test boundary3-2.64.le.5 {
   12172   db eval {
   12173     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12174      WHERE t2.a=5
   12175      ORDER BY x
   12176   }
   12177 } {59 60 41 5 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   12178 do_test boundary3-2.64.le.10 {
   12179   db eval {
   12180     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   12181      WHERE t2.a=5
   12182      ORDER BY t1.rowid
   12183   }
   12184 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5}
   12185 do_test boundary3-2.64.le.11 {
   12186   db eval {
   12187     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
   12188      WHERE t2.a=5
   12189      ORDER BY t1.rowid DESC
   12190   }
   12191 } {5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12192 do_test boundary3-2.65.gt.1 {
   12193   db eval {
   12194     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12195      WHERE t1.rowid > 9.22337303685477580800e+18 ORDER BY t2.a
   12196   }
   12197 } {}
   12198 do_test boundary3-2.65.gt.2 {
   12199   db eval {
   12200     SELECT t2.a FROM t2 NATURAL JOIN t1
   12201      WHERE t1.rowid > 9.22337303685477580800e+18 ORDER BY t1.a DESC
   12202   }
   12203 } {}
   12204 do_test boundary3-2.65.gt.3 {
   12205   db eval {
   12206     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12207      WHERE t2.a=65
   12208      ORDER BY t1.rowid
   12209   }
   12210 } {}
   12211 do_test boundary3-2.65.gt.4 {
   12212   db eval {
   12213     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12214      WHERE t2.a=65
   12215      ORDER BY t1.rowid DESC
   12216   }
   12217 } {}
   12218 do_test boundary3-2.65.gt.5 {
   12219   db eval {
   12220     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12221      WHERE t2.a=65
   12222      ORDER BY x
   12223   }
   12224 } {}
   12225 do_test boundary3-2.65.ge.1 {
   12226   db eval {
   12227     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12228      WHERE t1.rowid >= 9.22337303685477580800e+18 ORDER BY t2.a
   12229   }
   12230 } {}
   12231 do_test boundary3-2.65.ge.2 {
   12232   db eval {
   12233     SELECT t2.a FROM t2 NATURAL JOIN t1
   12234      WHERE t1.rowid >= 9.22337303685477580800e+18 ORDER BY t1.a DESC
   12235   }
   12236 } {}
   12237 do_test boundary3-2.65.ge.3 {
   12238   db eval {
   12239     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12240      WHERE t2.a=65
   12241      ORDER BY t1.rowid
   12242   }
   12243 } {}
   12244 do_test boundary3-2.65.ge.4 {
   12245   db eval {
   12246     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12247      WHERE t2.a=65
   12248      ORDER BY t1.rowid DESC
   12249   }
   12250 } {}
   12251 do_test boundary3-2.65.ge.5 {
   12252   db eval {
   12253     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12254      WHERE t2.a=65
   12255      ORDER BY x
   12256   }
   12257 } {}
   12258 do_test boundary3-2.65.lt.1 {
   12259   db eval {
   12260     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12261      WHERE t1.rowid < 9.22337303685477580800e+18 ORDER BY t2.a
   12262   }
   12263 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   12264 do_test boundary3-2.65.lt.2 {
   12265   db eval {
   12266     SELECT t2.a FROM t2 NATURAL JOIN t1
   12267      WHERE t1.rowid < 9.22337303685477580800e+18 ORDER BY t1.a DESC
   12268   }
   12269 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   12270 do_test boundary3-2.65.lt.3 {
   12271   db eval {
   12272     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12273      WHERE t2.a=65
   12274      ORDER BY t1.rowid
   12275   }
   12276 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12277 do_test boundary3-2.65.lt.4 {
   12278   db eval {
   12279     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12280      WHERE t2.a=65
   12281      ORDER BY t1.rowid DESC
   12282   }
   12283 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12284 do_test boundary3-2.65.lt.5 {
   12285   db eval {
   12286     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12287      WHERE t2.a=65
   12288      ORDER BY x
   12289   }
   12290 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   12291 do_test boundary3-2.65.le.1 {
   12292   db eval {
   12293     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12294      WHERE t1.rowid <= 9.22337303685477580800e+18 ORDER BY t2.a
   12295   }
   12296 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   12297 do_test boundary3-2.65.le.2 {
   12298   db eval {
   12299     SELECT t2.a FROM t2 NATURAL JOIN t1
   12300      WHERE t1.rowid <= 9.22337303685477580800e+18 ORDER BY t1.a DESC
   12301   }
   12302 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   12303 do_test boundary3-2.65.le.3 {
   12304   db eval {
   12305     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12306      WHERE t2.a=65
   12307      ORDER BY t1.rowid
   12308   }
   12309 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12310 do_test boundary3-2.65.le.4 {
   12311   db eval {
   12312     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12313      WHERE t2.a=65
   12314      ORDER BY t1.rowid DESC
   12315   }
   12316 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12317 do_test boundary3-2.65.le.5 {
   12318   db eval {
   12319     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12320      WHERE t2.a=65
   12321      ORDER BY x
   12322   }
   12323 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   12324 do_test boundary3-2.66.gt.1 {
   12325   db eval {
   12326     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12327      WHERE t1.rowid > -9.22337303685477580800e+18 ORDER BY t2.a
   12328   }
   12329 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   12330 do_test boundary3-2.66.gt.2 {
   12331   db eval {
   12332     SELECT t2.a FROM t2 NATURAL JOIN t1
   12333      WHERE t1.rowid > -9.22337303685477580800e+18 ORDER BY t1.a DESC
   12334   }
   12335 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   12336 do_test boundary3-2.66.gt.3 {
   12337   db eval {
   12338     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12339      WHERE t2.a=66
   12340      ORDER BY t1.rowid
   12341   }
   12342 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12343 do_test boundary3-2.66.gt.4 {
   12344   db eval {
   12345     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12346      WHERE t2.a=66
   12347      ORDER BY t1.rowid DESC
   12348   }
   12349 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12350 do_test boundary3-2.66.gt.5 {
   12351   db eval {
   12352     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid > t2.r
   12353      WHERE t2.a=66
   12354      ORDER BY x
   12355   }
   12356 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   12357 do_test boundary3-2.66.ge.1 {
   12358   db eval {
   12359     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12360      WHERE t1.rowid >= -9.22337303685477580800e+18 ORDER BY t2.a
   12361   }
   12362 } {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64}
   12363 do_test boundary3-2.66.ge.2 {
   12364   db eval {
   12365     SELECT t2.a FROM t2 NATURAL JOIN t1
   12366      WHERE t1.rowid >= -9.22337303685477580800e+18 ORDER BY t1.a DESC
   12367   }
   12368 } {64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1}
   12369 do_test boundary3-2.66.ge.3 {
   12370   db eval {
   12371     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12372      WHERE t2.a=66
   12373      ORDER BY t1.rowid
   12374   }
   12375 } {55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38 59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3}
   12376 do_test boundary3-2.66.ge.4 {
   12377   db eval {
   12378     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12379      WHERE t2.a=66
   12380      ORDER BY t1.rowid DESC
   12381   }
   12382 } {3 28 17 45 27 43 13 26 10 34 25 56 7 19 57 35 46 22 39 36 14 51 20 40 12 6 9 24 18 42 15 62 48 50 23 16 8 61 30 49 4 31 5 41 60 59 38 33 52 53 54 32 29 37 1 11 47 63 58 44 21 64 2 55}
   12383 do_test boundary3-2.66.ge.5 {
   12384   db eval {
   12385     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid >= t2.r
   12386      WHERE t2.a=66
   12387      ORDER BY x
   12388   }
   12389 } {59 60 41 5 31 4 49 30 61 8 16 23 50 48 62 15 42 18 24 9 6 12 40 20 51 14 36 39 22 46 35 57 19 7 56 25 34 10 26 13 43 27 45 17 28 3 55 2 64 21 44 58 63 47 11 1 37 29 32 54 53 52 33 38}
   12390 do_test boundary3-2.66.lt.1 {
   12391   db eval {
   12392     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12393      WHERE t1.rowid < -9.22337303685477580800e+18 ORDER BY t2.a
   12394   }
   12395 } {}
   12396 do_test boundary3-2.66.lt.2 {
   12397   db eval {
   12398     SELECT t2.a FROM t2 NATURAL JOIN t1
   12399      WHERE t1.rowid < -9.22337303685477580800e+18 ORDER BY t1.a DESC
   12400   }
   12401 } {}
   12402 do_test boundary3-2.66.lt.3 {
   12403   db eval {
   12404     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12405      WHERE t2.a=66
   12406      ORDER BY t1.rowid
   12407   }
   12408 } {}
   12409 do_test boundary3-2.66.lt.4 {
   12410   db eval {
   12411     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12412      WHERE t2.a=66
   12413      ORDER BY t1.rowid DESC
   12414   }
   12415 } {}
   12416 do_test boundary3-2.66.lt.5 {
   12417   db eval {
   12418     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid < t2.r
   12419      WHERE t2.a=66
   12420      ORDER BY x
   12421   }
   12422 } {}
   12423 do_test boundary3-2.66.le.1 {
   12424   db eval {
   12425     SELECT t2.a FROM t1 JOIN t2 USING(a)
   12426      WHERE t1.rowid <= -9.22337303685477580800e+18 ORDER BY t2.a
   12427   }
   12428 } {}
   12429 do_test boundary3-2.66.le.2 {
   12430   db eval {
   12431     SELECT t2.a FROM t2 NATURAL JOIN t1
   12432      WHERE t1.rowid <= -9.22337303685477580800e+18 ORDER BY t1.a DESC
   12433   }
   12434 } {}
   12435 do_test boundary3-2.66.le.3 {
   12436   db eval {
   12437     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12438      WHERE t2.a=66
   12439      ORDER BY t1.rowid
   12440   }
   12441 } {}
   12442 do_test boundary3-2.66.le.4 {
   12443   db eval {
   12444     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12445      WHERE t2.a=66
   12446      ORDER BY t1.rowid DESC
   12447   }
   12448 } {}
   12449 do_test boundary3-2.66.le.5 {
   12450   db eval {
   12451     SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= t2.r
   12452      WHERE t2.a=66
   12453      ORDER BY x
   12454   }
   12455 } {}
   12456 finish_test
   12457