fts5plan.test 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # 2014 Dec 20
  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. #
  12. # This file focuses on testing the planner (xBestIndex function).
  13. #
  14. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5plan
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.0 {
  22. CREATE TABLE t1(x, y);
  23. CREATE VIRTUAL TABLE f1 USING fts5(ff);
  24. }
  25. do_eqp_test 1.1 {
  26. SELECT * FROM t1, f1 WHERE f1 MATCH t1.x
  27. } {
  28. QUERY PLAN
  29. |--SCAN t1
  30. `--SCAN f1 VIRTUAL TABLE INDEX 0:M1
  31. }
  32. do_eqp_test 1.2 {
  33. SELECT * FROM t1, f1 WHERE f1 > t1.x
  34. } {
  35. QUERY PLAN
  36. |--SCAN f1 VIRTUAL TABLE INDEX 0:
  37. `--SCAN t1
  38. }
  39. do_eqp_test 1.3 {
  40. SELECT * FROM f1 WHERE f1 MATCH ? ORDER BY ff
  41. } {
  42. QUERY PLAN
  43. |--SCAN f1 VIRTUAL TABLE INDEX 0:M1
  44. `--USE TEMP B-TREE FOR ORDER BY
  45. }
  46. do_eqp_test 1.4 {
  47. SELECT * FROM f1 ORDER BY rank
  48. } {
  49. QUERY PLAN
  50. |--SCAN f1 VIRTUAL TABLE INDEX 0:
  51. `--USE TEMP B-TREE FOR ORDER BY
  52. }
  53. do_eqp_test 1.5 {
  54. SELECT * FROM f1 WHERE rank MATCH ?
  55. } {SCAN f1 VIRTUAL TABLE INDEX 0:r}
  56. finish_test