Commit Graph

2683 Commits

Author SHA1 Message Date
dan
e25646d64c Avoid an integer overflow in the fts5 snippet() function triggered by a corrupt database record.
FossilOrigin-Name: 7c862c4655841e1263cf548d01f5b4331685ab7d396494891cad0a5f50c63e16
2019-01-29 16:34:45 +00:00
dan
eb2ed10ec0 Avoid a crash when the fts5 snippet() function (or similar) is used with a special query pattern, like '*id' or '*reads'.
FossilOrigin-Name: 9d58a15737f7379fed724749cfd5b4de5b44231870e99fc664683ad483c3e6ba
2019-01-29 15:30:03 +00:00
dan
3993397e6c Fix a buffer overrun triggered by a merge operation on a corrupt fts5 database.
FossilOrigin-Name: 7ee3cd5b2cdf8db35f70400b3df58f7c421c78ae77c50f22b0ee22d5a3039429
2019-01-29 11:42:43 +00:00
dan
c7def600bd Fix a buffer overread in fts3 that could occur when accessing a corrupt database.
FossilOrigin-Name: a9faf9033910927c74553e66c474d84ed3386f263cef3eec299e25d8306f410d
2019-01-28 16:50:42 +00:00
dan
6c43dbad98 Do not assume that text parameters passed to fts4aux queries do not contain embedded nul characters.
FossilOrigin-Name: df04859a995571cd6faf1abe088725708f35e81195760274df9e2ec9bd47f69f
2019-01-28 13:27:25 +00:00
dan
32bb700a95 Fix a broken assert() in fts3. Also some test script issues causing failures with builds that do not support fts3.
FossilOrigin-Name: d59567dda231e7ffec437d5e055676cf42d791196406cdc696cafa2583eb483b
2019-01-26 21:05:54 +00:00
drh
0578084507 Fix the assert_fts3_nc() macro so that it works for test builds that omit
SQLITE_DEBUG.

FossilOrigin-Name: b10df2b569e356551cf51ca179f307e4f8827413ee9feb886db1f1e0650e6c5f
2019-01-25 18:17:03 +00:00
dan
e88609f23e Fix asan warnings in fts5 triggered by corrupt databases - passing NULL to memcmp, out-of-range left-shift values and signed integer overflow.
FossilOrigin-Name: 93f8ec146d63af13f04e337ada4fa75e9254f72b1394df09701ae12e185f27e2
2019-01-25 16:54:06 +00:00
dan
c1f6618217 Add an assert_fts3_nc() macro to fts3 - for assert() conditions that are only true when it is guaranteed that the fts3 database is not corrupt.
FossilOrigin-Name: 3498908cd7f3d0e35b70796537124e3da0bd99d48750ba51bcb9eba87e28ed4d
2019-01-25 14:48:18 +00:00
dan
813ed78054 Fix a buffer overread in fts3 that could occur in a prefix query on a corrupted database.
FossilOrigin-Name: d0d5689371577b2861d4a9464443d055f3256f3f51d89e0388233a4cbe2601ee
2019-01-24 17:41:12 +00:00
dan
f8f47dd8c5 Fix another fts5 crash that can occur if the database is corrupted.
FossilOrigin-Name: 44ce8baa47192be03c8f11777904c3c07fa5cc5c97b6d8e81572d380995ac688
2019-01-23 19:17:05 +00:00
dan
4c7bdd1597 Fix a buffer overwrite triggered by a prefix query on a corrupt fts5 table.
FossilOrigin-Name: 1d8172a94bce2d067027685e5aa1dc8f5d5d55b5da0832ad2836f6939de68c8f
2019-01-23 12:19:22 +00:00
dan
ccfa550922 Fix a buffer overrun that could occur in fts5 if a prefix query is made on a corrupt database.
FossilOrigin-Name: 1abc4415648e69362061e9f9a4f2c1d419ba33801999b377650d8b9a4d2d3a7c
2019-01-22 21:17:40 +00:00
dan
2c7a73eaea Fix another segfault caused by a corrupt fts3 database.
FossilOrigin-Name: ba3b8412726548a0716c1a2d67260c3b7e31956474f4cd4ce607cf2cebc667dd
2019-01-22 12:21:28 +00:00
dan
129371553c Avoid deferencing a freed pointer following an OOM or SQLITE_CORRUPT error in
the fts3 xDestroy method.

FossilOrigin-Name: 505ed9a47825240979338a24044559613fbbd2a7850bdff70c7164da054ec63d
2019-01-21 17:57:31 +00:00
dan
ac30553f76 Remove a faulty assert() from fts3.
FossilOrigin-Name: 6c33a303ebbb0f5193ead535280ba63118e14fb4f9977ce80dc716a0b082ec99
2019-01-21 16:12:20 +00:00
drh
50b910a8b5 Add the --memtrace option to the CLI.
FossilOrigin-Name: a1e12fa2a8eb5648a96cc2d8d39899d6f87c5e2269cec7de486964c8b915e724
2019-01-21 14:55:03 +00:00
dan
27a037354c Avoid a division-by-zero error in fts5 caused by a corrupt database.
FossilOrigin-Name: 928e622178bd004be52b2271ac554176aebe9d6e115ecac4e7072eccbb4262b5
2019-01-19 15:55:27 +00:00
dan
225b05795f Fix a memory leak introduced by [55c5d72a].
FossilOrigin-Name: fbd681dce2905d8b8ad7948ba684b0b62d6c04be0f7a2992ee7d6836a99010de
2019-01-18 21:17:08 +00:00
dan
6e0a75a2b8 Fix a crash in the fts5vocab module caused by including a "term < NULL" term
in a WHERE clause.

FossilOrigin-Name: 9e717c4377c0116a5d36815fbc30f8b8803f14770d30be361feb27cc5b5b537b
2019-01-18 21:12:32 +00:00
dan
a86b20820d Fix an infinite loop caused by a corrupt database in fts3. Also an undefined
left-shift in fts5.

FossilOrigin-Name: 55c5d72af9510e2f27c33544d804a58d4282b0efb384ead38484129ce91b574f
2019-01-18 21:03:15 +00:00
dan
4c1c79035f Avoid passing a NULL pointer to memcpy in fts5, even if the database is corrupt.
FossilOrigin-Name: acccc9808f52009b2c7794770c8b7efe2ce861fa184d32e287e7114c74e2b522
2019-01-18 20:15:02 +00:00
drh
d00ad9a656 Typecasts added to the GeoPoly extension to avoid harmless UBSAN warnings.
FossilOrigin-Name: a1f6a093ac4a2de8c5b02c30fe57e09770460fd5bdddfe9c7a9a24fb83a6b491
2019-01-18 19:33:56 +00:00
dan
451297752c Fix problems causing undefined left-shift operations in the fts3 snippet()
function.

FossilOrigin-Name: b90dbaed3092236e97f9796fa63989a3648060e16189e1267c430f4a7e799fac
2019-01-18 19:26:48 +00:00
drh
ed968fa4cb Avoid integer overflow when computing the array of a bounding box with
the rtree_i32 virtual table.

FossilOrigin-Name: b352f1590d20a574b0681e011ececcf4f41fa5b157503d330e03939404aca0e9
2019-01-18 18:52:17 +00:00
dan
934d4f7bac Fix another corruption related crash in fts5.
FossilOrigin-Name: 4538d9afe4e6360e20c7b474e77314e5ad293453e1edbe356bf6ea84c05857ee
2019-01-17 20:06:56 +00:00
dan
f66da6ce8e Fix a buffer overwrite that could occur when running an fts5 prefix query
against a corrupt database.

FossilOrigin-Name: 3910b5639d5c96d1840d4feeea64d3a55073531b7365a4e75d9cda6f119f3cfc
2019-01-17 19:11:10 +00:00
dan
25fb50674f Fix problems with joining two or more fts5_vocab tables that access the same
underlying fts5 table.

FossilOrigin-Name: 49956395e14b61f6bf839e59ae7dd95eb32ebf32f3d16388844de6621b9c2d98
2019-01-17 17:39:15 +00:00
drh
30fdb45da0 Ensure that the variable-length integer decoder in FTS3 never tries to
left-shift a negative number.

FossilOrigin-Name: 10ffc1fe006a1766ff2f1ffc6129786afb86b6b1f8d3a17334e8ecb838d37b9c
2019-01-17 03:43:38 +00:00
dan
e011ee2830 Fix a problem in the fts3 matchinfo() function with corrupt database handling.
FossilOrigin-Name: 24ed5fb6aea30b098d2faf3cf9d638933e518657217e903239ffaa1e25d34f66
2019-01-16 19:44:09 +00:00
dan
4ccb41fc99 Fix a memory leak that could occur in fts3 when handling a corrupt database.
FossilOrigin-Name: 65cebb06a0afcbcb4157c3d518a62ed188b1e90d9e9b69d88fece484bcb6e380
2019-01-16 11:38:06 +00:00
dan
1a39d2bb5c Handle SQL NULL values without crashing in the fts5 snippet() and highlight()
functions.

FossilOrigin-Name: a5e9cc794f17566160c4b2b5791601a744a21ace987b19ff8a5816fd78dce56a
2019-01-15 18:14:27 +00:00
dan
a783931794 Fix a buffer overread in fts3 caused by a corrupt record.
FossilOrigin-Name: e54efd60c20bbfc5d70ddb9e1dd6ffb68cbbcfa57b4f07cb104767ef08c1a559
2019-01-15 16:14:31 +00:00
dan
2d4e720579 Have fts5 reject attempts to insert a non-integer, non-null value into a rowid
column with SQLITE_MISMATCH.

FossilOrigin-Name: 4a9483f81e9ca1aa41d6ca33cb3171370418ccc71fdee9741bbf6f694bf4fbaa
2019-01-15 15:18:58 +00:00
dan
58ed374370 Fix a problem triggered by DELETE statements with WHERE clauses that use the
OR-optimization on some virtual tables.

FossilOrigin-Name: ecf5caa7e9825a8b03d15ee525ec68be78c55926ddfaca27a040a7614caf0e85
2019-01-15 14:31:01 +00:00
dan
9c039d9f2e Add scalar function "prefix_length()" to ext/misc/prefixes.c.
FossilOrigin-Name: 0bf1550507d9d3c8a41f8a50db3a59bf808f0a4e24637dc0905d35579305eca7
2019-01-14 20:44:00 +00:00
drh
4ead96348e Add the "prefixes" table-valued function in the ext/misc folder.
FossilOrigin-Name: f0fd2163fc23a555ef03af43294a14fcabae6921f52e64c979286c745b4f6218
2019-01-14 16:16:30 +00:00
dan
f8a488bb6b Fix a problem causing a crash if an fts5vocab table was created to query an
fts3/4 FTS index.

FossilOrigin-Name: 9cd64ce453e4435d80117b8610c22a0a4b53cd6e84b39815e70e684f6b0295c8
2019-01-14 15:35:15 +00:00
dan
94ec92a1f7 Fix a problem with querying a corrupt fts3 database.
FossilOrigin-Name: 65e50706a017751d72d0f9c7f575955194977decd0acf13aaca90c3cb925f20e
2019-01-14 15:09:00 +00:00
dan
68c1f9ce9a Have fts3 ignore empty sets of parenthesis if built with
SQLITE_ENABLE_FTS3_PARENTHESIS.

FossilOrigin-Name: c93c6b45a317c40eb5c0abb6620d21f5821a601632c791e11e5ce62e039eccda
2019-01-14 11:56:13 +00:00
dan
951d165125 Fix another problem with handling corrupt records in fts5_decode().
FossilOrigin-Name: 726e398b9ddc15ea1b67c40e2a12ddf5d04428a866699588c5fa1af75af846e1
2019-01-12 20:55:36 +00:00
dan
b4439eef10 Fix a problem with corrupt database handling in the fts3 matchinfo() function.
FossilOrigin-Name: 703646b1b5c84d550fe0d74e399c0eeb729da1d263e4693320f69e6509678985
2019-01-12 14:58:35 +00:00
drh
5d4589014a Improved detection of shadow table corruption in the fts5_decode() SQL function.
FossilOrigin-Name: b74e5f3f3057ee7a98ebcb14ca0751048eacbec8fca3e11e241883029a57ecdf
2019-01-12 00:45:20 +00:00
drh
3e534eac19 Improved shadow table corruption detection in the matchinfo() function of FTS3.
FossilOrigin-Name: 567be3bb1e8b6477f3bf1c7b4cd6ec066fba69d0dcf8785632e244ce25db639f
2019-01-12 00:12:33 +00:00
drh
73bce66701 Use 64-bit APIs in the fileio.c extension.
FossilOrigin-Name: b49d56a0faf012978c50fb8662125ea21bdf5054fddf5975644cbc941c153e70
2019-01-11 23:08:56 +00:00
dan
90294961da Fix a segfault in fts3 prompted by a corrupted database.
FossilOrigin-Name: 2d7b1d1d41ff69d5465fcb861420816ecb066c25a9015eefdab5fae15a2e1c9f
2019-01-11 21:34:25 +00:00
dan
0ad63e5e0c Fix another problem with corrupt databases in fts5.
FossilOrigin-Name: 9bf811ea89a133d481a86407683a7518e909eccb7aa3aa02f7932bdb33387572
2019-01-11 19:27:55 +00:00
dan
e6370e9c29 Fix a problem handling a negative value in the "number-of-pages" database
header field. Also a problem with running "REINDEX tbl" against a virtual
table for which the SQL passed to sqlite3_declare_vtab() contains PRIMARY KEY
or UNIQUE constraints.

FossilOrigin-Name: 556dd8922f65af93084ee725c638b8dc696b611dd508c212a3b507d6ca474031
2019-01-11 17:41:23 +00:00
drh
1735f91df4 Improved detection and reporting of errors in the readfile() extension SQL
function.

FossilOrigin-Name: d2f0b5a483869d39f5c5814c9d6df3d3b8a46d582b4dcf0cf11e23b707c4213e
2019-01-11 17:20:25 +00:00
dan
6ca98ad6b1 Fix a memory leak in fts5 that could occur if scalar function fts5_decode()
was passed a corrupt record.

FossilOrigin-Name: 240f1c0c92cad8a1c19438b38489aedb831f62a4603c53f22367e876d8f644ff
2019-01-10 19:26:52 +00:00
dan
f7d687c9d3 Fix a memory leak in fts5.
FossilOrigin-Name: ff3b011f17f4f02e486f3c8de607f62eddf3b86562e2df82dba57ea166994b65
2019-01-10 18:35:09 +00:00
dan
25e3073741 Avoid use-after-free and double-free errors that could occur if an fts5 table
is modified in certain ways while there are active cursors.

FossilOrigin-Name: 3291b2a6fe6f38ae91b933e5cd2bf7d97432374b4fb1fccd92b4bd759b02ee06
2019-01-10 17:08:20 +00:00
dan
c80864d77a Fix further problems with fts5 handling corrupt databases.
FossilOrigin-Name: 83c467d7af63bd2e7800aff4fe9b09dbd75557460b75a9e07205dfae7e28312c
2019-01-10 15:17:32 +00:00
drh
c49d43a787 Fix the fts3DecodeIntArray() function so that it will not read off the end
of the buffer it is handed.  Any unread integers are set to zero.

FossilOrigin-Name: 666cf8f6b39ae1f72e82b45e9cacba23caf61370ca0c695b3b14452accbb1a0d
2019-01-10 01:12:43 +00:00
dan
a47e45f734 Fix an out-of-bounds read in SQL function fts5_decode() that could occur if it
was passed a corrupt record.

FossilOrigin-Name: 931278b257b12ac14fc8fbc82c6dc88ce4ac4b8e0d668543e68f0289d825daa1
2019-01-09 21:12:23 +00:00
drh
2d77d80a65 Use 64-bit math to compute the sizes of memory allocations in extensions.
FossilOrigin-Name: ca67f2ec0e294384c397db438605df1b47aae5f348a8de94f97286997625d169
2019-01-08 20:02:48 +00:00
drh
c0f162020e Fix a possible memory leak when trying to UPDATE a corrupt RTREE index.
FossilOrigin-Name: 63eb803dbc27077007dbee8def659d1523724eb73f1def1cdb68027e5c20843a
2019-01-08 14:28:02 +00:00
dan
174c21ff06 Fix further problems with fts5 and corrupt databases causing integer overflow.
FossilOrigin-Name: 673a7dd698eca05bb2909fa01f962a0667361732a6d0e61cf7780ead4a07c967
2019-01-08 08:02:12 +00:00
dan
d9d7d253fc Fix another potential buffer overread in fts5.
FossilOrigin-Name: d0e943d9574c7cab1af4a0fe753a0b5f91ea0e884b91a85b13239144b71f067c
2019-01-07 16:52:00 +00:00
dan
418454c63f For SQLITE_ENABLE_PREUPDATE_HOOK builds, disable the optimization for a
REPLACE command on a WITHOUT ROWID table with no indexes, triggers or foreign
key constraints that causes SQLite to clobber any existing row without
separately checking for it. This optimization causes SQLite to omit the
expected pre-update-hook callbacks.

FossilOrigin-Name: 6281ef974c0ac7a7133c9e1e04c09fdbd627c019c6ff3227293548caf8283864
2019-01-07 15:57:35 +00:00
dan
c210c08891 Fix two more problems with corrupt database handling in fts5.
FossilOrigin-Name: 444c7c99beb9f8b82963e9784aa2be54124c7011f4771122b4f608c02aa26408
2019-01-05 07:17:56 +00:00
dan
2f36262dbf Fix another fts5 assert() that may fail if the database is corrupt.
FossilOrigin-Name: 0888fc2e881d56ccd5222383d1a08cdf16fbd15c40da7ebfc14346be69ffb26a
2019-01-04 11:20:14 +00:00
dan
e9ad07c0a3 Fix some problems with sqlite3_interrupt() handling in fts5.
FossilOrigin-Name: c0eb839a3c23612b93002d2e1fbc41bf5db140775267989f85db52146144750b
2019-01-03 19:12:21 +00:00
drh
20c0082371 Fix a harmless compiler warning in the CSV extension.
FossilOrigin-Name: fbcd72565f4425016cebbbf5dfd6aa510234cfb31c785cf364f04fff444aacae
2019-01-03 15:22:33 +00:00
dan
0d756cc83a Fix a problem with the second and subsequent sqlite3rbu_savestate() calls made
on an RBU vacuum handle.

FossilOrigin-Name: bef216dfa1456a787e3d9c74936ee1c6600827d4e252bd13e7a93046ce07469f
2019-01-03 15:17:01 +00:00
drh
232f278084 Fix the geopoly_svg() function so that it returns NULL when given zero
arguments.

FossilOrigin-Name: 120cb1768338eb86412fb69d4c7677247775bb37875ab3a98766cffd535f04cf
2019-01-03 00:44:03 +00:00
drh
8fc4a11c94 Fix harmless compiler warnings in the unicode2 logic of FTS3 and FTS5.
FossilOrigin-Name: 703029ac6d24860230a8c30fcbf5e7e1da619e84f1cc9b9e65ebc74879a184d2
2019-01-02 23:49:47 +00:00
dan
9b0da8319c Fix another fts5 problem caused by a corrupt database.
FossilOrigin-Name: 911342f7512145a8a189bb0ec59e70e4c9ddc9f20f3e84816ab25139ead5dc45
2019-01-01 19:17:42 +00:00
dan
fff1dc8e05 Fix another case in fts5 where a corrupt database could cause a buffer
overread.

FossilOrigin-Name: f7e6cdc5625664f449d0edbe39af2d45910c4137bfd856ae1f770dd826c138ff
2019-01-01 13:59:34 +00:00
drh
f9231c34eb Fix harmless compiler warnings.
FossilOrigin-Name: b57c545a384ab5d62becf3164945b32b1e108b2fb4c8dbd939a1706c2079e18b
2018-12-31 21:43:55 +00:00
drh
64919e9b00 Merge patches and enhancements from trunk.
FossilOrigin-Name: da53f3d3ff26cc32d3a5ac788b6785baa3d1688e50d9354025a3130dc7e71a38
2018-12-28 19:23:20 +00:00
dan
4177c8a2b7 Fix another problem with loading the structure record from a corrupt fts5
database.

FossilOrigin-Name: c4d44542d259bbec11aea60ae94fcb4acd53e97e125723cae078cf0f8873f8ef
2018-12-28 18:09:45 +00:00
dan
eefc72d12f Avoid an undefined left-shift operation in fts5 caused by malformed utf-8
text.

FossilOrigin-Name: c3a3a11194586bef80a9d7ca54caae8af30d4e7b464b8bb3d257ba2d2ec4791f
2018-12-28 14:33:55 +00:00
dan
666636b6de Fix a buffer overwrite in fts5 triggered by a corrupt database.
FossilOrigin-Name: a385298df264dbfa6765f63ad8708f74bc8e8a1404239c1049890b39a1bda888
2018-12-28 13:57:30 +00:00
dan
b163b57212 Fix problems in fts5 found by ASAN.
FossilOrigin-Name: c564bf870106faef297594a51995619c80311d06bd5f8a0c7644f666f22ba576
2018-12-28 07:37:22 +00:00
dan
593c716781 Fix another problem with corrupt database handling in fts5.
FossilOrigin-Name: fb0d7fba07865ff557bfcdacfda7b625d099ac8b4dcbe0c08cd2d4b84a068bb9
2018-12-27 20:12:02 +00:00
dan
e80834f6ff Fix another problem in fts5 caused by a corrupt schema record.
FossilOrigin-Name: ff45f9dd69fe1e1c7875e5bb73ac3dde2a31746475d3765cda9233f8e06e26ca
2018-12-27 15:36:16 +00:00
dan
cd80dc3667 Fix a null-pointer dereference that could occur in fts5 with a corrupt
database.

FossilOrigin-Name: b0a49d5e6df116bb5eacb60a0bb0f482760aec38bd417d4250d9e57d43bdbb13
2018-12-27 07:46:37 +00:00
dan
0f55a571fc Avoid an "unitialized value read" problem in fts5 that can occur with a
corrupt database.

FossilOrigin-Name: 6cae81cd1ffb0180e0260d5ba921502c7dee2f54637bff3558a4d1cb5dfd3f32
2018-12-26 16:57:47 +00:00
dan
c2909bf8ac Fix a problem with handling corrupt databases in the fts5 integrity-check
function.

FossilOrigin-Name: 9bad745d373f4686a2726c3f77a2ccad60e7181645d7ed483a2e43075a4ef30c
2018-12-26 16:04:54 +00:00
dan
d8f3b4c320 Fix a problem with corrupt fts3 database detection introduced by [95a9a39f].
FossilOrigin-Name: c80bb15b44e9b6a3c0c5a49d5e93e66376c3520ecefc1db7425c8a7e09d3eade
2018-12-26 14:15:09 +00:00
drh
8625221444 Fix a problem with the CSV extension when it uses the "header" option on
a real file.

FossilOrigin-Name: 7acaed08f946633fca3ab8434dd6349ea6f1bac4fd9ec21f476db013ee06de30
2018-12-26 12:50:47 +00:00
drh
e4c26c41b4 Fix a typo in a comment that is used to generate session documentation.
FossilOrigin-Name: a1f50d57ce76f6c08a0ddbdd3c3fe2732d0e57dda14cb9aa3da00a14ceb4bc44
2018-12-25 11:17:50 +00:00
drh
bd462bcc10 Improvements to EXPLAIN QUERY PLAN formatting. The MULTI-INDEX OR now shows
a separate "INDEX" subtree for each index.  SCALAR SUBQUERY entries provide
a subquery number that is related back to the .selecttrace output.

FossilOrigin-Name: 7153552bac51295c56a1c42ca79d57195851e232509f9e9610375692f48c7e86
2018-12-24 20:21:06 +00:00
dan
1ab76166e3 Change another fts5 assert() that may fail with a corrupt database to an
assert_nc().

FossilOrigin-Name: d9653380c455b4bf6c371540d677cbde6d17664c58662b5cc9a12929f46192dd
2018-12-24 19:59:37 +00:00
dan
29e9af8848 Change the way a comparison used to detect corrupt databases in fts3 is done
to avoid potential pointer overflow in 32-bit builds.

FossilOrigin-Name: 95a9a39ff784b960b62dd6298e722a620ba3f9c8b76839a49bbef35d7bc84a8e
2018-12-24 13:34:36 +00:00
dan
6a509d56bc Catch another case of a corrupted structure record in fts5.
FossilOrigin-Name: fb17fea4b9779fbd3adb6ff9500da83a6ca4fa7cba379aa70074e4328814a7f2
2018-12-22 19:54:17 +00:00
dan
862faf28bb Change a faulty assert() in fts5 that could fail on a corrupt db to an if() statement.
FossilOrigin-Name: 1daaba9fb46706af8ed0669a661c304df999a69cf639d29d93208f422c515d8c
2018-12-22 19:09:46 +00:00
drh
11d07ed643 Fix one more instance of excess whitespace in test result strings.
FossilOrigin-Name: c064964deb0b7220ba784f07ca9c603680f3c8bb936d56ab4eca1962beac1359
2018-12-22 16:14:45 +00:00
drh
3a07548b0d Remove unnecessary whitespace from testcase result strings.
FossilOrigin-Name: ad70f03ceda74163903d247a975666b35fae722a27c48dd3efd31c1164b5627e
2018-12-22 15:46:23 +00:00
dan
b63d6070ee Fix an assert() in fts5 that could fail with a corrupt database.
FossilOrigin-Name: 83935b950619855fb3bf05486091804ac2a61fb993c6ec826c89f943264fabc3
2018-12-22 15:21:31 +00:00
dan
634ac14488 Fix a "jump or move depends on uninitialized value" valgrind error that could
occur in fts5 when dealing with a corrupt database.

FossilOrigin-Name: 3518c09b944c92974939b1de244401afd34de5d9aa75050e5ad55581a94e1e71
2018-12-22 13:34:52 +00:00
dan
fb11bf8c91 Avoid a left-shift of a negative value (undefined behaviour) when dealing with a corrupt database in
fts3.

FossilOrigin-Name: b851d12474035328df8354c7da8d81bc78833c8c704153f9f573c19b47a8487e
2018-12-22 09:39:06 +00:00
drh
cde4bf8ba7 Improved detection of shadow table corruption in RTREE.
FossilOrigin-Name: b39bf4356e6bcf1d8442721d6cbbfe06caba01325104fb469da8fe69e1f623a2
2018-12-21 22:08:59 +00:00
dan
deb201b866 Use SQLITE_PREPARE_NO_VTAB in rtree as well.
FossilOrigin-Name: 82a2ae7132964eab0dfad9a8314a399ffd3b72366b35e1767df6452125dd1d80
2018-12-21 19:55:20 +00:00
dan
38e3853240 Add tests for the use of SQLITE_PREPARE_NO_VTAB in fts5.
FossilOrigin-Name: 1999612010e310fc2430d1f00076f69fade0c66d202771dbb0f3d5597ac0a03c
2018-12-21 19:30:18 +00:00
dan
1ea0443c2d Add new sqlite3_prepare_v3() flag SQLITE_PREPARE_NO_VTAB, for preparing
statements that are not allowed to use any virtual tables. Use this to prevent
circular references in triggers on virtual table shadow tables from causing
resource leaks.

FossilOrigin-Name: 25666e3d03950caf753295cdb55df162e07dbcf6840b05875c6e0b127c469ecb
2018-12-21 19:29:11 +00:00
drh
afdc9e23fc In FTS3, avoid calling memcpy() with a NULL source pointer, even if the
transfer amount is zero bytes.

FossilOrigin-Name: 1abb83d29a06308c96bea379311b390240347c5f81824749348d18ad75840c96
2018-12-21 18:51:27 +00:00
drh
687e20079c Fix the node hash function in RTREE to ensure that it always returns a
non-negative value.

FossilOrigin-Name: 0bf4c70a6849da74797e8616a4f3730492ad02882ae67a0fe0f3b3cc3f1043b4
2018-12-21 18:17:35 +00:00
drh
273e01b4c6 Fix a potential NULL-pointer deference in RTREE due to corrupt shadow tables.
FossilOrigin-Name: 1fdd3604eef880414682e9e6f74d714520fe1c63f267ec4da752d2dc1da6bf72
2018-12-21 17:51:30 +00:00
drh
fb077f3c50 Prevent an infinite loop in rtree that can result from a corrupt shadow table.
FossilOrigin-Name: 085667180b230587abb82abfdd14da8859e23620994d5cf152236b64c756dd04
2018-12-21 16:53:58 +00:00
drh
1429eca9d4 Fix the RTree extension so that it correctly ignores constraints that it
does not understand, even if they are against a dimension column.

FossilOrigin-Name: ed8531e57596f0d5911a05a26d5ae61e1eccfaadee49219d7f6e212cac288238
2018-12-21 15:13:49 +00:00
drh
558ef11ad9 In RTREE, turn an assert() into an if() because the condition can
sometimes be false when dealing with a corrupt database.

FossilOrigin-Name: 99bce4358beb5dbaba47048ee2eec5c376dcd86e5b1462238a37ea4c5f3d77db
2018-12-21 13:30:34 +00:00
dan
e1e28ec35c Remove an assert() that could fail on a corrupt db from fts3_write.c.
FossilOrigin-Name: 4cdcda408a4edcd2845584ddef64f0efdd2b4cc030afbc05fc2b8b555c69d3f6
2018-12-21 11:53:43 +00:00
dan
bef06d2637 Fix errors in comments in fts5.h.
FossilOrigin-Name: 4002790d9418289f3e090c694f651a89d8f523119c8ce2f396999b0387148241
2018-12-15 07:12:34 +00:00
drh
3c2db5def6 Fix harmless compiler warnings.
FossilOrigin-Name: 27221c69901d2b4546167639c4a3c8f54b2e18820f1346870fa26b7c919027db
2018-12-14 18:11:02 +00:00
drh
fa94d492c8 Fix a harmless compiler warning in Sessions.
FossilOrigin-Name: fc9791ea987352e3e1322fbb7f833c23b402432af8249f9d397c6f7456788637
2018-12-14 13:47:17 +00:00
dan
dc6214ee39 Fix a problem with using "<db>-vacuum" (the default) as the state database
when resuming an RBU vacuum.

FossilOrigin-Name: c878d741733a897d47a1a0b57b454bc9095ce302b48cc01089336d5d20e2a24c
2018-12-10 08:41:32 +00:00
drh
f8c2fea195 Remove the unused sqlite3Fts5UnicodeNCat() function.
FossilOrigin-Name: 7149dacf1d440a19f62808b4591c3fa8da202b2ec742d5490a63f2ec005ff9e7
2018-12-03 17:40:46 +00:00
dan
e89feee5c3 Add the "remove_diacritics=2" option to the unicode61 tokenizer in both FTS5
and FTS3/4.

FossilOrigin-Name: 06177f3f114b5d804b84c27ac843740282e2176fdf0f7a999feda0e1b624adec
2018-12-03 16:14:49 +00:00
drh
1ba88c7f1d Fix a typo in a comment. No changes to code.
FossilOrigin-Name: 23684cb841ac2cb0d69e5470253bd96feb733762a7553b952a08470834fe85fa
2018-11-30 20:59:00 +00:00
drh
f7c44f9bd2 Fix the name of the trig function approximation in geopoly. No functional
changes to the code.

FossilOrigin-Name: 33576b12b450a37b467ba012e77b297eb80d7147b12a5b23302009bb32455720
2018-11-29 12:00:02 +00:00
dan
bcdef69482 Add an "#ifndef SQLITE_DISABLE_FTS4_DEFERRED" block around function
fts3EvalDeferredPhrase() in fts3 in order to silence a compiler warning.

FossilOrigin-Name: 6f4b0d0494446d46ac22b17650a25b025995cc545cac8fbc4776cf9dd388bcd8
2018-11-27 09:57:10 +00:00
drh
52f0c6205c Fix a bug in the geopoly_ccw() function. Test cases in TH3.
FossilOrigin-Name: 773c5c1d9c0ec40c51949c38c9dc17e778086f3f92791cca9b85288de0076dab
2018-11-24 20:44:46 +00:00
drh
20b3fc4db1 Add SQLITE_CONSTRAINT support to the xBestIndex methods on dbstat,
sqlite_dbpage, and zipfile.

FossilOrigin-Name: 5cd24e552b4fed71cfb2e37929371175682f23f1430df2900a87e6a5823d138e
2018-11-16 20:18:07 +00:00
drh
d16f26a708 Update the explain virtual table to make use of SQLITE_CONSTRAINT.
FossilOrigin-Name: b2d41ff7027b44ccb5dffc303c47d42f1f6fd66ce22e90450d3a666c73fe8b8e
2018-11-16 19:19:58 +00:00
drh
43579191e8 Fix the JSON table-valued functions to make use of SQLITE_CONSTRAINT.
FossilOrigin-Name: 3f34f4f561c77f8ec88906818f2984dcf8f17d1645bac175e9027595517560bc
2018-11-16 16:04:50 +00:00
drh
a69262c0f2 Add an assert() to the generate_series virtual table to verify
assumptions about the design.

FossilOrigin-Name: cd13b499a20a7d476edb8500537edef4c5151410ba0300469ebf0f7ba16964b8
2018-11-16 15:41:27 +00:00
drh
e4f90b7075 Update the generate_series() table-valued function to make use of the new
SQLITE_CONSTRAINT return from xBestIndex.

FossilOrigin-Name: 4372ad644dda5a1fa46b6b6070092320c835439b41f598cbc041e9deef786988
2018-11-16 15:08:31 +00:00
drh
32dcc847b5 Enhance the xBestIndex interface of virtual table so that if the xBestIndex
method returns SQLITE_CONSTRAINT then that particular combination of
constraints is considered unusable and does not participate further in
query planning.

FossilOrigin-Name: 684013cef6bfcfd920a4aec645df9f5d41ace8b34e75fca61759c1b4f82cc89e
2018-11-16 13:56:15 +00:00
drh
eabbf37fae Fix comments and make magic numbers into #defines in the fsdir
implementation.

FossilOrigin-Name: c537c9c3630ca979bdccab977275bfc11cce33ea54adb71a4bd4f46c85f65c6f
2018-11-16 13:06:30 +00:00
dan
cbfaa076d7 Fix a problem with virtual table "fsdir" and some join queries.
FossilOrigin-Name: 7fffcee0fc3fe8d036f0d93ec17673992c3edcf2bb454dc90d80142435b37946
2018-11-16 08:36:15 +00:00
drh
6f147c54ef Improvements to the CSV virtual table.
FossilOrigin-Name: 0406ecbbe75513e342040b71fdd342462222dbb3820486b5f745d7865805c00b
2018-11-16 01:42:26 +00:00
dan
2639ddc474 Fix a use-after-free problem in the fts5vocab virtual table.
FossilOrigin-Name: ac69d169c61c973448b1d3eef5b8ff0de2d932d7bb74068344cb1b79bd330578
2018-11-12 13:20:00 +00:00
drh
38fa8c9bb0 Add support for read-only shadow tables on virtual tables. Added the
SQLITE_DEFAULT_DEFENSIVE compile-time option that can put SQLite in 
defensive mode by default.

FossilOrigin-Name: 9c685171c4d7ae8615d1489c9621aba79fe4ef1f0e56b75823b88c3e70d127df
2018-11-10 18:23:32 +00:00
dan
dbc1e9e6a8 Add tests and a fix for program "changesetfuzz".
FossilOrigin-Name: 09b90db56c2d5e3aceae59c6bf1eb07f9db9ef38da29d2162046b88d39e47b86
2018-11-08 14:59:51 +00:00
dan
5704f455b9 Fix minor issues in the changesetfuzz program.
FossilOrigin-Name: 5c7f024073bc93089f038b5cf122a7a9d5b933f7c1b357f6d20ae925739ffc38
2018-11-07 20:07:28 +00:00
dan
7844d21536 Update the "changesetfuzz" program to work with patchsets as well as
changesets.

FossilOrigin-Name: 75b00fbe884d4bd8ba099d7c0a2e8af2f40fedfdef2d9b624dd51cb66952611c
2018-11-07 17:52:29 +00:00
drh
6ab91a7a7a Add the SQLITE_DEFAULT_DEFENSIVE compile-time option. Fix up test cases
so that they work with DEFENSIVE enabled.

FossilOrigin-Name: 3212733cb6d1a59516d67a86df7c7b1d2456a1b2e5d7080c26b0e87b2609c65d
2018-11-07 02:17:01 +00:00
dan
005d4c61c1 Update the changesetfuzz program to fuzz changeset schemas as well as data.
FossilOrigin-Name: 141a93c843d501d8bb640228645ead0a83870c1c11e9d4b07ed24b296c69a0b8
2018-11-06 20:08:03 +00:00
drh
0f0d3ddf71 Enable DEFENSIVE mode by default for tests. This requires lots of case of
turning DEFENSIVE off in order to dodgy things to the database for testing
purposes.  No all of those cases are yet handled, so "make test" does not run
to completion.

FossilOrigin-Name: a1d6c6712c3304fd736077432c8c180692cf7d79be7f3a073510b6dab0eb951f
2018-11-06 19:26:04 +00:00
drh
aef15e74c8 Turn on defensive mode for running test scripts. Does not yet work.
FossilOrigin-Name: 1c1d24edbb732f2a2002a741c7a7afdd010b67e1b5e6d90ff36c6428897e7612
2018-11-06 15:57:59 +00:00
drh
fc25721c9e Only allow shadow table to be written from within a recursive SQL call.
Omit the SQLITE_PREPARE_SHADOW flag.  Some tests are failing because the
tests depend on being able to write to shadow tables.

FossilOrigin-Name: d890c6582524677666e6f5b5817331dec332ade16b2f744cbb8a3c7dd9b63e21
2018-11-06 14:03:07 +00:00
drh
84c501bac1 Initial code to make shadow tables read-only to ordinary SQL. The now
xShadowName method is added to the sqlite3_module object and is used
to identify potential shadow tables.  The SQLITE_PREPARE_SHADOW argument
to sqlite3_prepare_v3() is defined.  It is designed to permit writing to
shadow tables, but is currently an unused placeholder.

FossilOrigin-Name: 31942b3dd3f66eb0d9977bf1cadc2f2d7be7967cce2b55784be0b939dfef1985
2018-11-05 23:01:45 +00:00
dan
f095a1affb Add preliminary version of "changesetfuzz" program. For fuzzing changeset data
without creating corrupt changesets.

FossilOrigin-Name: 81ac8745faac0bda8d68ac113f1938f0e25208642e8ceb2af452680086454cb5
2018-11-05 20:37:33 +00:00
dan
29d77dc450 Add extra defenses against strategically corrupt databases to fts3/4.
FossilOrigin-Name: d44318f59044162e229a444582692e9788f17b5c404b4eb702f4c2114b22fefe
2018-11-03 16:51:30 +00:00
dan
b74cf4b6ea Update comments in sqlite3session.c to describe the format of "rebase blobs",
as well as changesets and patchsets.

FossilOrigin-Name: bf93f7b56b1d15682988daf3f1c293caf755433defdecd52ba8782fc40e92bd7
2018-10-30 19:14:16 +00:00
dan
dbe7d37ae8 In the sessions module, avoid collecting rebase data if the user has not
requested it.

FossilOrigin-Name: de72a773dd3ad58a7f2233e1fc06bf60deb8892a2719ea8e9b42e7d592c1279f
2018-10-29 17:08:27 +00:00
dan
1f48e67db1 Add the sqlite3session_config() interface. For configuring global parameters
belonging to the sessions module.

FossilOrigin-Name: 1e69f3ff057b0be27a9e79842de2485f8299799f309e89bfa7597dd688e0975b
2018-10-26 17:05:00 +00:00
dan
46de072880 Add the sqlite3changeset_start_v2() - a new version of _start() that accepts a flags parameter - and a streaming equivalent to the sessions module. Also add the SQLITE_CHANGESETSTART_INVERT flag, used with start_v2() to invert a changeset while iterating through it.
FossilOrigin-Name: cbedcb9aaefdfe00453efbdf0eac6c15e1f53bbe8fff2e7d534a5adf23be04f5
2018-10-20 13:48:09 +00:00
dan
9c18ef09a5 Take steps to avoid a potential integer overflow in sessionBufferGrow().
FossilOrigin-Name: f7affa2e708d1b4c7c47157bcb18e9f79611ca45a93ebc88de6dc96f84a677e7
2018-10-18 15:17:18 +00:00
dan
44748f27a6 Add the SQLITE_CHANGESETAPPLY_INVERT flag to sessions. For inverting and applying a changeset in a single step.
FossilOrigin-Name: d4b6406e7f5ba06ac73ab9fdef57232b2459e0af12420ed946ebed6aef46f0b1
2018-10-18 14:59:21 +00:00
drh
7dd630a893 Fix an issue with the new memstat.c extension.
FossilOrigin-Name: ce6e80b1303ed161bec2c63735cd2e2bea7b4e9b4ff780d214d408b1a30d50da
2018-10-08 20:04:16 +00:00
drh
5f8cb730af Replace the new geopoly_reverse() function with geopoly_ccw(). The
geopoly_ccw() function only reverses the vertex order if doing so is necessary
to get the correct right-hand winding rule on the polygon.

FossilOrigin-Name: 075066944b13b18d339ccf87ae16f0b91bf00f40bd70f71c6beba6aa6c43f0b6
2018-10-08 18:55:56 +00:00
drh
bc36320f02 Add the geopoly_reverse() function to the GeoPoly extension.
FossilOrigin-Name: 690dd18a5768c5a8cdfa92d5b01901c1a7b1fb6ebb90399f56a3112e41609f92
2018-10-08 12:58:59 +00:00
drh
bebf54438e Changes to geopoly to silience false-positive warnings coming out of clang.
FossilOrigin-Name: 11d9015f31d1ea2fd27174d4ceea08a145fdbb92a175bec0aae4b90f991694bc
2018-10-05 15:10:00 +00:00
dan
49f84ce1cd Speed up xAccess() calls made on an RBU VFS when there are lots of open
connections.

FossilOrigin-Name: 310b4b65b8c8ee080760c7efb4c7e20244c6063a5dba37a4f40490105aafd29f
2018-10-01 17:33:35 +00:00
dan
f8248c42f9 Have sqlite3changegroup_output_strm() call its output function more regularly.
FossilOrigin-Name: 8467c31aa0bf24e597f680748460a99f425c49f5ab741c3574c339aa56857146
2018-09-28 20:46:41 +00:00
drh
09b523c99b Fix a bug in the sqlite_memstat virtual table that was causing it to report
the amount of memory used as zero bytes.

FossilOrigin-Name: 8a758a872175b0c74e631c231240c5c733fbec708d0cff23eb9c4025e4a800ec
2018-09-28 18:51:18 +00:00
drh
60afcb80ee Add the geopoly_regular(X,Y,R,N) function to the geopoly extension.
FossilOrigin-Name: 4505bbae58357eacab262b642b2a56d6dd380de72faceb5bbfd042eb94a12c06
2018-09-28 14:01:17 +00:00
drh
601c8f2829 Make most geopoly functions pure.
FossilOrigin-Name: 944e167a98e995c5750c1fcd44df857d6b10c1cbb91731fad2849415c42b2cfc
2018-09-28 13:18:24 +00:00
drh
b2d83494d3 Rig geopoly to use sqlite3AtoF() if it is available, as that routine is much
faster than atof().

FossilOrigin-Name: 470c6c07d0eb70806ac257c1c8ad877e041bbc14ff9a5c490edb51b2956ae726
2018-09-28 00:16:57 +00:00
drh
17e65ae4c0 Small performance optimization in the JSON parser of Geopoly.
FossilOrigin-Name: fb520e71035258d5490be33ee28575df2caefa5d5a301c8bbdf1471551c96282
2018-09-27 23:57:45 +00:00
drh
50db3e8d51 Enhance the GeoPOLY extension so that it always stores its polygons in the
binary format, which is faster and more compact.

FossilOrigin-Name: dc35f7b1754a78fa0d70c92754de07bb3c28d0d31cb929ee8a3a47ac4f3d446e
2018-09-27 20:37:52 +00:00
dan
0efb6f5135 Another minor tweak to memstat.c so that it may be built against older versions
of SQLite.

FossilOrigin-Name: 4c1fed60b9b35ac2f5d2f2533b54db429d72bdbc0aad0dd5af52ff851789d4ae
2018-09-27 17:33:06 +00:00
drh
6dd5f07d3d Modify the memstat virtual table so that it works with SQLite version 3.9.2.
FossilOrigin-Name: 7171d8ae6b1e7c97b0cf06bcca2262674c9ce557c85666b4b77c16cbac508502
2018-09-27 17:15:21 +00:00
drh
d7134fe0c1 Enhancements to sqlite_memstat:
(1) Add an extra "schema" column to show the schema name for ZIPVFS stats.
(2) Only show ZIPVFS stats to schema that use ZIPVFS
(3) Put a NULL in unused columns of the output.

FossilOrigin-Name: 9351135b4331107be2f2bda7b6adbd5436381f4f9a68340e8a172b6517ec3f12
2018-09-27 16:57:42 +00:00
drh
7c5577acdc Add initial ZIPVFS support for the "main" database to the sqlite_memstat
virtual table.

FossilOrigin-Name: 9cd27350b0f62debfe3238c57c3ab51079699142e82c05a7ec8460a8429f55f2
2018-09-27 15:45:03 +00:00
drh
d7fda6cfc5 Initial prototype of a eponymous virtual table that accesses sqlite3_status64()
and sqlite3_db_status().

FossilOrigin-Name: 0b44e1f68e0c8349367e3f929d4734c3df96338ec8d6fb652565bf894e8b8343
2018-09-27 15:21:13 +00:00
dan
2e5e0e10f2 Tweak spellfix.c so that if SQLITE_SPELLFIX_5BYTE_MAPPINGS is defined at
compile time the Transliteration structure has space for 5 byte (instead of 4
byte) mappings.

FossilOrigin-Name: cbaf5b6c1b07b29b2c83fa01618de856d81cc1174769cb9770cb5c894cc87ace
2018-09-26 16:05:07 +00:00
drh
6b26a7b950 Fix typos in the header comment for the sha1 and sha3 hash extensions
in the ext/misc folder.

FossilOrigin-Name: 4ed9d83a0b14a22b3ecf25785b03b5a824d260e01a608aea85231df9b816421d
2018-09-26 03:43:42 +00:00
dan
85c6892aa4 Fix a compilation issue in the "userauth" extension. Also fix a few test
script errors that occur with SQLITE_USER_AUTHENTICATION=1 builds.

FossilOrigin-Name: 221f3f572ed49d7af69a2e7c88741fa5206ea33ca59ee791eac7698bdd11ca4d
2018-09-19 17:09:09 +00:00
drh
6557a07ca8 Fix a memory leak in the explain extension.
FossilOrigin-Name: d0c92b047a5355726aea87f38038e5bda3adf6137492919be94bd29bb847eddb
2018-09-16 16:34:31 +00:00
drh
9b84f03556 Add the new "explain" virtual table in ext/misc. Use this virtual table
for additional test cases for the optimization that avoids updating indexes
on expressions when none of the columns changed by the UPDATE are in the
expression.

FossilOrigin-Name: 2404304cc15eaeee2744cf3c8f9cac0a544631c4f1060c5a17a78b43ca86edf0
2018-09-16 16:18:01 +00:00
drh
9fd8425467 Fix minor typos in comments that get carried over into documentation.
No changes to code.

FossilOrigin-Name: 7921dd91a1745aa79ea157b91b22c380e9331800050861ee6ca1f0efa0a97628
2018-09-14 17:42:47 +00:00
mistachkin
ed008ecede Fix some harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 78862252da7f59d4737ed16f4ccf100cea27d8b421db31051afbaa8d96f24de3
2018-09-12 01:05:26 +00:00
dan
d2f65014bb Fix a broken assert() in fts3.c.
FossilOrigin-Name: 564fa75195c5179d0bc86431aaff06136fc65ec63aa9839cd1114b1fbfac928b
2018-09-10 16:38:25 +00:00
mistachkin
42cb6ec4e6 Fix typo in the Win32-specific code for the fileio extension.
FossilOrigin-Name: e812e5d59a699e8b82c51d465d9c0f09df6a1e6996b5499814dca99c5f8020d5
2018-09-08 16:53:47 +00:00
mistachkin
3c4b61333f Fix harmless compiler warning.
FossilOrigin-Name: 88b39c46c15ab6bdd0ac9536ddb6fb09862d578d0f691c57d039b0a906f1c25c
2018-09-06 16:47:10 +00:00
dan
194584e26f Merge latest trunk changes into this branch.
FossilOrigin-Name: 8a28a326d7f72ab94c7d089dbc047e719038b6cd410068dec0d173a7655c87ca
2018-09-06 16:17:22 +00:00
drh
7894b8547d Add the randomshape.tcl test-case generator script to the util subdirectory
of the rtree extension.

FossilOrigin-Name: 8f48991dcbb01e21d065fbba7782a6d1aebaa8065841a70a76af1e5a21f18ea4
2018-09-06 14:01:56 +00:00
drh
a83a74c428 Fix excess memory usage in the JSON parser of GEOPOLY.
FossilOrigin-Name: 9057e27e12ded07a9ea0b2868036d3019f7bc5be3a67e3d341f56b762d3de9d9
2018-09-06 11:14:17 +00:00
drh
9a09b7b31d Fix a problem with geopoly trying to update both the _shape and an auxiliary
column in the same UPDATE statement.

FossilOrigin-Name: 14c955152d0580abc3df1b363789f2925e013b9c957e550b1e6ebe83a82bae6c
2018-09-06 02:40:15 +00:00
dan
5921f2b9e7 Fix some test script errors. And an incorrect assert() in fts5.
FossilOrigin-Name: f804336f083d8d26314bb1ba34cec427675065a67cbe2bf00bb42e40752aeb33
2018-09-05 17:45:17 +00:00
dan
366607865b Ensure that FTS5 queries of the form "WHERE rowid BETWEEN ? AND ? AND tbl
MATCH ? ORDER BY rank" do rowid filtering before sorting.

FossilOrigin-Name: f1138a38bd23f201a35621a71e82c5718abddb42ab82938e9516ab9d43e4df16
2018-09-03 17:11:11 +00:00
drh
e35fc302c3 Improved JSON parser caching.
FossilOrigin-Name: 58078c0d2647a194279fa80e032670441b296ffc3acee692901faa5beca460b7
2018-08-30 01:52:10 +00:00
drh
9c1d7c6d4c Additional test cases for geopoly.
FossilOrigin-Name: 19b5eb45e090c4b7169a52d881495ee2eafc59f80e3db2288fc1814ba76134ac
2018-08-29 21:01:22 +00:00
drh
17f19eadb8 Fixes to the UPDATE logic in Geopoly.
FossilOrigin-Name: 7c3cee0a2a5ccacff27400c38bd708f7b9b968eb013a8fa685d876dfe85e12a6
2018-08-29 20:52:40 +00:00
drh
c0d2117f1c Add the geopoly_group_bbox() aggregate function to the Geopoly module.
FossilOrigin-Name: 2d4debccbc027405a33aeb10f9d65f6fe4bfb5eb1be5a4d8b82158caba04643f
2018-08-29 15:50:47 +00:00
drh
58726ca4b9 Stricter enforcement of the JSON and GeoJSON standards in the Geopoly extension.
FossilOrigin-Name: c0bf3ff3af4d34ef7801c16e39128e894b00699313f4915f57aa73b57642f7fd
2018-08-28 19:23:41 +00:00
drh
79931a1517 Fix new issues in the geopoly module discovered by TH3.
FossilOrigin-Name: 22fff9afc2fb20906173f258aa8feae9b52acc69a0ca7baf4e914d29c4279a23
2018-08-28 15:51:10 +00:00
drh
5965fed24e Add support for the Geopoly extension to the R-Tree extension. This also
involves adding the SQLITE_INDEX_CONSTRAINT_FUNCTION capability to the 
xFindFunction method of the sqlite3_module object, and to the
sqlite3_index_info.aConstraint.op field in the xBestIndex implementation of
virtual tables.

FossilOrigin-Name: 666133e32ca8e95807f8437dc8401bc93e2e6508ab8e6ae1e6031b7cee1584ae
2018-08-27 17:13:12 +00:00
drh
74e0aaece1 Minor changes to the visual01.txt test script.
FossilOrigin-Name: 4bc28eed32154be0e62fe69acd30f828c2e6f59c6579618ecad8ecf632a90517
2018-08-27 17:05:59 +00:00
drh
b2a18c95f0 Split the three-argument version of geopoly_within() off into a separate
function named geopoly_contains_point().

FossilOrigin-Name: 5a0e1541037b5bbc1b4bf26a7da304c9b32ea72960aca8b9309cf2180757c8a4
2018-08-27 15:55:37 +00:00
drh
e6474b77b8 Enhance the geopoly virtual table so that it does a better job of optimizing
geopoly_within() queries.

FossilOrigin-Name: 1f717385340f295064a7649cfc36ad048573cbacb6faa20f5c6067328c40c745
2018-08-25 23:03:27 +00:00
drh
27d62540e5 Provide the two-argument geopoly_within(P1,P2) routine that determines if
polygon P2 is contained within polygon P1.  Make this function available to
the query planner for optimized rtree lookups.  Update the visual01.txt
script to verify that the new functionality actually works.

FossilOrigin-Name: 6eb5d09b7f9d9bf8edbf993dccc2e2f702b95ba96cf68445609feb0ccc3ac0f7
2018-08-25 19:51:49 +00:00
drh
95327f539b Fix a harmless compiler warning.
FossilOrigin-Name: d49be9838d237b57ba1f12ed00e2d3411314ee1b9c30ef7bbaf65aca20d0870e
2018-08-25 18:57:12 +00:00
drh
a961d3a198 Merge enhancements from trunk.
FossilOrigin-Name: c446c8841192054c97ba5003fb6185b135a687b36c10fe0986e627282955520a
2018-08-23 14:54:45 +00:00
drh
c4ceea72b7 Fix various harmless warnings generated by static analysis tools.
FossilOrigin-Name: a04a0ea9e30e0ef12bafa0b90b7d1b7764865768bb4a738b0c73a7a3ef9416db
2018-08-21 12:16:33 +00:00
dan
42b2653871 Fix a buffer overread in fts5.
FossilOrigin-Name: 0e3de8abbb0c7ae64e637776cb055ce79736f99a103e00e44d17a6b091b98c81
2018-07-25 15:25:55 +00:00
mistachkin
5a193dd8e6 Add missing SQLITE_OMIT_WINDOWFUNC check to the json1 extension.
FossilOrigin-Name: fe19f8239dc474db0854a0a8ce5189ac4195c736b496f475a59a185e0879b40c
2018-07-24 13:57:44 +00:00
mistachkin
709c822f5e Fix more harmless compiler warnings seen with MSVC.
FossilOrigin-Name: edab5666f8470b37e6031dfd80e615b1aab95d1d85ccbe4ece1a813f8b3d4d95
2018-07-22 21:23:19 +00:00
dan
2f69b5c5d0 Remove an unused function declaration from fts5.
FossilOrigin-Name: 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1
2018-07-13 20:28:54 +00:00
dan
b80bb6ce88 Add the "categories" option to the unicode61 tokenizer in fts5.
FossilOrigin-Name: 80d2b9e635e3100f90cffdcffa5b5038da6fbbfccc9f5777c59a4ae760d4cb62
2018-07-13 19:52:43 +00:00
drh
c7bf57168a Fixes for various harmless compiler warnings.
FossilOrigin-Name: 5023b1b85b883a716a5da673740b6effe214ee0490f4ca45f161bb8b04784366
2018-07-09 22:49:01 +00:00
dan
51a6b19337 Fix another problem with reusing LSM cursors for range scans.
FossilOrigin-Name: ae3fc7652f27ba0a86f4c26f64c2e148d9496a5edb7f54dc9980edd91c326e4f
2018-07-07 20:26:30 +00:00
drh
491d4c89f5 Fix the JSON extension so that it can be compiled separately from the
amalgamation.

FossilOrigin-Name: 4b8cfe7bfe5f049eb4607fd480429fcd2060e691891d8bffc9917f13fa373988
2018-07-07 20:23:46 +00:00
dan
8f0c712a1f Fix an LSM problem caused by using the same cursor for equality and range
scans.

FossilOrigin-Name: f05bead371d41ca5beef1f82e4c920c90e2eb9cd9fd537a5c91973bf9bd4eedb
2018-07-07 20:13:32 +00:00
drh
fd4b72853a Add ALWAYS() macros on results of sqlite3_aggregate_context() calls in
xInverse() implements, since they can never fail.

FossilOrigin-Name: fdef2a921d451c66ca535021d08af3ec1ab53283da2d2979378a799fd8731ef9
2018-07-07 19:47:21 +00:00
drh
8be47a7e86 Get the json_group_array() and json_group_object() SQL functions working
as window functions.

FossilOrigin-Name: 916cdc83f5a45e0b6f61c52ff5fde70d54bcd0dfaa4a32f9ac709fe0ddbb480b
2018-07-05 20:05:29 +00:00
dan
d2ac43ea38 Avoid a warning in fts5.c due to not using generated routine
sqlite3Fts5ParserFallback().

FossilOrigin-Name: 65ff5144a55f1ba2b2ef812a0c988fa2522441177038b8d686eb1d0c558c75d5
2018-06-30 20:26:52 +00:00
mistachkin
5bce7d8f6c Fix typo in the 'normalize' extension.
FossilOrigin-Name: 0c9163ea232d4008105939910565b0d1e533cbb38067d7900dc732b911786d37
2018-06-18 19:09:30 +00:00
drh
2f1f8801ed Output infinity as 1e999 in the ".dump" command of the command-line shell.
FossilOrigin-Name: ee431d55eba618cfba414c3946b3162bc205a70dd4e43d74a7623be332b94c92
2018-06-13 17:19:20 +00:00
dan
c5861ce88f Fix some test case numbers in expert1.test.
FossilOrigin-Name: b90c3c16c04589583d2d1619320bb45a0b012c5960f23bd4e3f9dbe7c84b2eae
2018-06-13 16:08:22 +00:00
drh
e893e2e4ee Fix the CSV extension so that it works with single-column CSV files.
FossilOrigin-Name: e336cf00486bdc0ec04ecded2b7c874d73a87e6aba3544e3678bedfb9a4af3b6
2018-06-02 12:05:18 +00:00
drh
b7d376ee13 Fix a problem in the geopoly json parser associated with spaces before a
coordinate number.

FossilOrigin-Name: 9d8d3af89ab241fd6c68e043e559359c85653aa0e31270b658ff01867ae929c4
2018-05-29 17:17:22 +00:00
dan
1d40cdbd4b More minor changes to test scripts.
FossilOrigin-Name: ce9b756f09df4feb485bbf9695f8c6774906eb1b2fb45a340b74ffd21c9adfd8
2018-05-29 14:29:28 +00:00
drh
b0af3d1f97 The geopoly virtual table seems to be working. But only thinly tested so far.
FossilOrigin-Name: 4288f1ad5966701eac4cfe3061e8ce98e34e0d6c112307668729642a06458d5f
2018-05-28 23:59:03 +00:00
drh
48e4ef56c3 Untested incremental check-in. Add the geopoly_xform() function. Complete
basic logic for the geopoly virtual table.

FossilOrigin-Name: ed06cc32568a3abaa0535b379e0ee3b04ffb7582dcda6405670620d1fbe8996c
2018-05-28 13:23:23 +00:00
drh
f403e1af0b Minor correction.
FossilOrigin-Name: f20d9a99a477e1d592edb37d741d9d07b015d6772b4c8cf1541ef290d600ca6b
2018-05-26 12:21:21 +00:00
drh
ecdc742790 Untested incremental check-in. Basic infrastructure for geopoly in place,
except for the MATCH operator.

FossilOrigin-Name: b27451910b6880b166d4777e05b14ab2731c3483b5ed0f42c459bbb61c6cd095
2018-05-25 22:39:29 +00:00
drh
66c43599ce Incremental check-in: Progress toward implementing the geopoly vtab.
FossilOrigin-Name: 9b7d6f986a19f8fbe26d880dc368870a10df80e06097be34ee3639f78c50be61
2018-05-25 20:53:42 +00:00
drh
748b8fda90 Forward port the geopoly extension functions into the r-tree extension,
with the idea of creating a new spatial index based on simply polygons.

FossilOrigin-Name: 0593aac88a8c25ddafba4c29a181ee083dfc3dab44335feb6f12fdea6ce7fb27
2018-05-25 19:22:47 +00:00
drh
338e311acb When doing a one-pass UPDATE or DELETE on virtual tables, close the cursor
prior to running VUpdate.  This allows one-pass to work on virtual tables
that do not allow concurrent reads and writes.  Enhance rtree to take
advantage of this new capability.

FossilOrigin-Name: b816023ce07d01024d5769e16db924374a49bf909edd12dc1344a0a1ef693db5
2018-05-24 23:51:57 +00:00
drh
30fc7f8009 New test case for reading and writing the same rtree concurrently.
FossilOrigin-Name: 3ba08e53d54165f5541756ad13a4c2f0b18516cb612a256e056ed1ff76c1fa83
2018-05-24 22:42:27 +00:00
drh
c8c9cdd9dd Do not allow RTree writes when a read cursor is active on the same virtual
table, as the writes might rebalance and disrupt the read cursors.  Return
the new SQLITE_LOCKED_VTAB error code if this happens.

FossilOrigin-Name: d4ce66610851c825cb712f985216b63e015c753fdd5521f929c67ad18bfd7664
2018-05-24 22:31:01 +00:00
drh
a02fd67b99 Avoid unnecessary sqlite3_finalize() operations.
FossilOrigin-Name: 16f71032a3a2919cb226b25b5256a370adb5c55fa506d4774b7f83dc8868e793
2018-05-18 16:53:07 +00:00
drh
136c9903bf Fix a prepare-statement leak.
FossilOrigin-Name: 95fd296ffc8130526a1453cbdca6ce47f22fc5b5c474aa31d66b627d0c7393a1
2018-05-18 16:46:09 +00:00
drh
252f39619a Improved error messages. Limit the number of auxiliary columns to 100.
FossilOrigin-Name: 059d20abd57727e6d312f15b640359ef778786f577d9b50b17b57195db2d0aef
2018-05-18 15:21:43 +00:00
drh
26fb126622 Fix an issue with rtreecheck() and auxiliary data columns.
FossilOrigin-Name: 46715136078a51ca7dd08b83214d6ad0e85728af8a26cd342077b8dd4ada1d60
2018-05-16 19:56:20 +00:00
drh
7578456c25 Do not allow auxiliary columns in the rtree to interfere with query planning.
Begin adding test cases.

FossilOrigin-Name: 9abe023e1afa7dc1a7eba7fbb3128401de129873d86b7c71c221decca26a821c
2018-05-16 19:07:07 +00:00
drh
1e76c22b4a Fix the OOM issue mentioned in the previous check-in.
FossilOrigin-Name: c489d8e44eac4cd355096ab66bb40f13ef662f31e080c9f1f2ee379fe55b207a
2018-05-16 18:18:24 +00:00
drh
e297196524 Initial implementation of the ability to have auxiliary columns in an rtree
virtual table that store arbitrary content.  It mostly works, but there are
some minor issues in OOM corner cases.

FossilOrigin-Name: 0c87fec970221f954e0a92f3ef0437b382255479fac5b403ee37b1bb5ab29719
2018-05-16 17:57:30 +00:00
drh
dd7460f0fd Correct output for the fullkey column of json_each() when the total JSON
input is a simple value, not an array or object.

FossilOrigin-Name: b45b18850c59f22a163ee482f529f578a8798f96d0e26b5a061d336d480a1540
2018-05-16 12:19:11 +00:00
drh
a090ab90d6 Convert the schema creation logic in the rtree extension to use the
new sqlite3_str interface.

FossilOrigin-Name: fd8b8c4196d3f0f6cb129f43ebf473ada86eefdf16181fa70ceee21e1232b5e1
2018-05-14 15:26:05 +00:00
dan
cb38809159 Add a test case to check that the fts5 unicode64 tokenizer is dealing with
codepoints greater than 65535 correctly.

FossilOrigin-Name: 9f7a6ae878cd17ff4de7c55e654406773e0ea2b9fe1c4e2a9fc2b0da84d059a4
2018-05-09 16:32:00 +00:00
drh
5d72d9245d Make a separate limb in the EXPLAIN QUERY PLAN output for the various lines
associated with the OR-optimization.

FossilOrigin-Name: 75ac7b4e4fd0811ca80c719badacff207e0bbd00ac64dde3b3d4ec676fad472d
2018-05-04 00:39:43 +00:00
drh
98b677f2cb Overhaul of EXPLAIN QUERY PLAN. The output is now in the form of a tree.
More details of the query plan are shown, and what is shown is truer to what
actually happens.

FossilOrigin-Name: ff01bbdabc4b9db3db8b928979442c91b32d72082158e4f5fe62ae51a73649d2
2018-05-03 19:56:50 +00:00
drh
cdf88760da More test case updates. Tests are all running now.
FossilOrigin-Name: dab5e5294813891469660cceb211ac1a1e526715bb57dcdbb1ab90321e6a4dad
2018-05-02 19:42:33 +00:00
drh
b3f0276b9e Fix test cases so that they work with the new EXPLAIN QUERY PLAN output
format.  Only some of the cases have been fixed.  This is an incremental
check-in.

FossilOrigin-Name: 5f0e803e33aa557865d5fc830d9202d628de9a94c9757058ca48f1a560702cd3
2018-05-02 18:00:17 +00:00
dan
fa5c69f5cb Fix a problem in the xBestIndex method of the closure extension causing it to
allocate non-contiguous argvIndex values in some cases (an "xBestIndex
malfunction" error).

FossilOrigin-Name: 0c67150749cb3d067e14b2dcac9c3489e0f14bd18c0387f1d9bc93d21fc96fe5
2018-05-02 08:12:22 +00:00
dan
2b137d65f5 Fix an RBU problem causing spurious SQLITE_CONSTRAINT errors when restarting
an RBU update in which more than one source table writes to a single target
database table.

FossilOrigin-Name: 564ae8297d417ba4b7978e430d41f125007177673163f6ed9adc3a3974f73d24
2018-04-28 18:20:01 +00:00
drh
6bfd973ce6 Fix compiler warnings in FTS3.
FossilOrigin-Name: de508e831a43f02c3b354a24ea34798da03c163bae5521c852c9ddd252723739
2018-04-28 04:10:55 +00:00
dan
03db962ab5 Update test script fts3expr4.test so that it always creates fts3 tokenizers in
the "en_US" locality.

FossilOrigin-Name: 576a8f69ae25883f752e58953624e9f7126db998bebaa1f07f7c2ec47aaecabe
2018-04-27 18:05:01 +00:00
drh
ef9e3d78f2 Enhance the comments in the templatevtab.c implementation.
FossilOrigin-Name: 05f6278a02e5cde89f76ced5af7d508e26576d7291dad7ee9e06b1a3be516cb0
2018-04-27 15:17:08 +00:00
drh
fc0ec3e5e8 Add new interfaces for accessing the list of SQL keywords:
sqlite3_keyword_count(), sqlite3_keyword_name(), sqlite3_keyword_check().

FossilOrigin-Name: 7dd34e3776fed90a49344d54a1b68bb59f7957b5a8a1a367087b7cafb63111c1
2018-04-25 19:02:48 +00:00
drh
7eabc44dee Add the new DO and NOTHING keywords to the keyword lists maintained
by various extensions and auxiliary programs.

FossilOrigin-Name: 77a98a0781cd8450e2100111e70526db6a51d7e58e3c505ea87f685388099e82
2018-04-25 17:10:30 +00:00
drh
cd90ca7ded Update the expert extension test cases to account for the fact that
EXPLAIN QUERY PLAN now shows the start of each trigger in its output.

FossilOrigin-Name: 8acb42f48929d908fe67a8536e240ca252a9ab780dce79eaa85b8fba35d52250
2018-04-24 16:51:38 +00:00
drh
4d3e61403a Fix a memory leak following failure to open an external CSV file in the
csv.c extension.

FossilOrigin-Name: 526ee07d19dbc8fd1af3a02a8da12b337020a4be40e045da9a19d0a7c2b6ab54
2018-04-24 10:57:10 +00:00
dan
340e9e125b Enhance the "rbu" command line utility a bit.
FossilOrigin-Name: 61eb516f83d1a7fe44f72bebe2a2745ab904a02e06e38fb6d932348c49607976
2018-04-20 20:37:25 +00:00
drh
55a3490cf2 Add the ext/misc/tmeplatevtab.c template for virtual tables. This is a
work-in-progress as it still needs improvements to the comments in order to
be useful as a template.

FossilOrigin-Name: 22358fb5495c727a4dde129128fe409a7b929a5ffa143b1e2879f84d7680ec3c
2018-04-19 16:14:59 +00:00
dan
67ecf1f5c2 Fix the fts5 xBestIndex method so that it is not confused by "IS", "!=",
"REGEXP", "GLOB" or "LIKE" operators.

FossilOrigin-Name: a0ca4ddbbf179b8f0a5f30c127f2f8c92b6d45a08be3e1ef2194e44ebcc28120
2018-04-09 14:26:44 +00:00
dan
fe55da387a Add a "flags" parameter to experimental API sqlite3changeset_apply_v2(). Also
add the SQLITE_CHANGESETAPPLY_NOSAVEPOINT flag.

FossilOrigin-Name: 3d29631fa7270b18f51de8cfe1285959e42ad9a673d5d2d5c016126f5f1b31a8
2018-04-09 11:43:58 +00:00
dan
3e259bcd96 Fix a problem in the sessions module causing sqlite3session_apply_strm() to
allocate enough memory for the entire input buffer - which defeats the point
of a streaming interface.

FossilOrigin-Name: 7594e60935b0b5dcf764476dccdf9b403303818a0419a30bc2c16d58e44f6d04
2018-04-06 16:22:25 +00:00
mistachkin
33fc27790a Fix segfault in 'eval.c' extension when used with 'empty_result_callbacks'.
FossilOrigin-Name: e8b87bd4954437041139344d6d1ce3e4aace40ea6891b70f9c20cd95671270e7
2018-04-04 12:21:33 +00:00
drh
92a2ec00eb Fix the generate_series virtual table so that it correctly returns no
rows if any of its constraints are NULL.
Ticket [fac496b61722daf28].

FossilOrigin-Name: 3328e828e28ca7198fd1ce84503e649ab2278913a2cf85a0f0391f31d0c9c8d7
2018-04-03 14:25:51 +00:00
drh
58bd03320d Fix a bug in the spellfix extension causing it to compute suboptimal answers.
The problem was introduced by check-in [afd6fbc01052ccfc9].

FossilOrigin-Name: 3bf28fd9a70ebefc464dceda124d6ed342dd83f71eeeb0568f79e34e731a073e
2018-03-30 16:34:04 +00:00
drh
9f95e48d94 Fix an off-by-one error in the dist3 algorithm of the spellfix extension.
FossilOrigin-Name: 5c34af7b975598bbe20751dfdd346f43031cb2bcb6b78f1bbdb2b51b398de182
2018-03-30 15:59:54 +00:00
drh
43a9385def Fix a typo in the README file for ICU. No code changes.
FossilOrigin-Name: 79c4383b66fee9d43a75eef30ed0364573fc99e6d3be12267a99773ab8f57a9f
2018-03-27 22:58:45 +00:00
mistachkin
43ff906d3e Fix a couple issues in the 'session' module tests.
FossilOrigin-Name: ccf734f7d2bf8f99f3c55124b05c1835e4371bc269f27700f40afc26e7c1bc55
2018-03-24 23:16:05 +00:00