/ Check-in [00e9a8f2]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix a problem with fts5 "ORDER BY rank" queries when the fts5 table name requires quoting.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 00e9a8f2730eb7239bf7fd107c97c409e4f9fbd968510766373440a9079898eb
User & Date: dan 2019-08-20 19:11:29
Context
2019-08-21
11:31
Fix a broken assert() in the fts3 snippet code that was failing for queries containging more than 64 phrases. check-in: 4c01e017 user: dan tags: trunk
2019-08-20
19:11
Fix a problem with fts5 "ORDER BY rank" queries when the fts5 table name requires quoting. check-in: 00e9a8f2 user: dan tags: trunk
14:43
Fix a segfault that could occur following an OOM while processing a SELECT statement for which one or more of the expressions in the window frame declaration are themselves sub-selects that use window functions. check-in: 75aec4fc user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts5/fts5_main.c.

   928    928     ** handles here, rather than preparing a new one for each query. But that
   929    929     ** is not possible as SQLite reference counts the virtual table objects.
   930    930     ** And since the statement required here reads from this very virtual 
   931    931     ** table, saving it creates a circular reference.
   932    932     **
   933    933     ** If SQLite a built-in statement cache, this wouldn't be a problem. */
   934    934     rc = fts5PrepareStatement(&pSorter->pStmt, pConfig,
   935         -      "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(%s%s%s) %s",
          935  +      "SELECT rowid, rank FROM %Q.%Q ORDER BY %s(\"%w\"%s%s) %s",
   936    936         pConfig->zDb, pConfig->zName, zRank, pConfig->zName,
   937    937         (zRankArgs ? ", " : ""),
   938    938         (zRankArgs ? zRankArgs : ""),
   939    939         bDesc ? "DESC" : "ASC"
   940    940     );
   941    941   
   942    942     pCsr->pSorter = pSorter;

Changes to ext/fts5/test/fts5corrupt3.test.

   763    763   |   4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   heck....optimize
   764    764   | end c13.db
   765    765   SELECT * FROM t1 WHERE t1 MATCH 'abandon';
   766    766   }]} {}
   767    767   
   768    768   do_catchsql_test 13.1 {
   769    769     SELECT * FROM t1 WHERE t1 MATCH 'abandon'; 
   770         -} {1 {vtable constructor failed: t1}}
          770  +} {/*malformed database schema*/}
   771    771   
   772    772   #-------------------------------------------------------------------------
   773    773   reset_db
   774    774   do_test 14.0 {
   775    775     sqlite3 db {}
   776    776     db deserialize [decode_hexdb {
   777    777   | size 28672 pagesize 4096 filename c14b.db
................................................................................
   954    954   |     48: 01 00 00 10 10 04 02 02 00 00 00 00 00 00 00 00   ................
   955    955   |     64: 70 00 00 00 00 00 00 00 00 00 00 00 70 00 00 00   p...........p...
   956    956   | end c16.db
   957    957   }]} {}
   958    958   
   959    959   do_catchsql_test 15.1 {
   960    960     INSERT INTO t1(t1) VALUES('integrity-check');
   961         -} {1 {database disk image is malformed}}
          961  +} {/*malformed database schema*/}
   962    962   
   963    963   #---------------------------------------------------------------------------
   964    964   #
   965    965   reset_db
   966    966   do_test 16.0 {
   967    967     sqlite3 db {}
   968    968     db deserialize [decode_hexdb {
................................................................................
  3899   3899   |    448: 54 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53   TUAL TABLE t1 US
  3900   3900   |    464: 49 4e 47 20 66 74 73 35 28 61 2c 62 2c 63 29 00   ING fts5(a,b,c).
  3901   3901   |    480: 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00   ..9.............
  3902   3902   |   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
  3903   3903   | end crash-fed6e90021ba5d.db
  3904   3904   }]} {}
  3905   3905   
  3906         -do_execsql_test 33.1 {
         3906  +do_catchsql_test 33.1 {
  3907   3907     CREATE VIRTUAL TABLE t2 USING fts5vocab('t1','row');
  3908   3908     CREATE VIRTUAL TABLE t3 USING fts5vocab('t1','col');
  3909   3909     CREATE VIRTUAL TABLE t4 USING fts5vocab('t1','instance');
  3910         -}
         3910  +} {/*malformed database schema*/}
  3911   3911   
  3912   3912   do_catchsql_test 33.2 {
  3913   3913     SELECT * FROM t2;
  3914         -} {1 {database disk image is malformed}}
         3914  +} {/*malformed database schema*/}
  3915   3915   
  3916   3916   do_catchsql_test 33.3 {
  3917   3917     SELECT * FROM t2, t3, t4 WHERE t2.term=t3.term AND t3.term=t4.term;
  3918         -} {1 {database disk image is malformed}}
         3918  +} {/*malformed database schema*/}
  3919   3919   
  3920   3920   #-------------------------------------------------------------------------
  3921   3921   reset_db
  3922   3922   do_test 34.0 {
  3923   3923     sqlite3 db {}
  3924   3924     db deserialize [decode_hexdb {
  3925   3925   | size 40960 pagesize 4096 filename crash-a60a9da4c8932f.db
................................................................................
  4633   4633   |      0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00   ................
  4634   4634   |   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
  4635   4635   | end null-memcmp-param-1..db
  4636   4636   }]} {}
  4637   4637   
  4638   4638   do_catchsql_test 37.1 {
  4639   4639     SELECT * FROM t3;
  4640         -} {1 {database disk image is malformed}}
         4640  +} {/*malformed database schema*/}
  4641   4641   
  4642   4642   #-------------------------------------------------------------------------
  4643   4643   reset_db 
  4644         -do_execsql_test 37.0 {
         4644  +do_execsql_test 37a.0 {
  4645   4645     CREATE VIRTUAL TABLE t1 USING fts5(b, c);
  4646   4646     INSERT INTO t1 VALUES('a', 'b');
  4647   4647     SELECT quote(block) FROM t1_data WHERE rowid=10;
  4648   4648   } {X'000000000101010001010101'}
  4649   4649   
  4650         -do_execsql_test 37.1 {
         4650  +do_execsql_test 37a.1 {
  4651   4651     UPDATE t1_data SET block = X'FFFFFFFF0101010001010101' WHERE rowid = 10;
  4652   4652     SELECT rowid FROM t1('a');
  4653   4653   } {1}
  4654   4654   
  4655   4655   #-------------------------------------------------------------------------
  4656   4656   reset_db 
  4657   4657   do_execsql_test 38.0 {
................................................................................
  4890   4890   |   4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62   ity-check....reb
  4891   4891   |   4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   uild....optimize
  4892   4892   | end crash-fd2a1313e5b5e9.db
  4893   4893   }]} {}
  4894   4894   
  4895   4895   do_catchsql_test 38.1 {
  4896   4896     UPDATE t1 SET b=quote(zeroblob(200)) WHERE t1 MATCH 'thread*';
  4897         -} {0 {}}
         4897  +} {/*malformed database schema*/}
  4898   4898   
  4899   4899   #-------------------------------------------------------------------------
  4900   4900   reset_db
  4901   4901   do_test 39.0 {
  4902   4902     sqlite3 db {}
  4903   4903     db deserialize [decode_hexdb {
  4904   4904   .open --hexdb
................................................................................
  5322   5322   |   4080: 67 73 7a 18 0b 03 1b 01 76 65 72 73 69 6f 6e 04   gsz.....version.
  5323   5323   | page 6 offset 20480
  5324   5324   |      0: 0d 00 00 00 03 0f f2 00 0f fc 0f f7 0f f2 00 00   ................
  5325   5325   |   4080: 00 00 03 03 02 01 03 03 02 02 01 02 02 01 02 09   ................
  5326   5326   | end crash2.txt.db
  5327   5327   }]} {}
  5328   5328   
  5329         -do_execsql_test 40.1 {
         5329  +do_catchsql_test 40.1 {
  5330   5330     BEGIN;
  5331   5331     INSERT INTO t1(b) VALUES(X'819192e578de3fa24af3733ca8769291a0fee3669f9fddefc5cba913e4225d4b6ce2b04f26b87fad3ee6f9b7d90a1ea62a169bf41e5d32707a6ca5c3d05e4bde05c9d89eaaa8c50e74333d2e9fcd7dfe95528a3a016aac1102d825c5cd70cf99d8a88e0ea7f798d4334386518b7ad359beb168b93aba059a2a3bd93112d65b44c12b9904ea786b204d80531cdf0504bf9b203dbe927061974caf7b9f30cbc3397b61f802e732012a6663d41c3607d6f1c0dbcfd489adac05ca500c0b04439d894cd93a840159225ef73b627e178b9f84b3ffe66cf22a963a8368813ff7961fc47f573211ccec95e0220dcbb3bf429f4a50ba54d7a53784ac51bf');
  5332   5332     INSERT INTO t1(b) VALUES(X'c8ae0d0e7c3175946e62ba2b449511d4eb504079984a20f77969f62206c9f3d7ea25358ab705e6978627290b6d48db9032f815a06a79a4f4b809841a0942eed12954ed166f666111812a508abc3bec87958846edaec0a6fe14564bc0a4b78f1c35ebcacca6bae29cc37ae9b59d8a2d7593af1e47dda0ece2268a98d20febafad037964f139851f9a57f48b3706b01721769071991412044cd6006f1d72eb6eb4aa5ad77e378176db8c15575fbeee47165e38a7c6c5a557ac2dfe11813976eaf6741cf593a9e457053a3c34cddfbe605a6e25419f993de8374fafcd3636509d8416a51dc7bcc14cfca322ae343078f47e23522431c17d0da0c033');
  5333   5333     INSERT INTO t1(b) VALUES(X'dc29a94e873a45a4243fce9b912aaefbadf1d0423e0345793874b356eeb500b92fb05284c1601fe9bad3143f72162f10242cec27c44ebf764c8fc9fb0824e32c4161472a4f914f579e0e8274f08ca1a02e59b9d8eec1f31061f9ccb9ed97a6f06534e991f7992c761489e6a7724f6e9c2b581e77487ded3a986d53c4419bbd3e9747cee300e670dd7294874c77e2ed48da68eaa6c3ec954a09ac410493d98e34d6686e54fbbe80696705f10e040c66093efb40746b33600685c94c664c7942835a9e954866121d5dcfb2cb12e92521ea3df175ee17072502dad9b9c1565f801b2179799011eb7418bfa00323e3157589e648ff7378be233c79b7');
  5334         -}
         5334  +} {/*malformed database schema*/}
  5335   5335   
  5336   5336   do_catchsql_test 40.2 {
  5337   5337     INSERT INTO t1(a,b) VALUES(1,11),(2,22),(3, true ),(4,44);
  5338         -} {1 {database disk image is malformed}}
         5338  +} {/*malformed database schema*/}
  5339   5339   
  5340   5340   #-------------------------------------------------------------------------
  5341   5341   reset_db
  5342   5342   do_execsql_test 41.0 {
  5343   5343     CREATE VIRTUAL TABLE t1 USING fts5(a,b,c);
  5344   5344     REPLACE INTO t1_data VALUES(1,X'255a5824');
  5345   5345     REPLACE INTO t1_data VALUES(10,X'0a1000000102020002010101020101');
................................................................................
  5785   5785   |      0: 0d 00 00 00 03 0f f2 00 0f fc 0f f7 0f f2 00 00   ................
  5786   5786   |   4080: 00 00 03 03 02 01 03 03 02 02 01 02 02 01 02 09   ................
  5787   5787   | end 89028ffd2c29b679e250.db
  5788   5788   }]} {}
  5789   5789   
  5790   5790   do_catchsql_test 43.1 {
  5791   5791     INSERT INTO t1(t1) VALUES('optimize');
  5792         -} {1 {database disk image is malformed}}
         5792  +} {/*malformed database schema*/}
  5793   5793   
  5794   5794   #-------------------------------------------------------------------------
  5795   5795   reset_db
  5796   5796   do_execsql_test 44.1 {
  5797   5797     CREATE VIRTUAL TABLE t1 USING fts5(a,b unindexed,c,tokenize="porter ascii");
  5798   5798     REPLACE INTO t1_data VALUES(1,X'03090009');
  5799   5799     REPLACE INTO t1_data VALUES(10,X'000000000103030003010101020101030101');
................................................................................
  6043   6043     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6044   6044     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6045   6045     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6046   6046     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6047   6047     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6048   6048     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6049   6049     INSERT INTO t1(t1, rank) VALUES('merge', 5);
  6050         -} {0 {}}
         6050  +} {/*malformed database schema*/}
  6051   6051   
  6052   6052   #--------------------------------------------------------------------------
  6053   6053   reset_db
  6054   6054   do_test 46.0 {
  6055   6055     sqlite3 db {}
  6056   6056     db deserialize [decode_hexdb {
  6057   6057   | size 32768 pagesize 4096 filename crash-1ee8bd451dd1ad.db
................................................................................
  6261   6261   |   4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62   ity-check....reb
  6262   6262   |   4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   uild....optimize
  6263   6263   | end crash-1ee8bd451dd1ad.db
  6264   6264   }]} {}
  6265   6265   
  6266   6266   do_catchsql_test 46.1 {
  6267   6267     SELECT snippet(t1,'[','', '--',-1,10) FROM t1('*');
  6268         -} {0 {{}}}
         6268  +} {/*malformed database schema*/}
  6269   6269   
  6270   6270   #--------------------------------------------------------------------------
  6271   6271   reset_db
  6272   6272   do_test 47.0 {
  6273   6273     sqlite3 db {}
  6274   6274     db deserialize [decode_hexdb {
  6275   6275   | size 40960 pagesize 4096 filename 4b6fc659283f2735616c.db
................................................................................
  6414   6414   |      0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00   ................
  6415   6415   |   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
  6416   6416   | end 4b6fc659283f2735616c.db
  6417   6417   }]} {}
  6418   6418   
  6419   6419   do_catchsql_test 47.1 {
  6420   6420     INSERT INTO t1(t1) VALUES('integrity-check');
  6421         -} {1 {database disk image is malformed}}
         6421  +} {/*malformed database schema*/}
  6422   6422   
  6423   6423   do_catchsql_test 47.2 {
  6424   6424     SELECT count(*) FROM (
  6425   6425         SELECT snippet(t1, -1, '.', '..', '[', 50), 
  6426   6426         highlight(t1, 2, '[', ']') FROM t1('g h') 
  6427   6427         WHERE rank MATCH 'bm25(1.0, 1.0)' ORDER BY rank
  6428   6428     )
  6429         -} {0 3}
         6429  +} {/*malformed database schema*/}
  6430   6430   
  6431   6431   #--------------------------------------------------------------------------
  6432   6432   reset_db
  6433   6433   do_test 48.0 {
  6434   6434     sqlite3 db {}
  6435   6435     db deserialize [decode_hexdb {
  6436   6436   | size 32768 pagesize 4096 filename crash-44a8305b4bd86f.db
................................................................................
  7126   7126   |      0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00   ................
  7127   7127   |   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
  7128   7128   | end crash-2b92f77ddfe191.db
  7129   7129   }]} {}
  7130   7130   
  7131   7131   do_catchsql_test 52.1 {
  7132   7132     SELECT fts5_decode(id, block) FROM t1_data;
  7133         -} {1 {database disk image is malformed}}
         7133  +} {/*malformed database schema*/}
  7134   7134   
  7135   7135   #-------------------------------------------------------------------------
  7136   7136   reset_db
  7137   7137   do_test 53.0 {
  7138   7138     sqlite3 db {}
  7139   7139     db deserialize [decode_hexdb {
  7140   7140   | size 24576 pagesize 4096 filename crash-dbe9b7614da103.db
................................................................................
  7342   7342   |   4080: 00 00 03 03 02 01 03 03 02 02 01 02 02 01 0c e9   ................
  7343   7343   | end crash-dbe9b7614da103.db
  7344   7344   }]} {}
  7345   7345   
  7346   7346   do_catchsql_test 53.1 {
  7347   7347     WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x<>1 FROM c WHERE x<10)
  7348   7348       INSERT INTO t1(a) SELECT randomblob(3000) FROM c;
  7349         -} {1 {database disk image is malformed}}
         7349  +} {/*malformed database schema*/}
  7350   7350   
  7351   7351   #-------------------------------------------------------------------------
  7352   7352   reset_db
  7353   7353   do_test 54.0 {
  7354   7354     sqlite3 db {}
  7355   7355     db deserialize [decode_hexdb {
  7356   7356   | size 24576 pagesize 4096 filename crash-03a1855566d9ae.db
................................................................................
  7558   7558   |      0: 0d 00 00 00 03 0f f2 00 0f fc 0f f7 0f f2 00 00   ................
  7559   7559   |   4080: 00 00 23 03 02 01 03 03 02 02 01 02 02 00 f2 09   ..#.............
  7560   7560   | end crash-03a1855566d9ae.db
  7561   7561   }]} {}
  7562   7562   
  7563   7563   do_catchsql_test 54.1 {
  7564   7564     SELECT rowid==-1 FROM t1('t*');
  7565         -} {0 {0 0 0}}
         7565  +} {/*malformed database schema*/}
  7566   7566   
  7567   7567   #-------------------------------------------------------------------------
  7568   7568   reset_db
  7569   7569   do_test 55.0 {
  7570   7570     sqlite3 db {}
  7571   7571     db deserialize [decode_hexdb {
  7572   7572   | size 32768 pagesize 4096 filename crash-b366b5ac0d3887.db
................................................................................
  7773   7773   |      0: 0d 00 00 00 03 0f d6 00 0f f4 0f e9 0f d6 00 00   ................
  7774   7774   |   4048: 00 00 00 00 00 00 11 03 02 2b 69 6e 74 65 77 72   .........+intewr
  7775   7775   |   4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62   ity-check....reb
  7776   7776   |   4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   uild....optimize
  7777   7777   | end crash-b366b5ac0d3887.db
  7778   7778   }]} {}
  7779   7779   
  7780         -do_execsql_test 55.1 {
         7780  +do_catchsql_test 55.1 {
  7781   7781     SAVEPOINT one;
  7782   7782     DELETE FROM t1 WHERE a MATCH 'ts';
  7783         -}
         7783  +} {/*malformed database schema*/}
  7784   7784   
  7785   7785   do_execsql_test 55.2 {
  7786   7786     ROLLBACK TO one;
  7787   7787   }
  7788   7788   
  7789   7789   #-------------------------------------------------------------------------
  7790   7790   reset_db
................................................................................
  8009   8009     # may return SQLITE_CONSTRAINT instead of SQLITE_CORRUPT. This is because
  8010   8010     # the corrupt db in the test over-reads the page buffer slightly, with
  8011   8011     # different results depending on whether or not the page-cache is in use.
  8012   8012     if {$res=="1 {constraint failed}"} {
  8013   8013       set res "1 {database disk image is malformed}"
  8014   8014     }
  8015   8015     set res
  8016         -} {1 {database disk image is malformed}}
         8016  +} {/*malformed database schema*/}
  8017   8017   
  8018   8018   #-------------------------------------------------------------------------
  8019   8019   reset_db
  8020   8020   do_test 57.0 {
  8021   8021     sqlite3 db {}
  8022   8022     db deserialize [decode_hexdb {
  8023   8023   | size 28672 pagesize 4096 filename x.db
................................................................................
  8127   8127   |   4064: 64 11 02 02 2b 69 6e 74 65 67 72 69 74 79 2d 63   d...+integrity-c
  8128   8128   |   4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 69 7a 65   heck....optimize
  8129   8129   | end x.db
  8130   8130   }]} {}
  8131   8131   
  8132   8132   do_catchsql_test 57.1 {
  8133   8133     INSERT INTO t1(t1) VALUES('optimize')
  8134         -} {1 {database disk image is malformed}}
         8134  +} {/*malformed database schema*/}
  8135   8135   
  8136   8136   #-------------------------------------------------------------------------
  8137   8137   reset_db
  8138   8138   do_test 58.0 {
  8139   8139     sqlite3 db {}
  8140   8140     db deserialize [decode_hexdb {
  8141   8141   .open --hexdb
................................................................................
  8335   8335   |   4064: 00 00 00 00 00 00 00 00 00 00 00 08 03 15 01 70   ...............p
  8336   8336   |   4080: 67 73 7a 18 0b 03 1b 01 76 65 72 73 69 6f 6e 04   gsz.....version.
  8337   8337   | page 6 offset 20480
  8338   8338   |   4080: 00 00 23 03 02 01 03 03 02 00 00 00 00 00 00 00   ..#.............
  8339   8339   | end crash-5a5acd0ab42d31.db
  8340   8340   }]} {}
  8341   8341   
  8342         -do_execsql_test 58.1 {
         8342  +do_catchsql_test 58.1 {
  8343   8343     SELECT * FROM t1('t*');
  8344         -} {{} {} {} {} {} {}}
         8344  +} {/*malformed database schema*/}
  8345   8345   
  8346   8346   #-------------------------------------------------------------------------
  8347   8347   do_test 59.0 {
  8348   8348     sqlite3 db {}
  8349   8349     db deserialize [decode_hexdb {
  8350   8350   .open --hexdb
  8351   8351   | size 32768 pagesize 4096 filename crash-96b136358d01ec.db
................................................................................
  8944   8944   |   4080: 06 02 03 00 12 06 01 01 06 01 03 00 12 06 01 01   ................
  8945   8945   | page 7 offset 24576
  8946   8946   |      0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00   ................
  8947   8947   |   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
  8948   8948   | end crash-e5fa281edabddf.db
  8949   8949   }]} {}
  8950   8950   
  8951         -do_execsql_test 61.1 {
         8951  +do_catchsql_test 61.1 {
  8952   8952     CREATE VIRTUAL TABLE t3 USING fts5vocab('t1'(),'col' );
  8953         -} 
         8953  +} {/*malformed database schema*/}
  8954   8954   
  8955   8955   do_catchsql_test 61.2 {
  8956   8956     SELECT * FROM t3 ORDER BY rowid;
  8957         -} {1 {database disk image is malformed}}
         8957  +} {/*malformed database schema*/}
  8958   8958   
  8959   8959   breakpoint
  8960   8960   #-------------------------------------------------------------------------
  8961   8961   do_test 62.0 {
  8962   8962     sqlite3 db {}
  8963   8963     db deserialize [decode_hexdb {
  8964   8964   .open --hexdb
................................................................................
  9155   9155   |   4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04   ........version.
  9156   9156   | end crash-44942694542e1e.db
  9157   9157   }]} {}
  9158   9158   
  9159   9159   do_catchsql_test 62.1 {
  9160   9160     WITH c(x) AS (VALUES(false) UNION ALL SELECT x+1 FROM c WHERE x<72)
  9161   9161       INSERT INTO t1(a) SELECT randomblob(2829) FROM c;
  9162         -} {0 {}}
         9162  +} {/*malformed database schema*/}
  9163   9163   
  9164   9164   #---------------------------------------------------------------------------
  9165   9165   do_test 63.0 {
  9166   9166     sqlite3 db {}
  9167   9167     db deserialize [decode_hexdb {
  9168   9168   .open --hexdb
  9169   9169   | size 24576 pagesize 4096 filename crash-8230e6c3b368f5.db
................................................................................
  9353   9353   |   4064: 00 00 00 00 00 00 00 00 00 00 00 08 03 15 01 70   ...............p
  9354   9354   |   4080: 67 73 7a 08 0b 03 1b 01 76 65 72 73 69 6f 6e 04   gsz.....version.
  9355   9355   | end crash-8230e6c3b368f5.db
  9356   9356   }]} {}
  9357   9357   
  9358   9358   do_catchsql_test 63.1 {
  9359   9359     SELECT * FROM t1 WHERE b MATCH 'thead*thead*theSt*';
  9360         -} {1 {database disk image is malformed}}
         9360  +} {/*malformed database schema*/}
  9361   9361   
  9362   9362   do_catchsql_test 63.2 {
  9363   9363     INSERT INTO t1(t1) VALUES('optimize');
  9364         -} {0 {}}
         9364  +} {/*malformed database schema*/}
  9365   9365   
  9366         -breakpoint
  9367   9366   do_catchsql_test 63.3 {
  9368   9367     SELECT * FROM t1 WHERE b MATCH 'thead*thead*theSt*';
  9369         -} {0 {}}
         9368  +} {/*malformed database schema*/}
  9370   9369   
  9371   9370   sqlite3_fts5_may_be_corrupt 0
  9372   9371   finish_test
  9373   9372   

Changes to ext/fts5/test/fts5rank.test.

   157    157     )
   158    158     INSERT INTO ttt SELECT 'word ' || i FROM s;
   159    159   }
   160    160   
   161    161   do_execsql_test 5.1 {
   162    162     SELECT rowid FROM ttt('word') WHERE rowid BETWEEN 30 AND 40 ORDER BY rank;
   163    163   } {30 31 32 33 34 35 36 37 38 39 40}
          164  +
          165  +#-------------------------------------------------------------------------
          166  +reset_db
          167  +do_execsql_test 6.0 {
          168  +  CREATE VIRTUAL TABLE "My.Table" USING fts5(Text);
          169  +
          170  +  INSERT INTO "My.Table" VALUES ('hello this is a test');
          171  +  INSERT INTO "My.Table" VALUES ('of trying to order by');
          172  +  INSERT INTO "My.Table" VALUES ('rank on an fts5 table');
          173  +  INSERT INTO "My.Table" VALUES ('that have periods in');
          174  +  INSERT INTO "My.Table" VALUES ('the table names.');
          175  +  INSERT INTO "My.Table" VALUES ('table table table');
          176  +}
          177  +do_execsql_test 6.1 {
          178  +  SELECT * FROM "My.Table" WHERE Text MATCH 'table' ORDER BY rank;
          179  +} {
          180  +  {table table table} {the table names.} {rank on an fts5 table}
          181  +}
   164    182   
   165    183   finish_test