expert1.test 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. # 2009 Nov 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. # TESTRUNNER: shell
  12. #
  13. # The focus of this file is testing the CLI shell tool. Specifically,
  14. # the ".recommend" command.
  15. #
  16. #
  17. # Test plan:
  18. #
  19. #
  20. if {![info exists testdir]} {
  21. set testdir [file join [file dirname [info script]] .. .. test]
  22. }
  23. source $testdir/tester.tcl
  24. set testprefix expert1
  25. if {[info commands sqlite3_expert_new]==""} {
  26. finish_test
  27. return
  28. }
  29. set CLI [test_binary_name sqlite3]
  30. set CMD [test_binary_name sqlite3_expert]
  31. proc squish {txt} {
  32. regsub -all {[[:space:]]+} $txt { }
  33. }
  34. proc do_setup_rec_test {tn setup sql res} {
  35. reset_db
  36. if {[info exists ::set_main_db_name]} {
  37. dbconfig_maindbname_icecube db
  38. }
  39. db eval $setup
  40. uplevel [list do_rec_test $tn $sql $res]
  41. }
  42. foreach {tn setup} {
  43. 1 {
  44. if {![file executable $CMD]} { continue }
  45. proc do_rec_test {tn sql res} {
  46. set res [squish [string trim $res]]
  47. set tst [subst -nocommands {
  48. squish [string trim [exec $::CMD -verbose 0 -sql {$sql;} test.db]]
  49. }]
  50. uplevel [list do_test $tn $tst $res]
  51. }
  52. }
  53. 2 {
  54. if {[info commands sqlite3_expert_new]==""} { continue }
  55. proc do_rec_test {tn sql res} {
  56. set expert [sqlite3_expert_new db]
  57. $expert sql $sql
  58. $expert analyze
  59. set result [list]
  60. for {set i 0} {$i < [$expert count]} {incr i} {
  61. set idx [string trim [$expert report $i indexes]]
  62. if {$idx==""} {set idx "(no new indexes)"}
  63. lappend result $idx
  64. lappend result [string trim [$expert report $i plan]]
  65. }
  66. $expert destroy
  67. set tst [subst -nocommands {set {} [squish [join {$result}]]}]
  68. uplevel [list do_test $tn $tst [string trim [squish $res]]]
  69. }
  70. }
  71. 3 {
  72. if {[info commands sqlite3_expert_new]==""} { continue }
  73. set ::set_main_db_name 1
  74. }
  75. 4 {
  76. if {![file executable $CLI]} { continue }
  77. proc do_rec_test {tn sql res} {
  78. set res [squish [string trim $res]]
  79. set tst [subst -nocommands {
  80. squish [string trim [exec $::CLI test.db ".expert" {$sql;}]]
  81. }]
  82. uplevel [list do_test $tn $tst $res]
  83. }
  84. }
  85. } {
  86. eval $setup
  87. do_setup_rec_test $tn.1 { CREATE TABLE t1(a, b, c) } {
  88. SELECT * FROM t1
  89. } {
  90. (no new indexes)
  91. SCAN t1
  92. }
  93. do_setup_rec_test $tn.2 {
  94. CREATE TABLE t1(a, b, c);
  95. } {
  96. SELECT * FROM t1 WHERE b>?;
  97. } {
  98. CREATE INDEX t1_idx_00000062 ON t1(b);
  99. SEARCH t1 USING INDEX t1_idx_00000062 (b>?)
  100. }
  101. do_setup_rec_test $tn.3 {
  102. CREATE TABLE t1(a, b, c);
  103. } {
  104. SELECT * FROM t1 WHERE b COLLATE nocase BETWEEN ? AND ?
  105. } {
  106. CREATE INDEX t1_idx_3e094c27 ON t1(b COLLATE NOCASE);
  107. SEARCH t1 USING INDEX t1_idx_3e094c27 (b>? AND b<?)
  108. }
  109. do_setup_rec_test $tn.4 {
  110. CREATE TABLE t1(a, b, c);
  111. } {
  112. SELECT a FROM t1 ORDER BY b;
  113. } {
  114. CREATE INDEX t1_idx_00000062 ON t1(b);
  115. SCAN t1 USING INDEX t1_idx_00000062
  116. }
  117. do_setup_rec_test $tn.5 {
  118. CREATE TABLE t1(a, b, c);
  119. } {
  120. SELECT a FROM t1 WHERE a=? ORDER BY b;
  121. } {
  122. CREATE INDEX t1_idx_000123a7 ON t1(a, b);
  123. SEARCH t1 USING COVERING INDEX t1_idx_000123a7 (a=?)
  124. }
  125. if 0 {
  126. do_setup_rec_test $tn.6 {
  127. CREATE TABLE t1(a, b, c);
  128. } {
  129. SELECT min(a) FROM t1
  130. } {
  131. CREATE INDEX t1_idx_00000061 ON t1(a);
  132. SEARCH t1 USING COVERING INDEX t1_idx_00000061
  133. }
  134. }
  135. do_setup_rec_test $tn.7 {
  136. CREATE TABLE t1(a, b, c);
  137. } {
  138. SELECT * FROM t1 ORDER BY a, b, c;
  139. } {
  140. CREATE INDEX t1_idx_033e95fe ON t1(a, b, c);
  141. SCAN t1 USING COVERING INDEX t1_idx_033e95fe
  142. }
  143. #do_setup_rec_test $tn.1.8 {
  144. # CREATE TABLE t1(a, b, c);
  145. #} {
  146. # SELECT * FROM t1 ORDER BY a ASC, b COLLATE nocase DESC, c ASC;
  147. #} {
  148. # CREATE INDEX t1_idx_5be6e222 ON t1(a, b COLLATE NOCASE DESC, c);
  149. # 0|0|0|SCAN t1 USING COVERING INDEX t1_idx_5be6e222
  150. #}
  151. do_setup_rec_test $tn.8.1 {
  152. CREATE TABLE t1(a COLLATE NOCase, b, c);
  153. } {
  154. SELECT * FROM t1 WHERE a=?
  155. } {
  156. CREATE INDEX t1_idx_00000061 ON t1(a);
  157. SEARCH t1 USING INDEX t1_idx_00000061 (a=?)
  158. }
  159. do_setup_rec_test $tn.8.2 {
  160. CREATE TABLE t1(a, b COLLATE nocase, c);
  161. } {
  162. SELECT * FROM t1 ORDER BY a ASC, b DESC, c ASC;
  163. } {
  164. CREATE INDEX t1_idx_5cb97285 ON t1(a, b DESC, c);
  165. SCAN t1 USING COVERING INDEX t1_idx_5cb97285
  166. }
  167. # Tables with names that require quotes.
  168. #
  169. do_setup_rec_test $tn.9.1 {
  170. CREATE TABLE "t t"(a, b, c);
  171. } {
  172. SELECT * FROM "t t" WHERE a=?
  173. } {
  174. CREATE INDEX "t t_idx_00000061" ON "t t"(a);
  175. SEARCH t t USING INDEX t t_idx_00000061 (a=?)
  176. }
  177. do_setup_rec_test $tn.9.2 {
  178. CREATE TABLE "t t"(a, b, c);
  179. } {
  180. SELECT * FROM "t t" WHERE b BETWEEN ? AND ?
  181. } {
  182. CREATE INDEX "t t_idx_00000062" ON "t t"(b);
  183. SEARCH t t USING INDEX t t_idx_00000062 (b>? AND b<?)
  184. }
  185. # Columns with names that require quotes.
  186. #
  187. do_setup_rec_test $tn.10.1 {
  188. CREATE TABLE t3(a, "b b", c);
  189. } {
  190. SELECT * FROM t3 WHERE "b b" = ?
  191. } {
  192. CREATE INDEX t3_idx_00050c52 ON t3('b b');
  193. SEARCH t3 USING INDEX t3_idx_00050c52 (b b=?)
  194. }
  195. do_setup_rec_test $tn.10.2 {
  196. CREATE TABLE t3(a, "b b", c);
  197. } {
  198. SELECT * FROM t3 ORDER BY "b b"
  199. } {
  200. CREATE INDEX t3_idx_00050c52 ON t3('b b');
  201. SCAN t3 USING INDEX t3_idx_00050c52
  202. }
  203. # Transitive constraints
  204. #
  205. do_setup_rec_test $tn.11.1 {
  206. CREATE TABLE t5(a, b);
  207. CREATE TABLE t6(c, d);
  208. } {
  209. SELECT * FROM t5, t6 WHERE a=? AND b=c AND c=?
  210. } {
  211. CREATE INDEX t5_idx_000123a7 ON t5(a, b);
  212. CREATE INDEX t6_idx_00000063 ON t6(c);
  213. SEARCH t6 USING INDEX t6_idx_00000063 (c=?)
  214. SEARCH t5 USING COVERING INDEX t5_idx_000123a7 (a=? AND b=?)
  215. }
  216. # OR terms.
  217. #
  218. do_setup_rec_test $tn.12.1 {
  219. CREATE TABLE t7(a, b);
  220. } {
  221. SELECT * FROM t7 WHERE a=? OR b=?
  222. } {
  223. CREATE INDEX t7_idx_00000062 ON t7(b);
  224. CREATE INDEX t7_idx_00000061 ON t7(a);
  225. MULTI-INDEX OR
  226. INDEX 1
  227. SEARCH t7 USING INDEX t7_idx_00000061 (a=?)
  228. INDEX 2
  229. SEARCH t7 USING INDEX t7_idx_00000062 (b=?)
  230. }
  231. # rowid terms.
  232. #
  233. do_setup_rec_test $tn.13.1 {
  234. CREATE TABLE t8(a, b);
  235. } {
  236. SELECT * FROM t8 WHERE rowid=?
  237. } {
  238. (no new indexes)
  239. SEARCH t8 USING INTEGER PRIMARY KEY (rowid=?)
  240. }
  241. do_setup_rec_test $tn.13.2 {
  242. CREATE TABLE t8(a, b);
  243. } {
  244. SELECT * FROM t8 ORDER BY rowid
  245. } {
  246. (no new indexes)
  247. SCAN t8
  248. }
  249. do_setup_rec_test $tn.13.3 {
  250. CREATE TABLE t8(a, b);
  251. } {
  252. SELECT * FROM t8 WHERE a=? ORDER BY rowid
  253. } {
  254. CREATE INDEX t8_idx_00000061 ON t8(a);
  255. SEARCH t8 USING INDEX t8_idx_00000061 (a=?)
  256. }
  257. # Triggers
  258. #
  259. do_setup_rec_test $tn.14 {
  260. CREATE TABLE t9(a, b, c);
  261. CREATE TABLE t10(a, b, c);
  262. CREATE TRIGGER t9t AFTER INSERT ON t9 BEGIN
  263. UPDATE t10 SET a=new.a WHERE b = new.b;
  264. END;
  265. } {
  266. INSERT INTO t9 VALUES(?, ?, ?);
  267. } {
  268. CREATE INDEX t10_idx_00000062 ON t10(b);
  269. SEARCH t10 USING INDEX t10_idx_00000062 (b=?)
  270. }
  271. do_setup_rec_test $tn.15 {
  272. CREATE TABLE t1(a, b);
  273. CREATE TABLE t2(c, d);
  274. WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100)
  275. INSERT INTO t1 SELECT (i-1)/50, (i-1)/20 FROM s;
  276. WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100)
  277. INSERT INTO t2 SELECT (i-1)/20, (i-1)/5 FROM s;
  278. } {
  279. SELECT * FROM t2, t1 WHERE b=? AND d=? AND t2.rowid=t1.rowid
  280. } {
  281. CREATE INDEX t2_idx_00000064 ON t2(d);
  282. SEARCH t2 USING INDEX t2_idx_00000064 (d=?)
  283. SEARCH t1 USING INTEGER PRIMARY KEY (rowid=?)
  284. }
  285. do_setup_rec_test $tn.16 {
  286. CREATE TABLE t1(a, b);
  287. } {
  288. SELECT * FROM t1 WHERE b IS NOT NULL;
  289. } {
  290. (no new indexes)
  291. SCAN t1
  292. }
  293. do_setup_rec_test $tn.17.1 {
  294. CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
  295. } {
  296. SELECT * FROM example WHERE a=?
  297. } {
  298. (no new indexes)
  299. SEARCH example USING INDEX sqlite_autoindex_example_1 (A=?)
  300. }
  301. do_setup_rec_test $tn.17.2 {
  302. CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
  303. } {
  304. SELECT * FROM example WHERE b=?
  305. } {
  306. CREATE INDEX example_idx_00000042 ON example(B);
  307. SEARCH example USING INDEX example_idx_00000042 (B=?)
  308. }
  309. do_setup_rec_test $tn.17.3 {
  310. CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
  311. } {
  312. SELECT * FROM example WHERE a=? AND b=?
  313. } {
  314. (no new indexes)
  315. SEARCH example USING INDEX sqlite_autoindex_example_1 (A=? AND B=?)
  316. }
  317. do_setup_rec_test $tn.17.4 {
  318. CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
  319. } {
  320. SELECT * FROM example WHERE a=? AND b>?
  321. } {
  322. (no new indexes)
  323. SEARCH example USING INDEX sqlite_autoindex_example_1 (A=? AND B>?)
  324. }
  325. do_setup_rec_test $tn.17.5 {
  326. CREATE TABLE example (A INTEGER, B INTEGER, C INTEGER, PRIMARY KEY (A,B));
  327. } {
  328. SELECT * FROM example WHERE a>? AND b=?
  329. } {
  330. CREATE INDEX example_idx_0000cb3f ON example(B, A);
  331. SEARCH example USING INDEX example_idx_0000cb3f (B=? AND A>?)
  332. }
  333. do_setup_rec_test $tn.18.0 {
  334. CREATE TABLE SomeObject (
  335. a INTEGER PRIMARY KEY,
  336. x TEXT GENERATED ALWAYS AS(HEX(a)) VIRTUAL
  337. );
  338. } {
  339. SELECT x FROM SomeObject;
  340. } {
  341. (no new indexes)
  342. SCAN SomeObject
  343. }
  344. do_setup_rec_test $tn.18.1 {
  345. CREATE TABLE SomeObject (
  346. a INTEGER PRIMARY KEY,
  347. x TEXT GENERATED ALWAYS AS(HEX(a)) VIRTUAL
  348. );
  349. } {
  350. SELECT * FROM SomeObject WHERE x=?;
  351. } {
  352. CREATE INDEX SomeObject_idx_00000078 ON SomeObject(x);
  353. SEARCH SomeObject USING COVERING INDEX SomeObject_idx_00000078 (x=?)
  354. }
  355. do_setup_rec_test $tn.19.0 {
  356. CREATE TABLE t1("index");
  357. } {
  358. SELECT * FROM t1 ORDER BY "index";
  359. } {
  360. CREATE INDEX t1_idx_01a7214e ON t1('index');
  361. SCAN t1 USING COVERING INDEX t1_idx_01a7214e
  362. }
  363. ifcapable fts5 {
  364. do_setup_rec_test $tn.20.0 {
  365. CREATE VIRTUAL TABLE ft USING fts5(a);
  366. CREATE TABLE t1(x, y);
  367. } {
  368. SELECT * FROM ft, t1 WHERE a=x
  369. } {
  370. CREATE INDEX t1_idx_00000078 ON t1(x);
  371. SCAN ft VIRTUAL TABLE INDEX 0:
  372. SEARCH t1 USING INDEX t1_idx_00000078 (x=?)
  373. }
  374. }
  375. }
  376. proc do_candidates_test {tn sql res} {
  377. set res [squish [string trim $res]]
  378. set expert [sqlite3_expert_new db]
  379. $expert sql $sql
  380. $expert analyze
  381. set candidates [squish [string trim [$expert report 0 candidates]]]
  382. $expert destroy
  383. uplevel [list do_test $tn [list set {} $candidates] $res]
  384. }
  385. reset_db
  386. do_execsql_test 5.0 {
  387. CREATE TABLE t1(a, b);
  388. CREATE TABLE t2(c, d);
  389. WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100)
  390. INSERT INTO t1 SELECT (i-1)/50, (i-1)/20 FROM s;
  391. WITH s(i) AS ( VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<100)
  392. INSERT INTO t2 SELECT (i-1)/20, (i-1)/5 FROM s;
  393. CREATE INDEX i1 ON t1( lower(a) );
  394. }
  395. do_candidates_test 5.1 {
  396. SELECT * FROM t1,t2 WHERE (b=? OR a=?) AND (c=? OR d=?)
  397. } {
  398. CREATE INDEX t1_idx_00000062 ON t1(b); -- stat1: 100 20
  399. CREATE INDEX t1_idx_00000061 ON t1(a); -- stat1: 100 50
  400. CREATE INDEX t2_idx_00000063 ON t2(c); -- stat1: 100 20
  401. CREATE INDEX t2_idx_00000064 ON t2(d); -- stat1: 100 5
  402. }
  403. do_candidates_test 5.2 {
  404. SELECT * FROM t1,t2 WHERE a=? AND b=? AND c=? AND d=?
  405. } {
  406. CREATE INDEX t1_idx_000123a7 ON t1(a, b); -- stat1: 100 50 17
  407. CREATE INDEX t2_idx_0001295b ON t2(c, d); -- stat1: 100 20 5
  408. }
  409. do_execsql_test 5.3 {
  410. CREATE INDEX t1_idx_00000061 ON t1(a); -- stat1: 100 50
  411. CREATE INDEX t1_idx_00000062 ON t1(b); -- stat1: 100 20
  412. CREATE INDEX t1_idx_000123a7 ON t1(a, b); -- stat1: 100 50 16
  413. CREATE INDEX t2_idx_00000063 ON t2(c); -- stat1: 100 20
  414. CREATE INDEX t2_idx_00000064 ON t2(d); -- stat1: 100 5
  415. CREATE INDEX t2_idx_0001295b ON t2(c, d); -- stat1: 100 20 5
  416. ANALYZE;
  417. SELECT * FROM sqlite_stat1 ORDER BY 1, 2;
  418. } {
  419. t1 i1 {100 50}
  420. t1 t1_idx_00000061 {100 50}
  421. t1 t1_idx_00000062 {100 20}
  422. t1 t1_idx_000123a7 {100 50 17}
  423. t2 t2_idx_00000063 {100 20}
  424. t2 t2_idx_00000064 {100 5}
  425. t2 t2_idx_0001295b {100 20 5}
  426. }
  427. do_catchsql_test 5.4 {
  428. SELECT sqlite_expert_rem(123, 123);
  429. } {1 {no such function: sqlite_expert_rem}}
  430. do_catchsql_test 5.5 {
  431. SELECT sqlite_expert_sample();
  432. } {1 {no such function: sqlite_expert_sample}}
  433. if 0 {
  434. do_test expert1-6.0 {
  435. catchcmd :memory: {
  436. .expert
  437. select base64('');
  438. .expert
  439. select name from pragma_collation_list order by name collate uint;
  440. }
  441. } {0 {(no new indexes)
  442. SCAN CONSTANT ROW
  443. (no new indexes)
  444. SCAN pragma_collation_list VIRTUAL TABLE INDEX 0:
  445. USE TEMP B-TREE FOR ORDER BY
  446. }}
  447. }
  448. do_execsql_test 6.0 {
  449. CREATE TABLE x1(a, b, c, d);
  450. CREATE INDEX x1ab ON x1(a, lower(b));
  451. CREATE INDEX x1dcba ON x1(d, b+c, a);
  452. }
  453. do_candidates_test 6.1 {
  454. SELECT * FROM x1 WHERE b=? ORDER BY a;
  455. } {
  456. CREATE INDEX x1_idx_0001267f ON x1(b, a);
  457. CREATE INDEX x1_idx_00000062 ON x1(b);
  458. }
  459. #-------------------------------------------------------------------------
  460. ifcapable fts5 {
  461. reset_db
  462. do_execsql_test 7.0 {
  463. CREATE VIRTUAL TABLE ft USING fts5(a);
  464. CREATE TABLE t1(x, y);
  465. }
  466. do_candidates_test 7.1 {
  467. SELECT * FROM ft, t1 WHERE a=x
  468. } {
  469. CREATE INDEX t1_idx_00000078 ON t1(x);
  470. }
  471. register_tcl_module db
  472. proc vtab_command {method args} {
  473. global G
  474. switch -- $method {
  475. xConnect {
  476. return "CREATE TABLE t1(a, b, c);"
  477. }
  478. xBestIndex {
  479. return [list]
  480. }
  481. xFilter {
  482. return [list sql "SELECT rowid, * FROM t0"]
  483. }
  484. }
  485. return {}
  486. }
  487. do_execsql_test 7.2 {
  488. CREATE TABLE t0(a, b, c);
  489. INSERT INTO t0 VALUES(1, 2, 3), (11, 22, 33);
  490. CREATE VIRTUAL TABLE t2 USING tcl(vtab_command);
  491. }
  492. do_execsql_test 7.3 {
  493. SELECT * FROM t2
  494. } {
  495. 1 2 3
  496. 11 22 33
  497. }
  498. do_candidates_test 7.4 {
  499. SELECT * FROM ft, t1 WHERE a=x
  500. } {
  501. CREATE INDEX t1_idx_00000078 ON t1(x);
  502. }
  503. do_test 7.5 {
  504. set expert [sqlite3_expert_new db]
  505. list [catch { $expert sql "SELECT * FROM ft, t2 WHERE b=1" } msg] $msg
  506. } {1 {no such table: t2}}
  507. $expert destroy
  508. reset_db
  509. do_execsql_test 7.6 {
  510. BEGIN TRANSACTION;
  511. CREATE TABLE IF NOT EXISTS 'bfts_idx_data'(id INTEGER PRIMARY KEY, block BLOB);
  512. CREATE TABLE IF NOT EXISTS 'fts_idx_data'(id INTEGER PRIMARY KEY, block BLOB);
  513. INSERT INTO fts_idx_data VALUES(1,X'');
  514. INSERT INTO fts_idx_data VALUES(10,X'00000000ff000001000000');
  515. CREATE TABLE IF NOT EXISTS 'fts_idx_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
  516. CREATE TABLE IF NOT EXISTS 'fts_idx_docsize'(id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER);
  517. CREATE TABLE IF NOT EXISTS 'fts_idx_config'(k PRIMARY KEY, v) WITHOUT ROWID;
  518. INSERT INTO fts_idx_config VALUES('version',4);
  519. PRAGMA writable_schema=ON;
  520. INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql)VALUES('table','fts_idx','fts_idx',0,'CREATE VIRTUAL TABLE fts_idx USING fts5(Title, Description, Channel, Tags, content='''', contentless_delete=1)');
  521. CREATE TABLE f(x BLOB, y);
  522. COMMIT;
  523. PRAGMA writable_schema = RESET;
  524. }
  525. do_candidates_test 7.4 {
  526. SELECT * FROM fts_idx, f WHERE x = fts_idx.Channel
  527. } {
  528. CREATE INDEX f_idx_00000078 ON f(x);
  529. }
  530. }
  531. finish_test