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 |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
00e9a8f2730eb7239bf7fd107c97c409 |
User & Date: | dan 2019-08-20 19:11:29.544 |
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: 4c01e0170e 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: 00e9a8f273 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: 75aec4fc88 user: dan tags: trunk) | |
Changes
Changes to ext/fts5/fts5_main.c.
︙ | |||
928 929 930 931 932 933 934 | 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | - + | ** handles here, rather than preparing a new one for each query. But that ** is not possible as SQLite reference counts the virtual table objects. ** And since the statement required here reads from this very virtual ** table, saving it creates a circular reference. ** ** If SQLite a built-in statement cache, this wouldn't be a problem. */ rc = fts5PrepareStatement(&pSorter->pStmt, pConfig, |
︙ |
Changes to ext/fts5/test/fts5corrupt3.test.
︙ | |||
763 764 765 766 767 768 769 | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | - + | | 4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 heck....optimize | end c13.db SELECT * FROM t1 WHERE t1 MATCH 'abandon'; }]} {} do_catchsql_test 13.1 { SELECT * FROM t1 WHERE t1 MATCH 'abandon'; |
︙ | |||
954 955 956 957 958 959 960 | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | - + | | 48: 01 00 00 10 10 04 02 02 00 00 00 00 00 00 00 00 ................ | 64: 70 00 00 00 00 00 00 00 00 00 00 00 70 00 00 00 p...........p... | end c16.db }]} {} do_catchsql_test 15.1 { INSERT INTO t1(t1) VALUES('integrity-check'); |
︙ | |||
3899 3900 3901 3902 3903 3904 3905 | 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | - + - + - + - + | | 448: 54 55 41 4c 20 54 41 42 4c 45 20 74 31 20 55 53 TUAL TABLE t1 US | 464: 49 4e 47 20 66 74 73 35 28 61 2c 62 2c 63 29 00 ING fts5(a,b,c). | 480: 00 00 39 00 00 00 00 00 00 00 00 00 00 00 00 00 ..9............. | 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. | end crash-fed6e90021ba5d.db }]} {} |
︙ | |||
4633 4634 4635 4636 4637 4638 4639 | 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 | - + - + - + | | 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................ | 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. | end null-memcmp-param-1..db }]} {} do_catchsql_test 37.1 { SELECT * FROM t3; |
︙ | |||
4890 4891 4892 4893 4894 4895 4896 | 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 | - + | | 4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62 ity-check....reb | 4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 uild....optimize | end crash-fd2a1313e5b5e9.db }]} {} do_catchsql_test 38.1 { UPDATE t1 SET b=quote(zeroblob(200)) WHERE t1 MATCH 'thread*'; |
︙ | |||
5322 5323 5324 5325 5326 5327 5328 | 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 | - + - + - + | | 4080: 67 73 7a 18 0b 03 1b 01 76 65 72 73 69 6f 6e 04 gsz.....version. | page 6 offset 20480 | 0: 0d 00 00 00 03 0f f2 00 0f fc 0f f7 0f f2 00 00 ................ | 4080: 00 00 03 03 02 01 03 03 02 02 01 02 02 01 02 09 ................ | end crash2.txt.db }]} {} |
︙ | |||
5785 5786 5787 5788 5789 5790 5791 | 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 | - + | | 0: 0d 00 00 00 03 0f f2 00 0f fc 0f f7 0f f2 00 00 ................ | 4080: 00 00 03 03 02 01 03 03 02 02 01 02 02 01 02 09 ................ | end 89028ffd2c29b679e250.db }]} {} do_catchsql_test 43.1 { INSERT INTO t1(t1) VALUES('optimize'); |
︙ | |||
6043 6044 6045 6046 6047 6048 6049 | 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 | - + | INSERT INTO t1(t1, rank) VALUES('merge', 5); INSERT INTO t1(t1, rank) VALUES('merge', 5); INSERT INTO t1(t1, rank) VALUES('merge', 5); INSERT INTO t1(t1, rank) VALUES('merge', 5); INSERT INTO t1(t1, rank) VALUES('merge', 5); INSERT INTO t1(t1, rank) VALUES('merge', 5); INSERT INTO t1(t1, rank) VALUES('merge', 5); |
︙ | |||
6261 6262 6263 6264 6265 6266 6267 | 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 | - + | | 4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62 ity-check....reb | 4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 uild....optimize | end crash-1ee8bd451dd1ad.db }]} {} do_catchsql_test 46.1 { SELECT snippet(t1,'[','', '--',-1,10) FROM t1('*'); |
︙ | |||
6414 6415 6416 6417 6418 6419 6420 | 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 | - + - + | | 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................ | 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. | end 4b6fc659283f2735616c.db }]} {} do_catchsql_test 47.1 { INSERT INTO t1(t1) VALUES('integrity-check'); |
︙ | |||
7126 7127 7128 7129 7130 7131 7132 | 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 | - + | | 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................ | 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. | end crash-2b92f77ddfe191.db }]} {} do_catchsql_test 52.1 { SELECT fts5_decode(id, block) FROM t1_data; |
︙ | |||
7342 7343 7344 7345 7346 7347 7348 | 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 | - + | | 4080: 00 00 03 03 02 01 03 03 02 02 01 02 02 01 0c e9 ................ | end crash-dbe9b7614da103.db }]} {} do_catchsql_test 53.1 { WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x<>1 FROM c WHERE x<10) INSERT INTO t1(a) SELECT randomblob(3000) FROM c; |
︙ | |||
7558 7559 7560 7561 7562 7563 7564 | 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 | - + | | 0: 0d 00 00 00 03 0f f2 00 0f fc 0f f7 0f f2 00 00 ................ | 4080: 00 00 23 03 02 01 03 03 02 02 01 02 02 00 f2 09 ..#............. | end crash-03a1855566d9ae.db }]} {} do_catchsql_test 54.1 { SELECT rowid==-1 FROM t1('t*'); |
︙ | |||
7773 7774 7775 7776 7777 7778 7779 | 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 | - + - + | | 0: 0d 00 00 00 03 0f d6 00 0f f4 0f e9 0f d6 00 00 ................ | 4048: 00 00 00 00 00 00 11 03 02 2b 69 6e 74 65 77 72 .........+intewr | 4064: 69 74 79 2d 63 68 65 63 6b 09 02 02 1b 72 65 62 ity-check....reb | 4080: 75 69 6c 64 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 uild....optimize | end crash-b366b5ac0d3887.db }]} {} |
︙ | |||
8009 8010 8011 8012 8013 8014 8015 | 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 | - + | # may return SQLITE_CONSTRAINT instead of SQLITE_CORRUPT. This is because # the corrupt db in the test over-reads the page buffer slightly, with # different results depending on whether or not the page-cache is in use. if {$res=="1 {constraint failed}"} { set res "1 {database disk image is malformed}" } set res |
︙ | |||
8127 8128 8129 8130 8131 8132 8133 | 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 | - + | | 4064: 64 11 02 02 2b 69 6e 74 65 67 72 69 74 79 2d 63 d...+integrity-c | 4080: 68 65 63 6b 0a 01 02 1d 6f 70 74 69 6d 69 7a 65 heck....optimize | end x.db }]} {} do_catchsql_test 57.1 { INSERT INTO t1(t1) VALUES('optimize') |
︙ | |||
8335 8336 8337 8338 8339 8340 8341 | 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 | - + - + | | 4064: 00 00 00 00 00 00 00 00 00 00 00 08 03 15 01 70 ...............p | 4080: 67 73 7a 18 0b 03 1b 01 76 65 72 73 69 6f 6e 04 gsz.....version. | page 6 offset 20480 | 4080: 00 00 23 03 02 01 03 03 02 00 00 00 00 00 00 00 ..#............. | end crash-5a5acd0ab42d31.db }]} {} |
︙ | |||
8944 8945 8946 8947 8948 8949 8950 | 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 | - + - + - + | | 4080: 06 02 03 00 12 06 01 01 06 01 03 00 12 06 01 01 ................ | page 7 offset 24576 | 0: 0a 00 00 00 01 0f f4 00 0f f4 00 00 00 00 00 00 ................ | 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. | end crash-e5fa281edabddf.db }]} {} |
︙ | |||
9155 9156 9157 9158 9159 9160 9161 | 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 | - + | | 4080: 00 00 00 00 0b 03 1b 01 76 65 72 73 69 6f 6e 04 ........version. | end crash-44942694542e1e.db }]} {} do_catchsql_test 62.1 { WITH c(x) AS (VALUES(false) UNION ALL SELECT x+1 FROM c WHERE x<72) INSERT INTO t1(a) SELECT randomblob(2829) FROM c; |
︙ | |||
9353 9354 9355 9356 9357 9358 9359 | 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 | - + - + - - + | | 4064: 00 00 00 00 00 00 00 00 00 00 00 08 03 15 01 70 ...............p | 4080: 67 73 7a 08 0b 03 1b 01 76 65 72 73 69 6f 6e 04 gsz.....version. | end crash-8230e6c3b368f5.db }]} {} do_catchsql_test 63.1 { SELECT * FROM t1 WHERE b MATCH 'thead*thead*theSt*'; |
Changes to ext/fts5/test/fts5rank.test.
︙ | |||
157 158 159 160 161 162 163 164 165 | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | + + + + + + + + + + + + + + + + + + | ) INSERT INTO ttt SELECT 'word ' || i FROM s; } do_execsql_test 5.1 { SELECT rowid FROM ttt('word') WHERE rowid BETWEEN 30 AND 40 ORDER BY rank; } {30 31 32 33 34 35 36 37 38 39 40} #------------------------------------------------------------------------- reset_db do_execsql_test 6.0 { CREATE VIRTUAL TABLE "My.Table" USING fts5(Text); INSERT INTO "My.Table" VALUES ('hello this is a test'); INSERT INTO "My.Table" VALUES ('of trying to order by'); INSERT INTO "My.Table" VALUES ('rank on an fts5 table'); INSERT INTO "My.Table" VALUES ('that have periods in'); INSERT INTO "My.Table" VALUES ('the table names.'); INSERT INTO "My.Table" VALUES ('table table table'); } do_execsql_test 6.1 { SELECT * FROM "My.Table" WHERE Text MATCH 'table' ORDER BY rank; } { {table table table} {the table names.} {rank on an fts5 table} } finish_test |