sqlite/ext/fts5/test/fts5limits.test
dan 4042d2b424 Limit the number of nested NOT nodes in an fts5 expression to 256.
FossilOrigin-Name: 0e5c1ee40a146ef8b2b3c5f53d0a45e092bc8d8e933f3819805c995819d31bae
2023-05-15 17:14:16 +00:00

48 lines
974 B
Plaintext

# 2023 May 16
#
# 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.
#
#*************************************************************************
#
source [file join [file dirname [info script]] fts5_common.tcl]
set testprefix fts5limits
return_if_no_fts5
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE ft USING fts5(x);
}
# Default limit for expression depth is 256
#
foreach {tn nRepeat op bErr} {
1 200 AND 0
2 200 NOT 0
3 200 OR 0
4 260 AND 0
5 260 NOT 1
6 260 OR 0
} {
set L [string repeat "abc " $nRepeat]
set Q [join $L " $op "]
set res {0 {}}
if {$bErr} {
set res "1 {fts5 expression tree is too large (maximum depth 256)}"
}
do_catchsql_test 1.$tn {
SELECT * FROM ft($Q)
} $res
}
finish_test