summaryrefslogtreecommitdiffstats
path: root/test/unionvtab.test
blob: ac5ecb7abb2a2234bdcca45804ad9615596ae072 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# 2017-07-15
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is percentile.c extension
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix unionvtab

ifcapable !vtab {
  finish_test
  return
}

load_static_extension db unionvtab

#-------------------------------------------------------------------------
# Warm body tests.
#
forcedelete test.db2
do_execsql_test 1.0 {
  ATTACH 'test.db2' AS aux;

  CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
  CREATE TABLE t2(a INTEGER PRIMARY KEY, b TEXT);
  CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b TEXT);


  INSERT INTO t1 VALUES(1, 'one'), (2, 'two'), (3, 'three');
  INSERT INTO t2 VALUES(10, 'ten'), (11, 'eleven'), (12, 'twelve');
  INSERT INTO t3 VALUES(20, 'twenty'), (21, 'twenty-one'), (22, 'twenty-two');
}

do_execsql_test 1.1 {
  CREATE VIRTUAL TABLE temp.uuu USING unionvtab(
    "VALUES(NULL, 't1', 1, 9),  ('main', 't2', 10, 19), ('aux', 't3', 20, 29)"
  );
  SELECT * FROM uuu;
} {
  1 one 2 two 3 three
  10 ten 11 eleven 12 twelve
  20 twenty 21 twenty-one 22 twenty-two
}

do_execsql_test 1.2 {
  PRAGMA table_info(uuu);
} {
  0 a INTEGER 0 {} 0 
  1 b TEXT 0 {} 0
}

do_execsql_test 1.3 {
  SELECT * FROM uuu WHERE rowid = 3;
  SELECT * FROM uuu WHERE rowid = 11;
} {3 three 11 eleven}

do_execsql_test 1.4 {
  SELECT * FROM uuu WHERE rowid IN (12, 10, 2);
} {2 two 10 ten 12 twelve}

do_execsql_test 1.5 {
  SELECT * FROM uuu WHERE rowid BETWEEN 3 AND 11;
} {3 three 10 ten 11 eleven}

do_execsql_test 1.6 {
  SELECT * FROM uuu WHERE rowid BETWEEN 11 AND 15;
} {11 eleven 12 twelve}

do_execsql_test 1.7 {
  SELECT * FROM uuu WHERE rowid BETWEEN -46 AND 1500;
} {
  1 one 2 two 3 three
  10 ten 11 eleven 12 twelve
  20 twenty 21 twenty-one 22 twenty-two
}

do_execsql_test 1.8 {
  CREATE TABLE src(db, tbl, min, max);
  INSERT INTO src VALUES(NULL, 't1', 1, 9);
  INSERT INTO src VALUES('main', 't2', 10, 19);
  INSERT INTO src VALUES('aux', 't3', 20, 29);
  CREATE VIRTUAL TABLE temp.opp USING unionvtab(src);
  SELECT * FROM opp;
} {
  1 one 2 two 3 three
  10 ten 11 eleven 12 twelve
  20 twenty 21 twenty-one 22 twenty-two
}

do_execsql_test 1.9 {
  CREATE VIRTUAL TABLE temp.qll USING unionvtab(
    'SELECT * FROM src WHERE db!=''xyz'''
  );
  SELECT * FROM qll WHERE rowid BETWEEN 10 AND 21;
} {
  10 ten 11 eleven 12 twelve
  20 twenty 21 twenty-one
}

#-------------------------------------------------------------------------
# Error conditions.
#
#   2.1.*: Attempt to create a unionvtab table outside of the TEMP schema.
#   2.2.*: Tables that do not exist.
#   2.3.*: Non rowid tables.
#   2.4.*: Tables with mismatched schemas.
#   2.5.*: A unionvtab table with zero source tables.
#
do_catchsql_test 2.1.1 {
  CREATE VIRTUAL TABLE u1 USING unionvtab("VALUES(NULL, 't1', 1, 100)");
} {1 {unionvtab tables must be created in TEMP schema}}
do_catchsql_test 2.1.2 {
  CREATE VIRTUAL TABLE main.u1 USING unionvtab("VALUES('', 't1', 1, 100)");
} {1 {unionvtab tables must be created in TEMP schema}}
do_catchsql_test 2.1.3 {
  CREATE VIRTUAL TABLE aux.u1 USING unionvtab("VALUES('', 't1', 1, 100)");
} {1 {unionvtab tables must be created in TEMP schema}}

do_catchsql_test 2.2.1 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES(NULL, 't555', 1, 100)");
} {1 {no such rowid table: t555}}
do_catchsql_test 2.2.2 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES('aux', 't555', 1, 100)");
} {1 {no such rowid table: aux.t555}}
do_catchsql_test 2.2.3 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES('xua', 't555', 1, 100)");
} {1 {no such rowid table: xua.t555}}

do_execsql_test 2.3.0 {
  CREATE TABLE wr1(a, b, c PRIMARY KEY) WITHOUT ROWID;
  CREATE VIEW v1 AS SELECT * FROM t1;
  CREATE VIEW v2 AS SELECT _rowid_, * FROM t1;

  CREATE TABLE wr2(a, _rowid_ INTEGER, c PRIMARY KEY) WITHOUT ROWID;
  CREATE TABLE wr3(a, b, _rowid_ PRIMARY KEY) WITHOUT ROWID;
}
do_catchsql_test 2.3.1 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES('main', 'wr1', 1, 2)");
} {1 {no such rowid table: main.wr1}}
do_catchsql_test 2.3.2 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES(NULL, 'v1', 1, 2)");
} {1 {no such rowid table: v1}}
do_catchsql_test 2.3.3 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES(NULL, 'v2', 1, 2)");
} {1 {no such rowid table: v2}}
do_catchsql_test 2.3.4 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES(NULL, 'wr2', 1, 2)");
} {1 {no such rowid table: wr2}}
do_catchsql_test 2.3.5 {
  CREATE VIRTUAL TABLE temp.u1 USING unionvtab("VALUES(NULL, 'wr3', 1, 2)");
} {1 {no such rowid table: wr3}}

do_execsql_test 2.4.0 {
  CREATE TABLE x1(a BLOB, b);
  CREATE TABLE x2(a BLOB, b);
  CREATE TEMP TABLE x3(a BLOB, b);

  CREATE TABLE aux.y1(one, two, three INTEGER PRIMARY KEY);
  CREATE TEMP TABLE y2(one, two, three INTEGER PRIMARY KEY);
  CREATE TABLE y3(one, two, three INTEGER PRIMARY KEY);
}

foreach {tn dbs res} {
  1 {x1 x2 x3} {0 {}}
  2 {y1 y2 y3} {0 {}}
  3 {x1 y2 y3} {1 {source table schema mismatch}}
  4 {x1 y2 x3} {1 {source table schema mismatch}}
  5 {x1 x2 y3} {1 {source table schema mismatch}}
} {
  set L [list]
  set iMin 0
  foreach e $dbs {
    set E [split $e .]
    if {[llength $E]>1} {
      lappend L "('[lindex $E 0]', '[lindex $E 1]', $iMin, $iMin)"
    } else {
      lappend L "(NULL, '$e', $iMin, $iMin)"
    }
    incr iMin
  }

  set sql "CREATE VIRTUAL TABLE temp.a1 USING unionvtab(\"VALUES [join $L ,]\")"
  do_catchsql_test 2.4.$tn "
    DROP TABLE IF EXISTS temp.a1;
    CREATE VIRTUAL TABLE temp.a1 USING unionvtab(\"VALUES [join $L ,]\");
  " $res
}

do_catchsql_test 2.5 {
  CREATE VIRTUAL TABLE temp.b1 USING unionvtab(
    [SELECT 'main', 'b1', 0, 100 WHERE 0]
  )
} {1 {no source tables configured}}

foreach {tn sql} {
  1 { VALUES('main', 't1', 10, 20), ('main', 't2', 30, 29) }
  2 { VALUES('main', 't1', 10, 20), ('main', 't2', 15, 30) }
} {
  do_catchsql_test 2.6.$tn "
    CREATE VIRTUAL TABLE temp.a1 USING unionvtab(`$sql`)
  " {1 {rowid range mismatch error}}
}

do_catchsql_test 2.7.1 {
  CREATE VIRTUAL TABLE temp.b1 USING unionvtab(1, 2, 3, 4)
} {1 {wrong number of arguments for unionvtab}}

#-------------------------------------------------------------------------
#
reset_db
load_static_extension db unionvtab
do_execsql_test 3.0 {
  CREATE TABLE tbl1(a INTEGER PRIMARY KEY, b);
  CREATE TABLE tbl2(a INTEGER PRIMARY KEY, b);
  CREATE TABLE tbl3(a INTEGER PRIMARY KEY, b);

  WITH ss(ii) AS ( SELECT 1 UNION ALL SELECT ii+1 FROM ss WHERE ii<100 )
  INSERT INTO tbl1 SELECT ii, '1.' || ii FROM ss;

  WITH ss(ii) AS ( SELECT 1 UNION ALL SELECT ii+1 FROM ss WHERE ii<100 )
  INSERT INTO tbl2 SELECT ii, '2.' || ii FROM ss;

  WITH ss(ii) AS ( SELECT 1 UNION ALL SELECT ii+1 FROM ss WHERE ii<100 )
  INSERT INTO tbl3 SELECT ii, '3.' || ii FROM ss;

  CREATE VIRTUAL TABLE temp.uu USING unionvtab(
    "VALUES(NULL,'tbl2', 26, 74), (NULL,'tbl3', 75, 100), (NULL,'tbl1', 1, 25)"
  );
}

do_execsql_test 3.1 {
  SELECT * FROM uu WHERE rowid = 10;
} {10 {1.10}}
do_execsql_test 3.2 {
  SELECT * FROM uu WHERE rowid = 25;
} {25 {1.25}}

do_execsql_test 3.3 { SELECT count(*) FROM uu WHERE rowid <= 24 } {24}

# The following queries get the "wrong" answers. This is because the
# module assumes that each source table contains rowids from only within
# the range specified. For example, (rowid <= 25) matches 100 rows. This
# is because the module implements (rowid <= 25) as a full table scan
# of tbl1 only.
do_execsql_test 3.4.1 { SELECT count(*) FROM uu WHERE rowid <= 25 } {100}
do_execsql_test 3.4.2 { SELECT count(*) FROM uu WHERE rowid <= 26 } {126}
do_execsql_test 3.4.3 { SELECT count(*) FROM uu WHERE rowid <= 73 } {173}
do_execsql_test 3.4.4 { SELECT count(*) FROM uu WHERE rowid <= 74 } {200}
do_execsql_test 3.4.5 { SELECT count(*) FROM uu WHERE rowid <= 75 } {275}
do_execsql_test 3.4.6 { SELECT count(*) FROM uu WHERE rowid <= 99 } {299}
do_execsql_test 3.4.7 { SELECT count(*) FROM uu WHERE rowid <= 100 } {300}
do_execsql_test 3.4.8 { SELECT count(*) FROM uu WHERE rowid <= 101 } {300}

do_execsql_test 3.5.1 { SELECT count(*) FROM uu WHERE rowid < 25 } {24}
do_execsql_test 3.5.2 { SELECT count(*) FROM uu WHERE rowid < 26 } {100}
do_execsql_test 3.5.3 { SELECT count(*) FROM uu WHERE rowid < 27 } {126}
do_execsql_test 3.5.4 { SELECT count(*) FROM uu WHERE rowid < 73 } {172}
do_execsql_test 3.5.5 { SELECT count(*) FROM uu WHERE rowid < 74 } {173}
do_execsql_test 3.5.6 { SELECT count(*) FROM uu WHERE rowid < 75 } {200}
do_execsql_test 3.5.7 { SELECT count(*) FROM uu WHERE rowid < 76 } {275}
do_execsql_test 3.5.8 { SELECT count(*) FROM uu WHERE rowid < 99 } {298}
do_execsql_test 3.5.9 { SELECT count(*) FROM uu WHERE rowid < 100 } {299}
do_execsql_test 3.5.10 { SELECT count(*) FROM uu WHERE rowid < 101 } {300}

do_execsql_test 3.6.1 { SELECT count(*) FROM uu WHERE rowid > 24 } {276}
do_execsql_test 3.6.1 { SELECT count(*) FROM uu WHERE rowid > 25 } {200}
do_execsql_test 3.6.2 { SELECT count(*) FROM uu WHERE rowid > 26 } {174}
do_execsql_test 3.6.3 { SELECT count(*) FROM uu WHERE rowid > 27 } {173}
do_execsql_test 3.6.4 { SELECT count(*) FROM uu WHERE rowid > 73 } {127}
do_execsql_test 3.6.5 { SELECT count(*) FROM uu WHERE rowid > 74 } {100}
do_execsql_test 3.6.6 { SELECT count(*) FROM uu WHERE rowid > 75 } {25}
do_execsql_test 3.6.7 { SELECT count(*) FROM uu WHERE rowid > 76 } {24}
do_execsql_test 3.6.8 { SELECT count(*) FROM uu WHERE rowid > 99 } {1}
do_execsql_test 3.6.9 { SELECT count(*) FROM uu WHERE rowid > 100 } {0}
do_execsql_test 3.6.10 { SELECT count(*) FROM uu WHERE rowid > 101 } {0}

do_execsql_test 3.7.1 { SELECT count(*) FROM uu WHERE rowid >= 24 } {277}
do_execsql_test 3.7.1 { SELECT count(*) FROM uu WHERE rowid >= 25 } {276}
do_execsql_test 3.7.2 { SELECT count(*) FROM uu WHERE rowid >= 26 } {200}
do_execsql_test 3.7.3 { SELECT count(*) FROM uu WHERE rowid >= 27 } {174}
do_execsql_test 3.7.4 { SELECT count(*) FROM uu WHERE rowid >= 73 } {128}
do_execsql_test 3.7.5 { SELECT count(*) FROM uu WHERE rowid >= 74 } {127}
do_execsql_test 3.7.6 { SELECT count(*) FROM uu WHERE rowid >= 75 } {100}
do_execsql_test 3.7.7 { SELECT count(*) FROM uu WHERE rowid >= 76 } {25}
do_execsql_test 3.7.8 { SELECT count(*) FROM uu WHERE rowid >= 99 } {2}
do_execsql_test 3.7.9 { SELECT count(*) FROM uu WHERE rowid >= 100 } {1}
do_execsql_test 3.7.10 { SELECT count(*) FROM uu WHERE rowid >= 101 } {0}

set L [expr  9223372036854775807]
set S [expr -9223372036854775808]

do_execsql_test 3.8.1 { SELECT count(*) FROM uu WHERE rowid >= $S } {300}
do_execsql_test 3.8.2 { SELECT count(*) FROM uu WHERE rowid >  $S } {300}
do_execsql_test 3.8.3 { SELECT count(*) FROM uu WHERE rowid <= $S } {0}
do_execsql_test 3.8.4 { SELECT count(*) FROM uu WHERE rowid <  $S } {0}

do_execsql_test 3.9.1 { SELECT count(*) FROM uu WHERE rowid >= $L } {0}
do_execsql_test 3.9.2 { SELECT count(*) FROM uu WHERE rowid >  $L } {0}
do_execsql_test 3.9.3 { SELECT count(*) FROM uu WHERE rowid <= $L } {300}
do_execsql_test 3.9.4 { SELECT count(*) FROM uu WHERE rowid <  $L } {300}

do_execsql_test 3.10.1 { SELECT count(*) FROM uu WHERE a < 25 } {24}
do_execsql_test 3.10.2 { SELECT count(*) FROM uu WHERE a < 26 } {100}
do_execsql_test 3.10.3 { SELECT count(*) FROM uu WHERE a < 27 } {126}
do_execsql_test 3.10.4 { SELECT count(*) FROM uu WHERE a < 73 } {172}
do_execsql_test 3.10.5 { SELECT count(*) FROM uu WHERE a < 74 } {173}
do_execsql_test 3.10.6 { SELECT count(*) FROM uu WHERE a < 75 } {200}
do_execsql_test 3.10.7 { SELECT count(*) FROM uu WHERE a < 76 } {275}
do_execsql_test 3.10.8 { SELECT count(*) FROM uu WHERE a < 99 } {298}
do_execsql_test 3.10.9 { SELECT count(*) FROM uu WHERE a < 100 } {299}
do_execsql_test 3.10.10 { SELECT count(*) FROM uu WHERE a < 101 } {300}


#-------------------------------------------------------------------------
#
do_execsql_test 4.0 {
  CREATE TABLE s1(k INTEGER PRIMARY KEY, v);
  INSERT INTO s1 VALUES($S, 'one');
  INSERT INTO s1 VALUES($S+1, 'two');
  INSERT INTO s1 VALUES($S+2, 'three');

  CREATE TABLE l1(k INTEGER PRIMARY KEY, v);
  INSERT INTO l1 VALUES($L, 'six');
  INSERT INTO l1 VALUES($L-1, 'five');
  INSERT INTO l1 VALUES($L-2, 'four');

  CREATE VIRTUAL TABLE temp.sl USING unionvtab(
    "SELECT NULL, 'l1', 0, 9223372036854775807
     UNION ALL
     SELECT NULL, 's1', -9223372036854775808, -1"
  );
}

do_execsql_test 4.1 {
  SELECT * FROM sl;
} {
  -9223372036854775808 one -9223372036854775807 two -9223372036854775806 three
   9223372036854775805 four 9223372036854775806 five 9223372036854775807 six
}

foreach {k v} {
  -9223372036854775808 one -9223372036854775807 two -9223372036854775806 three
   9223372036854775805 four 9223372036854775806 five 9223372036854775807 six
} {
  do_execsql_test 4.2.$v { SELECT * FROM sl WHERE rowid=$k } [list $k $v]
}

do_execsql_test 4.3.1 {
  SELECT * FROM sl WHERE rowid>-9223372036854775808
} {
  -9223372036854775807 two -9223372036854775806 three
   9223372036854775805 four 9223372036854775806 five 9223372036854775807 six
}
do_execsql_test 4.3.2 {
  SELECT * FROM sl WHERE rowid>=-9223372036854775808
} {
  -9223372036854775808 one -9223372036854775807 two -9223372036854775806 three
   9223372036854775805 four 9223372036854775806 five 9223372036854775807 six
}
do_execsql_test 4.3.3 {
  SELECT * FROM sl WHERE rowid<=-9223372036854775808
} {
  -9223372036854775808 one
}
do_execsql_test 4.3.4 {
  SELECT * FROM sl WHERE rowid<-9223372036854775808
} {}

do_execsql_test 4.4.1 {
  SELECT * FROM sl WHERE rowid<9223372036854775807
} {
  -9223372036854775808 one -9223372036854775807 two -9223372036854775806 three
   9223372036854775805 four 9223372036854775806 five
}
do_execsql_test 4.4.2 {
  SELECT * FROM sl WHERE rowid<=9223372036854775807
} {
  -9223372036854775808 one -9223372036854775807 two -9223372036854775806 three
   9223372036854775805 four 9223372036854775806 five 9223372036854775807 six
}
do_execsql_test 4.4.3 {
  SELECT * FROM sl WHERE rowid>=9223372036854775807
} {
  9223372036854775807 six
}
do_execsql_test 4.4.4 {
  SELECT * FROM sl WHERE rowid>9223372036854775807
} {}

#-------------------------------------------------------------------------
# More than 8 source tables.
#
do_execsql_test 5.0 {
  CREATE TABLE c0(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c1(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c2(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c3(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c4(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c5(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c6(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c7(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c8(one, two INTEGER PRIMARY KEY);
  CREATE TABLE c9(one, two INTEGER PRIMARY KEY);

  INSERT INTO c0 VALUES('zero', 0);
  INSERT INTO c1 VALUES('one', 1);
  INSERT INTO c2 VALUES('two', 2);
  INSERT INTO c3 VALUES('three', 3);
  INSERT INTO c4 VALUES('four', 4);
  INSERT INTO c5 VALUES('five', 5);
  INSERT INTO c6 VALUES('six', 6);
  INSERT INTO c7 VALUES('seven', 7);
  INSERT INTO c8 VALUES('eight', 8);
  INSERT INTO c9 VALUES('nine', 9);

  CREATE VIRTUAL TABLE temp.cc USING unionvtab([
    SELECT 'main', 'c9', 9, 9 UNION ALL
    SELECT 'main', 'c8', 8, 8 UNION ALL
    SELECT 'main', 'c7', 7, 7 UNION ALL
    SELECT 'main', 'c6', 6, 6 UNION ALL
    SELECT 'main', 'c5', 5, 5 UNION ALL
    SELECT 'main', 'c4', 4, 4 UNION ALL
    SELECT 'main', 'c3', 3, 3 UNION ALL
    SELECT 'main', 'c2', 2, 2 UNION ALL
    SELECT 'main', 'c1', 1, 1 UNION ALL
    SELECT 'main', 'c0', 0, 0
  ]);

  SELECT sum(two) FROM cc;
} {45}

do_execsql_test 5.1 {
  SELECT one FROM cc WHERE one>='seven'
} {zero two three six seven}

do_execsql_test 5.2 {
  SELECT y.one FROM cc AS x, cc AS y WHERE x.one=y.one AND x.rowid>5
} {six seven eight nine}

do_execsql_test 5.3 {
  SELECT cc.one FROM c4, cc WHERE cc.rowid>c4.rowid
} {five six seven eight nine}

do_execsql_test 5.4 {
  SELECT * FROM cc WHERE two LIKE '6'
} {six 6}

finish_test