fts5limits.test 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # 2023 May 16
  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. source [file join [file dirname [info script]] fts5_common.tcl]
  13. set testprefix fts5limits
  14. return_if_no_fts5
  15. do_execsql_test 1.0 {
  16. CREATE VIRTUAL TABLE ft USING fts5(x);
  17. }
  18. # Default limit for expression depth is 256
  19. #
  20. foreach {tn nRepeat op bErr} {
  21. 1 200 AND 0
  22. 2 200 NOT 0
  23. 3 200 OR 0
  24. 4 260 AND 0
  25. 5 260 NOT 1
  26. 6 260 OR 0
  27. } {
  28. set L [string repeat "abc " $nRepeat]
  29. set Q [join $L " $op "]
  30. set res {0 {}}
  31. if {$bErr} {
  32. set res "1 {fts5 expression tree is too large (maximum depth 256)}"
  33. }
  34. do_catchsql_test 1.$tn {
  35. SELECT * FROM ft($Q)
  36. } $res
  37. }
  38. finish_test