Commit Graph

20631 Commits

Author SHA1 Message Date
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