Commit Graph

20794 Commits

Author SHA1 Message Date
dan
e4a9e4d0e5 Have ALTER TABLE commands ignore the lhs of "expr IN ()" and "expr NOT IN ()" expressions, just as other queries do. Fix for [533010b8ca].
FossilOrigin-Name: 71643deb6bbad4b4a511bfd43b32245b50a555b508b90f33adf0656ae53292c6
2019-06-10 19:17:37 +00:00
drh
99778c4b21 Improvements to the documentation for the xAccess method of the VFS.
Ticket [5e0423b058fa5adf]

FossilOrigin-Name: 7078d77effc296c63c91ec032c866e2b320f081d58e57e9e83cc58373169bda3
2019-06-10 19:07:15 +00:00
drh
c285ded26c Make sure a CAST to "NUMERIC" results in an integer if the value can be
losslessly expressed as an integer, as the documentation requires.
Ticket [dd6bffbfb6e61db9].

FossilOrigin-Name: c0c90961b4fa1c1185772d04fe1915bc1a1af27ed8ddb8db1c524bf90d68ccbf
2019-06-10 18:33:16 +00:00
dan
e20a894a34 Handle renaming a column or table when the schema contains a (meaningless) index on the constant expression ('text' IN ()) or ('text' NOT IN()).
FossilOrigin-Name: 567b13093956185b5d5e971b81ba4788fd9d26c03688f643b380f0f1c1a94da0
2019-06-10 15:34:16 +00:00
dan
32d0f64e8d Do not attempt the LIKE optimization on a column with numeric affinity if the rhs of the operator begins with whitespace. Fix for ticket [fd76310a5e].
FossilOrigin-Name: 94b58ab059cba9771e75f16d1460f313104a8fb879f9f8805725d362aa58cbcd
2019-06-10 13:46:42 +00:00
drh
55700bcd72 Remove code in the round() SQL function that became unreachable due to
the optimization of check-in [e95138f5f4febde5]

FossilOrigin-Name: b141bae3f6d16c0ebb59dac9b02086a4370839e71ade34004f647b09b1083d1d
2019-06-07 22:51:13 +00:00
drh
9a2782293c When casting string values into numeric and the string has a prefix that looks
like a number but total string is not a well-formed number, then take extra
care that the result is either integer or real depending on what the prefix
looks like.  Fix for tickets [e8bedb2a184001] and [4c2d7639f076aa].

FossilOrigin-Name: 67a68af5578f08d2be2e48cf4fd12a6cf35a09c47d259deda81950f7ee1f02f7
2019-06-07 22:26:08 +00:00
dan
4eefeb5577 Also upgrade script config.sub to the latest version. This should have been part of the previous commit.
FossilOrigin-Name: efbf31b82e6e16fda88d8cea54202a8593ff52f2267a44dba828704818162e66
2019-06-07 18:56:03 +00:00
dan
9cc867d09c Upgrade the config.guess script to the latest version.
FossilOrigin-Name: be8438133f6cd87e5d51f15cfd1eed83176b3239334875eb0c3dec502cfe39d3
2019-06-07 18:53:51 +00:00
drh
d985f7260b CLI enhancements: Add the ".filectrl" command. Make the ".testctrl" command
visible to ".help".

FossilOrigin-Name: 7b3a99fce8b4a757f2b2ef2f0b02d68566f2528d9ae1e30628522717f872466c
2019-06-05 14:29:53 +00:00
dan
48646e497b Add a test case for the unix SQLITE_FCNTL_CHUNK_SIZE file-control.
FossilOrigin-Name: 3a477fd0c944440be03d23c667053b346c769c6a4f6ba1ef094b7581a08d7bd4
2019-06-05 13:14:19 +00:00
drh
f9c7c4b1f2 In the CLI, add a small delay (0.1 seconds) after launching the output
command for ".once" before deleting the temporary file.

FossilOrigin-Name: 4979f138e8c8bef7dd6b5921fb9ca9fea86bbf7ec1419934bb2d1a0d74e77183
2019-06-04 18:21:59 +00:00
drh
9b2ec0efa1 New dbsqlfuzz test cases add to test/fuzzdata8.db.
FossilOrigin-Name: 873aa46da3d0f97784cad94828fc367bb2ceb13d5ece2e105320f404b3971c85
2019-06-04 15:47:37 +00:00
dan
471e88f732 Fix a segfault in fts3 that could occur when processing corrupt fts records.
FossilOrigin-Name: dff24c6c7a4e7623984b5bb24c2ff14fe079dc49a0ad048cbfc66f84c08875b0
2019-06-04 13:11:37 +00:00
mistachkin
17df761a84 Fix harmless compiler warning in lemon.
FossilOrigin-Name: 2da0eea02d128c37f2fbe764227ac526d3e993284516544adc0a216a035c5676
2019-06-03 15:09:25 +00:00
drh
84422db987 Optimization to the round() SQL function for large input values without a
fractional part.

FossilOrigin-Name: e95138f5f4febde598f39e031d6e4f4d5ad0adbd8dcdd34fd0baaa78ab393417
2019-05-30 13:47:10 +00:00
drh
05921223c2 Smaller and faster sqlite3IsNaN() implementation makes deserialization of
floating point values much faster.

FossilOrigin-Name: ea748edecb261f2b862d542daff6e99a6fd8879a8ace94b440d99e110577d1c1
2019-05-30 00:46:37 +00:00
drh
8a3884efae Much faster implementation of applyNumericAffinity() by avoiding some
unnecessary calls to sqlite3Atoi64().

FossilOrigin-Name: c1d8a3f65490eef2216f360d708b1746cbaa6dadce42c0950dc8e09b9ab28ee2
2019-05-29 21:18:27 +00:00
drh
b0968b6b14 Add an assert() as an additional test for fix in check-in [523b42371122d9e1b3].
FossilOrigin-Name: f9e85e6c79162081f8f512d22951931a89d157a32b24afdc48b7eb865379abe7
2019-05-29 18:33:59 +00:00
drh
7cd5e856e5 Fix the query flattener optimization so that it preserve the "SF_Compound"
bit when flattening a compound subquery into a non-compound outer query.
Failure to preserve that bit could allow subsequent flattenings which are
not valid. Fix for ticket [c41afac34f15781fe09cd].

FossilOrigin-Name: 523b42371122d9e1b3185425745f1490138bff7f7cc941ee26ee81df7ade5bf4
2019-05-29 17:22:38 +00:00
dan
efdb371a1d Fix an assert() in fts3 that could fail when processing corrupt records. Also some minor sanitizer warnings.
FossilOrigin-Name: c736c40aab071a69bd5c5347b7c116d87ea3954019e967ca8ff7bdb4b518e5bf
2019-05-28 14:42:32 +00:00
drh
0a0e89fa21 Fix an error message on the blobread() extension function so that it says
"read" instead of "write".

FossilOrigin-Name: 7cbb9a5fe835d01be158edd1e2f9d553dc257f2d27b53a5d5bf6660d0bd101c4
2019-05-27 11:21:43 +00:00
drh
3517cc7f36 Fix a memory leak in the delta_parse() table-valued function of the
fossildelta.c extension.

FossilOrigin-Name: c86ca3f0220a5f9e7f7f1818f6e1220d851f3ebed6a5f0aae6ac38309bd2930e
2019-05-27 11:09:55 +00:00
drh
ef7d5187a7 Improved rounding even on systems with an 8-byte "long double" type.
FossilOrigin-Name: 15202aee150fa8e15fb90e90e5765c5e19a1eaf4896da2996a747636b76da8e6
2019-05-27 00:29:15 +00:00
drh
c2b893a7e0 Performance enhancement in sqlite3AtoF(). About 8% faster.
FossilOrigin-Name: 81721aa54587e20d031d528fb6b74d91671a6e950fa926dc63f4284466e70f0e
2019-05-25 18:17:53 +00:00
drh
38a59af417 Use "long double" literals to initialize an array of "long double" objects.
FossilOrigin-Name: 2e2ebad3ab636c4c65814ad41d417b105be8e254d609d0e08fbba4c5bd107bf3
2019-05-25 17:41:07 +00:00
drh
4413265d4e Add new cases to speedtest1 for measuring performance of binary to/from decimal
conversions of floating point values.

FossilOrigin-Name: b84e7057c05338347b4267f7ccc1d7b9b6d4e9a941ce8b76bf2c27c26772000c
2019-05-25 13:14:19 +00:00
drh
aa81cae485 Disable the new rounding tests on systems without long double support.
FossilOrigin-Name: ed250b4e18ea042d681bbe8d7ed00895564f4525c22928a003a84585b4756ec3
2019-05-25 00:17:26 +00:00
drh
a0ed86bc37 Improvements to rounding behavior in the round() and printf() functions.
FossilOrigin-Name: 641b2d210541b4d5a1a9e57d7dcf5ce5dfd7ff4d2dc6277ba0582869f48fc946
2019-05-24 22:58:16 +00:00
dan
98d63579be Fix an fts5 segfault that could occur after parsing a corrupt structure record.
FossilOrigin-Name: 600daa9c27206628bf74892376ded35dac11fe0a34894fcd975ad5041a0a0fda
2019-05-24 11:55:01 +00:00
dan
c542fa8573 Add test cases for the fix in the previous commit.
FossilOrigin-Name: c1057b2a60add08e5c80ef2a53932a690b096f2eb03c7de863844deaa8fc9d53
2019-05-23 16:40:45 +00:00
drh
30ad79aeb4 Improvements to the view-self-join optimization so that it works on all
VIEWs, not just on Common Table Expressions.

FossilOrigin-Name: d2fe370cafa9b11f6c3eb4e1c3be48d9d2610b9d2f9d9ebf9e50267f9079dfc0
2019-05-23 16:38:12 +00:00
drh
53e8709b75 New test case for check-in [74ef97bf51dd531a] that takes the fix in the
previous check-in into account.

FossilOrigin-Name: cb1d06521de5918a2324a41e207b48c5e5149c23b927b9e3e1f3c3b38b82658e
2019-05-22 23:12:10 +00:00
drh
59145813d2 Renumber the Select.selId values in the copies of SELECT statements that
implement VIEWs when the VIEW is expanded, so that when the same VIEW is
used twice in the same join, each expansion as a distinct selId.
This fixes ticket [ce823231949d3abf42453c8].

FossilOrigin-Name: 3cacc4b940fd69776d930deec9512df47a2f22cb04fb955e354a0b25bdec287c
2019-05-22 22:49:23 +00:00
drh
90c21df233 New dbsqlfuzz find added to test/fuzzdata8.db.
FossilOrigin-Name: 42af7c819bc52ccb6953a58b1c05d3bd47cc438c5119a9555b1b796764eb9f20
2019-05-22 14:35:10 +00:00
dan
29fa6b6642 Fix a buffer overread that could in fts3 when dealing with corrupt records.
FossilOrigin-Name: 1660d7733eb443ab085ddef7666b998a1c75ac81cc54a9620960a8d3b377e28e
2019-05-22 14:22:44 +00:00
drh
51e441da2b Combine the implementations of the key and hexkey pragmas into a single
case.  Have both pragmas return "ok" if they are implemented.

FossilOrigin-Name: b3692c406f7ba62587c9d3256f888748393519680e9e2db53f59557f1a300e05
2019-05-21 17:04:27 +00:00
dan
7ed6c068f5 Fix a problem in [b5ca442a] causing an assert() to fail in REINDEX commands.
FossilOrigin-Name: a3e77c7776ab01dadb9d30d6067ac97e9d4b09ec54834558a5fa1ffed7b52c72
2019-05-21 16:32:41 +00:00
dan
ef14abbf8d Use a statement journal for all CREATE INDEX statements in case an indexed exprsesion throws an exception when it is evaluated. Fix for [b5ca442a].
FossilOrigin-Name: b8071d10cba8f6c19fb8d5df3877f72567dc6d6a94744a39cbc1f58b2e2f343b
2019-05-21 14:42:24 +00:00
dan
595d9f5f3c Fix a segfault that could occur in sqlite3session_diff() if NULL were passed as the pzErrMsg argument.
FossilOrigin-Name: aee73fd28f031a2568ac723de0826be7f1dca6be3b049e4a04fb47af75dcf4bf
2019-05-20 19:46:30 +00:00
drh
acd6bb5fe4 Improvements to the automatic compile-time selection of byte-order, as
suggested on the mailing list by Seb Kemper.

FossilOrigin-Name: b7aad929619f7043b1685a6477d50f6b4436e85511eb365eceae3dd4dbab571a
2019-05-20 18:43:57 +00:00
drh
3e4f6c43b8 A minor variation on check-in [1685610ef8e0dc] which (hopefully) makes the
logic a little easier to follow.  Also disallows the use of the double-quoted
string hack in the query expression used for VACUUM INTO, which is not
strictly required, but moves us toward the goal of disallowing the double-quoted
string hack everywhere.

FossilOrigin-Name: 3e1b55f3ab85710ed81574904718205c7370b5f0b5a41029e961486d2e3f37c7
2019-05-20 18:35:49 +00:00
dan
0d92571d65 Disallow string constants enclosed in double-quotes within new CREATE TABLE and CREATE INDEX statements. It is still possible to enclose column names in double-quotes, and existing database schemas that use double-quotes for strings can still be loaded. This addresses ticket [9b78184b].
FossilOrigin-Name: 1685610ef8e0dc9218b02461ceab14dc6114f4f5ef7fcda0da395094aff443e1
2019-05-20 17:14:25 +00:00
dan
8ac02a94ab Update the sqlite3ExprCompare() routine so that it does not think "? IS NOT TRUE" is the same as "? IS TRUE". Fix for [d3e7f2ba5b3].
FossilOrigin-Name: 99eba69b3a64741c69d167bf7a05dbe138c9e7faecc54a1b8d8220cb23902830
2019-05-20 10:36:15 +00:00
dan
7ac0e562a3 Fix an assert() failure that could occur in a join query if the RHS of an IN() operator is a list containing correlated expressions. This problem was introduced by checkin [e130319317e7611938] which was part of the fix for ticket [787fa716be3a7f650c] - so this commit is part of that ticket's fix too.
FossilOrigin-Name: 778b1224a318d0137c7dab8361128f593506d3677267898119b934b4d66dfe38
2019-05-18 21:22:25 +00:00
dan
4db4b5b4fe Avoid including the comment in the output of "PRAGMA table_info" in situations where there is a comment following a DEFAULT value within a CREATE TABLE statement.
FossilOrigin-Name: d91095ba7130e974f0c95334760c679a31479b07a3d458e15994a24eee474752
2019-05-18 19:49:08 +00:00
drh
6c35b3065c Disable PRAGMA journal_mode=OFF when SQLITE_DBCONFIG_DEFENSIVE is turned on.
Ticket [f4ec250930342e0c].

FossilOrigin-Name: a0f5eb5c79cc33b7224f3421d2baa02a2a19eb9d6eaa8117dda4a1878b229cb5
2019-05-17 20:37:17 +00:00
dan
be81262400 Always store a REAL value in a column with REAL affinity if the integer equivalent would require 8 bytes of storage. Fix for [3c27b97e3].
FossilOrigin-Name: 14c00b1016ba53ab2dc177c59a27b6b9209202973685f0f274112d296ba7dfcb
2019-05-17 15:59:11 +00:00
drh
829d4253ff Add test cases to test/fuzzdata7.db for (harmless) dbfuzz2 finds.
FossilOrigin-Name: 1eb2a628e4bfae51fea43e8f40fedfe23f2118024d9cce35828c3cbe92a9b392
2019-05-16 20:40:08 +00:00
drh
5c2f2206b6 Initialize the 18-byte overrun area on the buffer used to reconstruct
overflow btree cells during a btree search, to avoid a harmless
jump-depends-on-uninit-values warning.

FossilOrigin-Name: 4b05caeb1b9767ba58cb4261ecc22cdd495216b3258d45f2165cdbd3ea079495
2019-05-16 20:36:07 +00:00
dan
0971ef45ab Fix an assert() in the OP_Delete opcode that could fail with a corrupt database.
FossilOrigin-Name: 915388ab39ba3ca8681cd2613b91314aa965967f23a5bface90f54a3d6423300
2019-05-16 20:13:32 +00:00
dan
36c9301816 Add new test file fts5corrupt4.test.
FossilOrigin-Name: 5dfc4fe98a4821cbdbfd7dfddf221b00251b2a26bf58767a3956b64e9a4e92da
2019-05-16 16:44:47 +00:00
drh
e72d1a8682 Fix a harmless use-of-initialized-value fault in the assert() logic added
by check-in [d612fb7873cf59d]

FossilOrigin-Name: 3dac90728a6a1962da478afe751582ddf8b6d4666548a805564817b21e07a246
2019-05-16 11:47:16 +00:00
mistachkin
3196abb7cb Fix harmless compiler warning in the session extension.
FossilOrigin-Name: dff823ca8b5ca4a5611407b0231f89b2e8c981f50e85e361e76d3e4973cea8ca
2019-05-16 03:47:38 +00:00
drh
df82afc04e Make sure the OP_Concat opcode always correctly zero-terminates a UTF16
string, even if the input strings are ill-formed.  This is a followup to
check-in [3a16ddf91f0c9c516a7] that fixes a case the previous check-in missed.
Also add assert()s to prove correct zero termination.

FossilOrigin-Name: d612fb7873cf59dfda18cabe45f674c37aa78a4587de3378b1840c99465a0269
2019-05-16 01:22:21 +00:00
drh
73c53b39c9 Fix the count-of-view optimization so that it is (correctly) disabled for
a query that includes a WHERE clause or a GROUP BY clause.

FossilOrigin-Name: 05897ca48a40c6771ff83ba8ecc3a5c60dafddf58651c222dd8cf89b9fc7b077
2019-05-15 18:42:15 +00:00
drh
58eaf76355 Simplify the "Verifying Code Authenticity" section of the README.md file.
No code changes.

FossilOrigin-Name: adebffc18e6165672947a6bda5ca23ea7723cca7ab8da4feb81fca8f83e4fcaf
2019-05-15 10:16:34 +00:00
dan
a40cb96a4c Fix a problem with the fix for [9cf6c9bb51] (commit [658b84d7]) that could cause a cursor to be left in an invalid state following a (rowid < text-value) search.
FossilOrigin-Name: bc7d2c1656396bb4f5f1f814e60dbf816cc91c5a521b54ad593cd3da0fe8dcb4
2019-05-14 20:25:22 +00:00
drh
9252966b3c New test cases in test/fuzzdata8.db.
FossilOrigin-Name: 228e1087c0602470e450586499de5a3e87e266c688bc828f20e3bad2fdc65ff1
2019-05-14 19:20:52 +00:00
dan
2a71b17f2f Fix a problem with corrupt db handling in the fts5_vocab module.
FossilOrigin-Name: 456ced57774a92acff23cad975b78ff0e5cbbf5204ea48599fe1761a018a92e4
2019-05-14 18:33:58 +00:00
dan
c12655df87 Fix an assert() and potential buffer overrun in fts5 that could occur if the database was corrupt.
FossilOrigin-Name: 8be8bd0d562e571b73a93f4ed18258ebd114bbab67ee3cdcd66a4c8f2987f8dc
2019-05-14 11:33:09 +00:00
drh
bf9ff256fe Disable index seek optimizations on REINDEX when the order of primary keys
in the index differs from the main table.
Fix for ticket [bba7b69f9849b5bf11b4].

FossilOrigin-Name: f7aadfab3bb8eb8eb2cd62dc8a6823538387b3329f1efc23ef75482488109478
2019-05-14 00:43:13 +00:00
dan
d6712f3638 Fix an assert() failure in fts5 that could occur when processing a corrupt database.
FossilOrigin-Name: f158c048be1dc7c80d38787a20495caa55b86416967efd57f4888548d42b4819
2019-05-13 11:52:19 +00:00
drh
c51cf8642f A new implementation for the sqlite3ExprImpliesExpr() theorem prover that
does a better job of answering TRUE to "(NOT A) OR B" when B is a NOT NULL
expression.

FossilOrigin-Name: b3413197f57711f04102d8cc6ff1e8ddbe0f5f2bcb6e1989cf314fa97f0ff7f1
2019-05-11 19:36:03 +00:00
dan
c6824c8d6c When considering partial indexes, do not assume that a "CASE x ..." expression implies "x IS NOT NULL".
FossilOrigin-Name: 1b24303220b7b4f59520176a0150fc619c668865450b4fdaa9ce4113a56e9687
2019-05-11 16:14:42 +00:00
dan
8f2b1e4c90 Do not assume that "x IS NOT ?" implies "x NOT NULL" when considering partial indexes. Fix for ticket [8025674847].
FossilOrigin-Name: 0ba6d709b50d92db1542f2ff30535a80184b00dadf759d51e5cae7a6e37b1764
2019-05-11 13:04:33 +00:00
dan
90255b8149 Add tests for the RBU module.
FossilOrigin-Name: a194e53670e25a48c2bb51b54755abff88ed6ae2596c5858fb4aac16cb452bdf
2019-05-10 20:44:10 +00:00
drh
2240bb88f8 Fix harmless compiler warnings.
FossilOrigin-Name: 956ca2a452aa3707bca553007a7ef221af3d4f6b0af747d17070926e000f2362
2019-05-10 17:54:58 +00:00
drh
9546c76656 Fix harmless compiler warnings in the CLI.
FossilOrigin-Name: 2846bc0429c0956473bfe99dde135f2c206720f0be4c2800118b280e446ce325
2019-05-10 17:50:33 +00:00
mistachkin
d9bc6e8973 Fix some harmless compiler warnings.
FossilOrigin-Name: ca068d82387fc3cda9d2050cedb4f9c61b6d9dc54f89015b4b2ee492243ed5c9
2019-05-10 16:16:19 +00:00
drh
4142265645 Ensure that the BtShared.nPage value is reset correctly on a SAVEPOINT
ROLLBACK.

FossilOrigin-Name: e6d5fee8cdbdce8515957e8288e4d1e7b06f417fd3f9deeeb636fbf5b995af51
2019-05-10 14:34:18 +00:00
dan
08f6de7f31 Treat integer values in window definition ORDER BY clauses as constants, not as references to another expression.
FossilOrigin-Name: 7e4809eadfe99ebfd797a7c63501421021a720bbeed9fba81bebf630c58bb791
2019-05-10 14:26:32 +00:00
drh
2ce9b6bcd5 Improved comments and extra assert() statements on the OP_Savepoint opcode,
just to make the code a little easier to read and reason about.

FossilOrigin-Name: e80b2d9fcbc82ae5dc8a1fc13196f9a30bdb504eb5a5c131d136a78bbd5bbe7b
2019-05-10 14:03:07 +00:00
drh
7e6dc5d908 Fix the previous check-in [db9acef14d492121] so that the amalgamation build
works for systems for which lack HAVE_ISNAN.

FossilOrigin-Name: 3cc55e09e6c1de2059d97bdddf2fdfbdcc62c584b513f56faf9d3a39ef80cddd
2019-05-10 12:14:51 +00:00
drh
05d7bfd0bb Fix the round() SQL function so that it handles infinities correctly.
FossilOrigin-Name: db9acef14d49212108c8082cc15a9b9b4a56b8afe4fe1104ddf62783739c1fbe
2019-05-10 12:06:47 +00:00
dan
5985dcbf5e Fix another small buffer overread in sqlite_dbdata triggered by a corrupt database page.
FossilOrigin-Name: 1dfc95b8673b0e8c9ef5040c2fa0fbe9846e430d104e9b83f3f1f3ad63446380
2019-05-09 18:37:37 +00:00
dan
39e04f83b9 Fix a problem in the ".recover" command allowing a circular loop of b-tree pages in a database file to cause an infinite loop.
FossilOrigin-Name: 8d2a062eb8a3e6fdc6a61b571c8da0070382bf208c53e797151eac8679c975a1
2019-05-09 18:33:32 +00:00
drh
0a0536ab0f Make the ".schema" command in the CLI resistant to corrupt database files.
FossilOrigin-Name: f22c7e229ea4626c5268d61de3964521cf6a2735290cbd1518d68731ba6cca90
2019-05-09 18:13:30 +00:00
dan
4d2175613f Fix a crash in the sqlite_dbdata module that could occur if a pointer within an overflow chain in a corrupt database pointed past the end of the db.
FossilOrigin-Name: 3eae4e301e3e4bcf14e96066f77be1434c5d4b3daadb10153cd36382589ac128
2019-05-09 17:54:27 +00:00
drh
6bab6f2b4d Disable the optimization where a REAL value with no fractional part
is stored as an INTEGER when the integer uses as much space as the real
value it proposes to stand in for (8 bytes).  This avoids corner cases
of comparing integers against real values that are beyond the resolution
of an IEEE 754 double.  Fix for ticket [6c1d3febc00b22d457c78c2]

FossilOrigin-Name: 9b0915272f4d4052aa31e9297424a7db9a0234b676e8e2a44c3f2dc54236705a
2019-05-09 17:10:30 +00:00
dan
f6099e9b40 Avoid long delays that can occur when ".recover"ing data from a database with a corrupt freelist.
FossilOrigin-Name: 20f06bf2e659212a68dcf138e444da7bd4220548ec15a97cfd7eb82e028b3630
2019-05-09 16:57:39 +00:00
drh
5ad1251a60 Improved debugging output from the OP_MakeRecord opcode.
FossilOrigin-Name: ac790729d9c8f8612936bab56dca6061408007bc2150ac8c7089132403d7f885
2019-05-09 16:22:51 +00:00
dan
9c34bc0ad5 Fix another corruption related buffer overread in the sqlite_dbdata module.
FossilOrigin-Name: 5cd728fb6b3a70f795306d4d6e12151a4de327f801733a8558139e3cd76fe66a
2019-05-09 15:51:27 +00:00
dan
e216ae0a3e Fix further buffer overreads triggered by passing corrupt records to the sqlite_dbdata module.
FossilOrigin-Name: dbc6a9f7f67256dea96d3245e7bec145ba65d64adf322e18f1f3ac9556b4e0b6
2019-05-09 15:07:46 +00:00
dan
9877965f56 Have ".recover" handle cases where the sqlite_master table contains malformed SQL statements.
FossilOrigin-Name: e736da9c18fad138c5502d354c3553373cba15358b69e44b257f60def59422e2
2019-05-09 14:15:19 +00:00
dan
13b876773c Fix a problem with running the ".recover" command on a database that is zero pages in size.
FossilOrigin-Name: 47fa65343e46c7782a173174952c637c5621e16229ece258dc7e7a556683ca0c
2019-05-09 11:45:21 +00:00
dan
b3e3a5bb57 Avoid reading outside a record buffer when extracting an SQL value in the sqlite_dbdata virtual table code.
FossilOrigin-Name: d99bb0c11d62f629bf59da037827af73a9b814e65815006e0cbca1bc41f42e25
2019-05-09 11:34:31 +00:00
dan
eb4a61a30c Merge accidental fork in trunk.
FossilOrigin-Name: ec9373031d76b34163a45d0ed05e43c0c9d585c8d47aa255f670340673bc7875
2019-05-09 11:21:32 +00:00
dan
873b019826 Fix a problem in the new code introduced by [658b84d7] causing corruption and other errors to be ignored.
FossilOrigin-Name: 7ccf2e7d413adb109c61456a5f46e87d38884801dbaab93297a17e3050014b59
2019-05-09 11:19:27 +00:00
drh
68feae52a9 Improved error handling for the ".open --hexdb" command of the CLI.
FossilOrigin-Name: 4fa831d5cd5861f6a0a8f08a738b2d4d371fb2a788178ce86482c5bba761f9de
2019-05-09 11:18:41 +00:00
drh
eb265343a9 Ensure that the sqlite3BtreeLast() interface initializes the *pRes return
to zero if the cursor is already sitting on the last entry of the table.

FossilOrigin-Name: ebe4845cd0ffb96b30be3c69eb399d58e93149886bc2fa60a7ebd7b4fbe447a4
2019-05-08 23:55:04 +00:00
drh
6f7f5d95f8 This is part of the previous check-in that didn't get committed for some
reason - probably because I failed to press the "Save" button on the text
editor.

FossilOrigin-Name: 51d32173ff1f610b5d75a50f20fa1e0e4e22046299869e3b82e0bb446dba890c
2019-05-08 23:53:50 +00:00
dan
ad5536fca1 Add another test case to cover a previously uncovered branch in the RBU module.
FossilOrigin-Name: 30392985612c51d4583a905f8fe766f08cd31b86d0e30a977adc6a6705649e00
2019-05-08 21:14:48 +00:00
drh
97afa309d7 Fix another pattern for which the LIKE optimization does not work for a
non-TEXT affinity.  Case found by Manuel Rigger.

FossilOrigin-Name: 740201107ae802c12b678e388ea524db01ad0eb70601c78490ad63eae0fe6cf1
2019-05-08 19:55:24 +00:00
drh
ea5c040f87 Simplification to the logic underlying PRAGMA case_sensitive_like.
FossilOrigin-Name: ef0015fde4c87e992ffd3d7dea8586951bdd65ff98d30d436b126b85b1cc9c74
2019-05-08 19:32:33 +00:00
drh
9e9374b2e2 Avoid an excess register allocation in UPDATE, when possible. This improves
speed (slightly) and reduces the code footprint.

FossilOrigin-Name: 8658574e3f435f03a87c04f398bd05078ebc53ecb4a477d3b24902d701d935c4
2019-05-08 19:06:59 +00:00
dan
42e84ae1ab Add tests to improve code coverage of the RBU module.
FossilOrigin-Name: ecb56b75a0e66462acdcce285b93f9fc56944c42902d886d6bada419059519a9
2019-05-08 18:49:51 +00:00
drh
08652b5ea0 Provide the SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA compile-time option to
omit the case_sensitive_like pragma.  This change, in combination with
documentation changes, is the current solution to ticket
[a340eef47b0cad5].

FossilOrigin-Name: eabe7f2d4ff0e0dd868dcab7ec1d4a9168a25f80d3a52f0eeea2f90bd33782f2
2019-05-08 17:27:18 +00:00
dan
a7be6f355c Fix VDBE opcodes OP_SeekLT and OP_SeekLE so that they work on intkey tables with non-numeric text values.
FossilOrigin-Name: 658b84d7f4a0886591c5aab30ed9e31c4a0f56db303eb863f24833ca37085d14
2019-05-08 11:52:13 +00:00
dan
9edd8c11ab Fix VDBE opcodes OP_SeekLT and OP_SeekLE so that they work on intkey tables with non-numeric text values.
FossilOrigin-Name: a870c196d78d8b72c7353fa0015e96b2abd4be154541d76328e3a4f9e5da5d04
2019-05-08 11:42:49 +00:00
drh
291508f62b Remove an ALWAYS() that was previously added by check-in [a0819086] but
which turns out can sometimes be false.

FossilOrigin-Name: ad8fc5d8b440c49df95328df0408be699dde5a1dbd195b3f1f32e5f765578032
2019-05-08 04:33:17 +00:00
drh
d2cfbea2a4 Remove a NEVER() that was added in the previous check-in because it is in fact
reachable.

FossilOrigin-Name: 74eba2558a81f9e790d95a12a0c5379d4f80b43c8698ef9d6a31ff8d160a53d8
2019-05-08 03:34:53 +00:00
drh
dfcecdfea8 Earlier detections of errors in the byte-offset-to-cell-content integer at
offset 5 in the header of a btree page.

FossilOrigin-Name: a0819086a521fb0ca4ffd12f959b168a89ea2e30a2844bbbd39831b2b9ecf29b
2019-05-08 00:17:45 +00:00
drh
2c45b67711 Generate all records for INSERT or UPDATE prior to running foreign key
constraint checks, since the FK checks might modify the datatype of registers
used to generate the records.  Fix for ticket [e63cbcfd3378afe6980d6].

FossilOrigin-Name: 3c75605b4652ae88659465d832953ac9d467369f9cb417f73b3d8599ec60b18b
2019-05-07 20:06:41 +00:00
dan
f116ad8527 Do not commit an "OR FAIL" statement that causes foriegn key constraint violations.
FossilOrigin-Name: 659c551dcc374a0d349ba9419f692e3363839e11d791a17cc35fa1854a674a51
2019-05-07 19:44:11 +00:00
dan
244edd01d3 Add test cases for the fix on this branch.
FossilOrigin-Name: 2e31abe0ae5937a8ce10179e0ae045ee4c5ed8b7e2622ab41243226c6d3f5425
2019-05-07 19:21:58 +00:00
drh
a7c3b93fa6 On an INSERT or UPDATE, generate the new table record prior to running
foreign key checks, in case the foreign key checks changes datatypes on
the registers holding column values.  Proposed fix for ticket
[e63cbcfd3378afe6980d626].

FossilOrigin-Name: 3f1c8051648a341db4dffad66d3b1f9980d8a2b314cb0ce879cb2a10d1779b84
2019-05-07 19:13:42 +00:00
drh
dd2d9a3d5a Strive to prevent harmless compiler warnings in GCC 4.8.5.
FossilOrigin-Name: 8b6691f619ed9a56f6aecbd878ebb447c40984f8767508b248494fd9ec68fbaa
2019-05-07 17:47:43 +00:00
dan
f4f86f3fca Optimize the restarting of an RBU vacuum.
FossilOrigin-Name: 82062351a62f4ccc438a2b47a22ee581bd030dec952fecd610f360a25002a5ea
2019-05-07 16:37:37 +00:00
dan
126537e1dc Remove some redundant code from sqlite3rbu.c. Add test cases for RBU vacuum.
FossilOrigin-Name: 7b051698d8a763d9db190fd662931266d24a4982f34f100a28641934c222e37b
2019-05-07 16:28:50 +00:00
dan
57c4514720 Optimize further cases of restarting an RBU vacuum.
FossilOrigin-Name: 6b3261bfa1d762aa29a57244a30cf5e35655f1fe9c30ee682c186dec29d7a2c2
2019-05-06 20:40:23 +00:00
dan
f9b0c45161 Fix a problem with renaming an INTEGER PRIMARY KEY column of a WITHOUT ROWID table using ALTER TABLE.
FossilOrigin-Name: 91f701d39852ef1ddb29d1527d1520867c5efea110333315c55d8b08084384e7
2019-05-06 16:15:28 +00:00
dan
c245855702 Optimize some cases of restarting an RBU vacuum.
FossilOrigin-Name: cdc09867ed6522026ae7bfac1f59cd79b60fba6d07d49b99b030a501a7059ee4
2019-05-04 20:04:42 +00:00
drh
664d6d139e Fix the NOT NULL logic in the theorem prover that determines when a partial
index can be used.  Ticket [5c6955204c392ae763a95].

FossilOrigin-Name: c2e439bccc40825e211bfa9a88e6a251ff066ca7453d4e7cb5eab56ce7332635
2019-05-04 17:32:07 +00:00
mistachkin
bc8b231098 Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: 5862b83eb36b93016d37e5b86ebb183d891bb553901facab1e5d83e114a38ec3
2019-05-04 03:56:47 +00:00
drh
b1d93be142 In the sqlite3_value or Mem object, make the MEM_IntReal type completely
independent from MEM_Int and MEM_Real. This helps avoid problems when
inserting non-float values into a "REAL" column.

FossilOrigin-Name: 5a8a23ee5f60a31dbd167a0966d1ab3d0f1c07df2251906cb73f23d1f5466b46
2019-05-04 01:41:18 +00:00
drh
3242c69c91 New testcase macros to ensure that MEM_IntReal is fully tested.
FossilOrigin-Name: 8b8ef445ccccc148af2cda5975986af0d134352fe16283f65d0f8a91c9ffa932
2019-05-04 01:29:13 +00:00
drh
0c8f40389e Add the SQLITE_TESTCTRL_RESULT_INTREAL test-control and use it to create
the intreal() SQL function in testfixture.  Write a few simple tests to
prove this all works.  TH3 will hold most of the INTREAL tests, probably.

FossilOrigin-Name: c9838731325e0ca73bd8784c10c74ae043fed7861e6de269fd90e29fa4a19955
2019-05-03 21:17:28 +00:00
drh
30d3b0ceb5 Ensure that UTF16 strings are properly zero-terminated before returning them
in an sqlite3_value_text16() request, even if the string is invalid UTF16
because it was formed from an arbitrary and/or odd-length BLOB.

FossilOrigin-Name: 3a16ddf91f0c9c516a7fc2a9d4a4f69a8326f9b8ea66421e9ef1a2d663687b70
2019-05-03 19:34:41 +00:00
dan
a51297200f Fix a memory-leak/segfault caused by using OP_OpenDup and OP_OpenEphemeral on the same VM cursor.
FossilOrigin-Name: a9b90aa12eecdd9f2a8b2d23da8b7cac43d8b1789f5cefa3f4e939d9f2b59269
2019-05-03 18:50:24 +00:00
dan
ac4085bc2c Fix a problem where self-joins on views that are aggregate queries may return the wrong result.
FossilOrigin-Name: 74ef97bf51dd531a277cf22fa4d42043d93799d5a5bd550812648834460fe0b7
2019-05-03 17:19:10 +00:00
drh
f2566c4132 Improved comments on the elements of the array constant used to implement
the sqlite3_value_type() interface.

FossilOrigin-Name: f73a7de7a53f6aa6517221550a9c9882893206edfd7433e80e5fc0f441db9fc4
2019-05-03 17:08:16 +00:00
drh
5bf4644f41 Fix the ".open --hexdb" command in the CLI so that it works even with
terminal input.

FossilOrigin-Name: 9b5d943426c9273162ecb4c561eb3b25e843318dd438239c882c9db50f788454
2019-05-03 02:41:36 +00:00
drh
169f077e07 Make MEM_IntReal a completely independent type, meaning a floating point
value stored as an integer.  This fixes a problem with arithmetic within
arguments to string functions on indexes of expressions.  But it is a big
change and needs lots of new testcase() macros for MC/DC and so it is
initially put on this branch.

FossilOrigin-Name: dba836e31cb29d339b4520acb06188a892a52e45c50aba9742966b01108e251a
2019-05-02 21:36:26 +00:00
drh
de7109e61b Ensure that the typeof() function always returns SQLITE_FLOAT for floating
point values even when the value is stored as an integer to save space.

FossilOrigin-Name: 48889530a9de22fee536edfd1627be62396ed18d842d5fd6d91e010b4337be95
2019-05-02 17:45:52 +00:00
dan
ee253f7881 Add options to wapptest.tcl similar to those supported by releasetest.tcl. Also add the -noui switch, for running without wapp altogether.
FossilOrigin-Name: 005a169406ccea6e3cc42271620870d985e8bada1ad49a63656003db4911cb51
2019-05-02 17:06:01 +00:00
drh
e12ca5abf6 Earlier detection of a database corruption case in balance_nonroot(), to
prevent a possible use of an uninitialized variable.

FossilOrigin-Name: c509d8a8aebe0da4847e95cf737c21313a665de9a540da2db57b8ed22f98a402
2019-05-02 15:56:39 +00:00
drh
cf1747b782 The collating sequence of the column must be TEXT if the LIKE or GLOB pattern
starts with a "+" sign.  This is another case of ticket
[c94369cae9b561b1f996d005] that was discovered by Manuel Rigger.

FossilOrigin-Name: b043a54c3de54b286c4eae564eab6b99118a410d99bdb63480faba3123d2ca11
2019-05-02 01:41:53 +00:00
drh
01325a3f75 Fix an issue (discovered by OSSFuzz) in the enhanced OP_Concat operator
from check-in [713caa382cf7dd] earlier today.

FossilOrigin-Name: 3e897702f8f789fe5119b9042fb93eca3fbfcc44564fbfa66c65628725b1157d
2019-05-02 00:52:50 +00:00
drh
7d0a3fd340 Add a test case for ticket [ae0f637bddc5290b44669e066a].
FossilOrigin-Name: ece481695fc3c959c3eba0fb485cdda43a10b06d17259b0121e15bfc5e8e8b9f
2019-05-01 19:01:27 +00:00
drh
83a1dafb03 When values have real affinity and are converted into strings for CHECK
constraints or index expressions, do the conversions into a real-number format
even if the values are stored as integers for efficiency.
This appears to fix ticket [ae0f637bddc5290b446].

FossilOrigin-Name: 5997d075665faca6b70fa647e877ebc84c473b32887b96235865d59ce80247f8
2019-05-01 18:59:33 +00:00
dan
f78408c775 Fix an incompatibility with -DSQLITE_OMIT_LOAD_EXTENSION=1 in dbdata.test.
FossilOrigin-Name: a77cd85b1a8b86e71b511f05f8c67faa046d24a48684139d2f64e51249203411
2019-05-01 17:36:56 +00:00
dan
0de0ab8207 Fix a case in wapptest.tcl where a failed test might report 0 errors.
FossilOrigin-Name: 2be1ed70df605663822d1afdde757f426ccf2ee38add8dc6b6bb4fc4d90a31dc
2019-05-01 17:32:36 +00:00
drh
8a7e11fb78 Avoid unwelcomed side effects on the input operands in the OP_Concat
operator.  Fix for ticket [3be1295b264be2fac49b681]

FossilOrigin-Name: 713caa382cf7ddef872e510a76a5fca40be1a8d8876ce2f91b632bb0810a6630
2019-05-01 15:32:40 +00:00
dan
c97001fd55 Update wapptest.tcl so that it deletes extra files if the "Keep files:" checkbox is clear. Set it by default.
FossilOrigin-Name: 09623cc4cc82e3c123d1fd5d88b2f4b50ec5f2cc7e579a7203258bf0c246a74f
2019-05-01 15:25:38 +00:00
drh
6fcc1ecc99 In "PRAGMA vdbe_trace" output, show the results of OP_Affinity opcodes.
FossilOrigin-Name: 56604bb60a8ebac8d2854628d1b052d594d7effe14be8333977995dc07b65114
2019-05-01 14:41:47 +00:00
dan
a3e086d803 Fix an incompatibility with auto-vacuum mode in new test script recover.test.
FossilOrigin-Name: 36dd5b0804797a35d0dc596b6ca4f71813a155c5a470237ab6e3d1bcd9ccc6be
2019-05-01 08:48:44 +00:00
dan
919458923d Update wapptest.tcl to use a simpler slave script. And to leave scripts wapptest_configure.sh and wapptest_make.sh in each test directory.
FossilOrigin-Name: 07e527d781838412b2a434e64baaa49cbf7410a51c7393f54adc7b8eaffd5229
2019-04-30 20:43:10 +00:00
dan
c589acbc50 Fix a problem allowing a Table object to be deleted from within a call to the xDestroy method of the associated virtual table, causing a use-after-free error.
FossilOrigin-Name: 1dbbb0101e8213b92b9a4c78c0fd2f9d0240a8ea3b40dff1033d1b8d71fb04ef
2019-04-30 15:36:32 +00:00
drh
f135cb7d7f Fix an error message in the Lemon parser generator.
FossilOrigin-Name: b6d7d42b7426622a26b67809cd1f21285fea120aa1897377b9946840463b41f1
2019-04-30 14:26:31 +00:00
drh
cf83323936 Small performance increase and size reduction in the implementation of the
LIKE and GLOB operators.

FossilOrigin-Name: f97626f921dafe596b615a168ef31987f4a1c0b52956443e1a5c1148b49cab74
2019-04-30 11:54:36 +00:00
drh
b70b0df8eb Slightly smaller and faster implementation of the OP_MakeRecord opcode.
FossilOrigin-Name: 3bdce7ef1a6bb03affe978243fec603d5a55c071aa6d87c469a3c199d23f3b5e
2019-04-30 01:08:42 +00:00
drh
3af1b60e3a Changes to oserror.test so that it works even on systems that allow
an unusually large number of file descriptors.

FossilOrigin-Name: a27b0b880d76c6838c0365f66bcd69b1b49b7594470993b608f4e490cbdc4882
2019-04-29 16:44:11 +00:00
drh
4baa75b32f Do not de-duplicate columns index columns associated with a WITHOUT ROWID table
if the columns have different collating sequences.  This is the fix for
ticket [3182d3879020ef3b2].  There is one test case added, but most of the
tests are done in TH3.

FossilOrigin-Name: 1b1dd4d48cd79a585e1fa7ee79128e9f2a9ee9846339dc56bbd67b75112dcad5
2019-04-29 13:48:45 +00:00
drh
c19b63c9a3 Improved header comment and precondition checking for the new isDupColumn()
function.

FossilOrigin-Name: 740d5ff6cc9bf7b151dfb8b27409e5923cfb2789b5398fe13d89563aff8ffc07
2019-04-29 13:30:16 +00:00
dan
51f5ffa1a4 Fix a buffer overwrite in shell.c.in (part of the new .recover code).
FossilOrigin-Name: 92facbc73a940d2844ac88fafd2d2dadb10886fb0b7c53e23f346d18fa6d6327
2019-04-29 11:41:46 +00:00
dan
490e6f2506 Fix a stack overflow that could occur when renaming a table that has a trigger containing a window function invocation that itself contains a specific syntax error.
FossilOrigin-Name: c621fc668c6538f9f5bdac204f012c64998679a61aa8e224d212503820224c09
2019-04-29 11:27:58 +00:00
drh
f78d0f426c Take collating sequence into account when removing redundant columns from
indexes on WITHOUT ROWID tables.  This is the first proof-of-concept fix
for ticket [3182d3879020ef3]. More testing needed.

FossilOrigin-Name: b34fa5bff40d3d364bd8c80e7de55c606ef3caac47b14b5265ebcb38857eb85e
2019-04-28 19:27:02 +00:00
dan
73c0d272a9 Add the ".recover" command to the shell tool. For recovering as much data as possible from corrupt databases.
FossilOrigin-Name: 50fe48458942fa7a6bcc76316c6321f95b23dc34f2f8e0a483826483b2fb16f6
2019-04-27 20:30:19 +00:00
drh
6c59136498 Fix a minor typo in a comment. No changes to code.
FossilOrigin-Name: 95209072176ff21a91e96d5bd014b35ef100da2b0b93958baf6df4294a8daa85
2019-04-27 20:16:42 +00:00