SQLite

Check-in [c93c6b45a3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Have fts3 ignore empty sets of parenthesis if built with SQLITE_ENABLE_FTS3_PARENTHESIS.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c93c6b45a317c40eb5c0abb6620d21f5821a601632c791e11e5ce62e039eccda
User & Date: dan 2019-01-14 11:56:13.183
Context
2019-01-14
13:32
When parsing a corrupt record using sqlite3VdbeRecordUnpack(), make sure that the resulting UnpackedRecord object is completely initialized, to avoid (harmless) MSAN warnings. (check-in: ddc3697efd user: drh tags: trunk)
11:56
Have fts3 ignore empty sets of parenthesis if built with SQLITE_ENABLE_FTS3_PARENTHESIS. (check-in: c93c6b45a3 user: dan tags: trunk)
05:48
Avoid reading off the front of a page buffer when balancing a corrupt btree page. (check-in: cb50509020 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to ext/fts3/fts3_expr.c.
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
493
494
495
496
497
498
499

500
501
502
503
504
505
506







-







  }

  if( sqlite3_fts3_enable_parentheses ){
    if( *zInput=='(' ){
      int nConsumed = 0;
      pParse->nNest++;
      rc = fts3ExprParse(pParse, zInput+1, nInput-1, ppExpr, &nConsumed);
      if( rc==SQLITE_OK && !*ppExpr ){ rc = SQLITE_DONE; }
      *pnConsumed = (int)(zInput - z) + 1 + nConsumed;
      return rc;
    }else if( *zInput==')' ){
      pParse->nNest--;
      *pnConsumed = (int)((zInput - z) + 1);
      *ppExpr = 0;
      return SQLITE_DONE;
Changes to test/fts3expr5.test.
17
18
19
20
21
22
23




24
25
26
27
28
29
30
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34







+
+
+
+







set testprefix fts3expr5

# If SQLITE_ENABLE_FTS3 is defined, omit this file.
ifcapable !fts3 {
  finish_test
  return
}

proc test_fts3expr {expr} {
  db one {SELECT fts3_exprtest('simple', $expr, 'a', 'b', 'c')}
}

#-------------------------------------------------------------------------
# Various forms of empty phrase expressions.
#
do_execsql_test 1.0 {
  CREATE VIRTUAL TABLE t0 USING fts3(x);
  SELECT rowid FROM t0 WHERE x MATCH '';
41
42
43
44
45
46
47














48

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67







+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
do_execsql_test 1.4 {
  SELECT rowid FROM t0 WHERE x MATCH '"" NOT ""';
} {}
do_execsql_test 1.5 {
  SELECT rowid FROM t0 WHERE x MATCH '""""';
} {}

#-------------------------------------------------------------------------
# Various forms of empty phrase expressions.
#
set sqlite_fts3_enable_parentheses 1
do_test 2.0 {
  test_fts3expr {(a:123)(b:234)()(c:456)}
} {AND {AND {PHRASE 0 0 123} {PHRASE 1 0 234}} {PHRASE 2 0 456}}
do_test 2.1 {
  test_fts3expr {(a:123)(b:234)(c:456)}
} {AND {AND {PHRASE 0 0 123} {PHRASE 1 0 234}} {PHRASE 2 0 456}}
do_test 2.2 {
  list [catch { test_fts3expr {"123" AND ( )} } msg] $msg
} {1 {Error parsing expression}}

finish_test