/ Check-in [c93c6b45]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:c93c6b45a317c40eb5c0abb6620d21f5821a601632c791e11e5ce62e039eccda
User & Date: dan 2019-01-14 11:56:13
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: ddc3697e user: drh tags: trunk
11:56
Have fts3 ignore empty sets of parenthesis if built with SQLITE_ENABLE_FTS3_PARENTHESIS. check-in: c93c6b45 user: dan tags: trunk
05:48
Avoid reading off the front of a page buffer when balancing a corrupt btree page. check-in: cb505090 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_expr.c.

   493    493     }
   494    494   
   495    495     if( sqlite3_fts3_enable_parentheses ){
   496    496       if( *zInput=='(' ){
   497    497         int nConsumed = 0;
   498    498         pParse->nNest++;
   499    499         rc = fts3ExprParse(pParse, zInput+1, nInput-1, ppExpr, &nConsumed);
   500         -      if( rc==SQLITE_OK && !*ppExpr ){ rc = SQLITE_DONE; }
   501    500         *pnConsumed = (int)(zInput - z) + 1 + nConsumed;
   502    501         return rc;
   503    502       }else if( *zInput==')' ){
   504    503         pParse->nNest--;
   505    504         *pnConsumed = (int)((zInput - z) + 1);
   506    505         *ppExpr = 0;
   507    506         return SQLITE_DONE;

Changes to test/fts3expr5.test.

    17     17   set testprefix fts3expr5
    18     18   
    19     19   # If SQLITE_ENABLE_FTS3 is defined, omit this file.
    20     20   ifcapable !fts3 {
    21     21     finish_test
    22     22     return
    23     23   }
           24  +
           25  +proc test_fts3expr {expr} {
           26  +  db one {SELECT fts3_exprtest('simple', $expr, 'a', 'b', 'c')}
           27  +}
    24     28   
    25     29   #-------------------------------------------------------------------------
    26     30   # Various forms of empty phrase expressions.
    27     31   #
    28     32   do_execsql_test 1.0 {
    29     33     CREATE VIRTUAL TABLE t0 USING fts3(x);
    30     34     SELECT rowid FROM t0 WHERE x MATCH '';
................................................................................
    41     45   do_execsql_test 1.4 {
    42     46     SELECT rowid FROM t0 WHERE x MATCH '"" NOT ""';
    43     47   } {}
    44     48   do_execsql_test 1.5 {
    45     49     SELECT rowid FROM t0 WHERE x MATCH '""""';
    46     50   } {}
    47     51   
           52  +#-------------------------------------------------------------------------
           53  +# Various forms of empty phrase expressions.
           54  +#
           55  +set sqlite_fts3_enable_parentheses 1
           56  +do_test 2.0 {
           57  +  test_fts3expr {(a:123)(b:234)()(c:456)}
           58  +} {AND {AND {PHRASE 0 0 123} {PHRASE 1 0 234}} {PHRASE 2 0 456}}
           59  +do_test 2.1 {
           60  +  test_fts3expr {(a:123)(b:234)(c:456)}
           61  +} {AND {AND {PHRASE 0 0 123} {PHRASE 1 0 234}} {PHRASE 2 0 456}}
           62  +do_test 2.2 {
           63  +  list [catch { test_fts3expr {"123" AND ( )} } msg] $msg
           64  +} {1 {Error parsing expression}}
           65  +
    48     66   finish_test
           67  +