]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
11 years agoAdjustments to #ifdefs in analyze.c to all a clean compile with no sqlite_stat4
drh [Sat, 17 Aug 2013 18:57:15 +0000 (18:57 +0000)] 
Adjustments to #ifdefs in analyze.c to all a clean compile with no
extra code with both ENABLE_STAT3 and ENABLE_STAT4 and with neither.

FossilOrigin-Name: f86b75b6c7290ee6ddb3636090b00e99fc68c45e

11 years agoAdd a test for the problem fixed by [91733bc485].
dan [Fri, 16 Aug 2013 17:46:49 +0000 (17:46 +0000)] 
Add a test for the problem fixed by [91733bc485].

FossilOrigin-Name: 5c591104813a7e55e59f4f557cbb3e500fa817c2

11 years agoIn sqlite3Stat4ProbeSetValue() change a local variable name iVar to iBindVar
drh [Fri, 16 Aug 2013 17:18:02 +0000 (17:18 +0000)] 
In sqlite3Stat4ProbeSetValue() change a local variable name iVar to iBindVar
to avoid confusion with iVal, and fix a place where the name was actually
confused.

FossilOrigin-Name: 91733bc4856034c10bc2ba0acdae1970b05d62b9

11 years agoMerge the fork that resulted from a check-in race.
drh [Fri, 16 Aug 2013 14:51:32 +0000 (14:51 +0000)] 
Merge the fork that resulted from a check-in race.

FossilOrigin-Name: b7fe4f362bdf7b233a7b09eb9ce16d296165f82a

11 years agoFix valueFromExpr() so that it returns SQLITE_NOMEM following an OOM when
drh [Fri, 16 Aug 2013 14:49:00 +0000 (14:49 +0000)] 
Fix valueFromExpr() so that it returns SQLITE_NOMEM following an OOM when
changing text encodings.  Also fix some asserts to accommodate OOM errors.

FossilOrigin-Name: dc1ccd09c443cebc4731dbe1a0dea84a9ccf6a9b

11 years agoFixes for test code that was not working with utf16 databases. Run the analyze*.test...
dan [Fri, 16 Aug 2013 14:48:23 +0000 (14:48 +0000)] 
Fixes for test code that was not working with utf16 databases. Run the analyze*.test scripts as part of the 'utf16' permutation test.

FossilOrigin-Name: fe99494d99df95f699ffab07b1e212800b5ff00d

11 years agoAdd extra tests. No code changes.
dan [Fri, 16 Aug 2013 14:23:02 +0000 (14:23 +0000)] 
Add extra tests. No code changes.

FossilOrigin-Name: 949127d53e0a907ed6f73c6828637d94b265468c

11 years agoAvoid buffer overreads and false OOM error reports that could be caused by corrupted...
dan [Fri, 16 Aug 2013 14:09:43 +0000 (14:09 +0000)] 
Avoid buffer overreads and false OOM error reports that could be caused by corrupted sample records in the sqlite_stat4 table.

FossilOrigin-Name: 9f85b6a52a0b9b1524daa6f24d85257e7f591e95

11 years agoFix a potential segfault following an OOM while running ANALYZE.
drh [Fri, 16 Aug 2013 13:34:50 +0000 (13:34 +0000)] 
Fix a potential segfault following an OOM while running ANALYZE.

FossilOrigin-Name: 0118797823c9093e68113578f3f3aae65de41453

11 years agoMerge recent trunk changes into the STAT4 branch.
drh [Fri, 16 Aug 2013 12:26:33 +0000 (12:26 +0000)] 
Merge recent trunk changes into the STAT4 branch.

FossilOrigin-Name: c69b512af276a438399747af22659415af3a5d4d

11 years agoMake sure that GROUP BY terms select input column names in preference to
drh [Thu, 15 Aug 2013 22:40:21 +0000 (22:40 +0000)] 
Make sure that GROUP BY terms select input column names in preference to
output column names, in compliance with the SQL standard.
Ticket [1c69be2dafc28].

FossilOrigin-Name: f2d175f975cd0be63425424ec322a98fb650019e

11 years agoBare identifiers in ORDER BY clauses bind more tightly to output column name,
drh [Thu, 15 Aug 2013 20:24:27 +0000 (20:24 +0000)] 
Bare identifiers in ORDER BY clauses bind more tightly to output column name,
but identifiers in expressions bind more tightly to input column names.
This is a compromise between SQL92 and SQL99 behavior and is what
PostgreSQL and MS-SQL do.  Ticket [f617ea3125e9c].

FossilOrigin-Name: c78b357c00a35ed48ce2ffbc041de8d22570d1e2

11 years agoMake it easy to attach a debugger the test fixture process prior to any tests being...
mistachkin [Thu, 15 Aug 2013 20:05:03 +0000 (20:05 +0000)] 
Make it easy to attach a debugger the test fixture process prior to any tests being run.

FossilOrigin-Name: 53cd9ebfaf401c7932bf591e134a527c9962b88e

11 years agoFix a crash that can occur if the sqlite_stat3 or sqlite_stat4 table is corrupt.
dan [Thu, 15 Aug 2013 19:56:32 +0000 (19:56 +0000)] 
Fix a crash that can occur if the sqlite_stat3 or sqlite_stat4 table is corrupt.

FossilOrigin-Name: d51df8a8fcc31c37f6e1c9612204af5738ed865e

11 years agoFix a crash that can occur following an OOM fault.
dan [Thu, 15 Aug 2013 18:43:21 +0000 (18:43 +0000)] 
Fix a crash that can occur following an OOM fault.

FossilOrigin-Name: 9f80b2687012ab7c4d6d654fe19f40878bd78bd8

11 years agoChange some assert() statements in vdbe.c to ensure that a memory cell used to store...
dan [Thu, 15 Aug 2013 16:18:39 +0000 (16:18 +0000)] 
Change some assert() statements in vdbe.c to ensure that a memory cell used to store a VdbeCursor object is not also used for some other purpose.

FossilOrigin-Name: 71070c9fce86103f174220e07771df99b2e01405

11 years agoMake sure the ANALYZE command allocates enough VDBE registers.
drh [Thu, 15 Aug 2013 16:15:00 +0000 (16:15 +0000)] 
Make sure the ANALYZE command allocates enough VDBE registers.

FossilOrigin-Name: 46fec9b1a1c4616df5a634dbf9235bd13408d3a9

11 years agoAdd tests for sqlite_stat4 sample selection. And a fix for the same.
dan [Thu, 15 Aug 2013 14:39:09 +0000 (14:39 +0000)] 
Add tests for sqlite_stat4 sample selection. And a fix for the same.

FossilOrigin-Name: 1fb4d9d6f2675515feb8e3d971bbd54716372549

11 years agoClarification and typo fixes in comments related to name resolution.
drh [Thu, 15 Aug 2013 14:27:42 +0000 (14:27 +0000)] 
Clarification and typo fixes in comments related to name resolution.
No changes to code.

FossilOrigin-Name: f30abdf9d814d6c75bf1c803054737c737ad636f

11 years agoMake it easy to attach a debugger the test fixture process prior to any tests being... dbgTestFixture
mistachkin [Thu, 15 Aug 2013 08:06:15 +0000 (08:06 +0000)] 
Make it easy to attach a debugger the test fixture process prior to any tests being run.

FossilOrigin-Name: c23acba11bfefc019b5945cfb345f9afcf4b6242

11 years agoChange the way ANALYZE works to use a single cursor when scanning indices.
dan [Wed, 14 Aug 2013 19:54:12 +0000 (19:54 +0000)] 
Change the way ANALYZE works to use a single cursor when scanning indices.

FossilOrigin-Name: bdce612b35193abf72de1a563ea7962375b3574e

11 years agoFix a few more minor comment typos. No changes to code.
mistachkin [Wed, 14 Aug 2013 00:20:23 +0000 (00:20 +0000)] 
Fix a few more minor comment typos.  No changes to code.

FossilOrigin-Name: 9e999081a59b161a0a1f968fbc01a1db9ea43b93

11 years agoFix an outdated comment and a comment typo. No changes to code.
mistachkin [Tue, 13 Aug 2013 22:33:41 +0000 (22:33 +0000)] 
Fix an outdated comment and a comment typo.  No changes to code.

FossilOrigin-Name: ac336959490083ffeaaf25aaec97ecb59a2f4536

11 years agoIf ENABLE_STAT3 is defined but ENABLE_STAT4 is not, have ANALYZE create and populate...
dan [Mon, 12 Aug 2013 20:14:04 +0000 (20:14 +0000)] 
If ENABLE_STAT3 is defined but ENABLE_STAT4 is not, have ANALYZE create and populate the sqlite_stat3 table instead of sqlite_stat4.

FossilOrigin-Name: cca8bf4372ab7a0258aa5c9397818415c6cf0abf

11 years agoIf there is data in both the sqlite_stat4 and sqlite_stat3 tables for a single index...
dan [Mon, 12 Aug 2013 17:31:32 +0000 (17:31 +0000)] 
If there is data in both the sqlite_stat4 and sqlite_stat3 tables for a single index, ignore the sqlite_stat3 records.

FossilOrigin-Name: 2a41736728d83a777ea8112da927cb047ec6684e

11 years agoHandle a NULL input to decodeIntArray() that can result from a prior OOM.
drh [Mon, 12 Aug 2013 17:00:08 +0000 (17:00 +0000)] 
Handle a NULL input to decodeIntArray() that can result from a prior OOM.

FossilOrigin-Name: fa1588adab6759fd3d1be02524aa19a0d1c6adaa

11 years agoRe-enable reading from the sqlite_stat3 table (as well as sqlite_stat4).
dan [Mon, 12 Aug 2013 16:34:32 +0000 (16:34 +0000)] 
Re-enable reading from the sqlite_stat3 table (as well as sqlite_stat4).

FossilOrigin-Name: 6d45078e621526fc2bac0eaefbb0f9602b9a8ec5

11 years agoFix a bug in calculating the average number of entries for keys not present in the...
dan [Mon, 12 Aug 2013 11:21:10 +0000 (11:21 +0000)] 
Fix a bug in calculating the average number of entries for keys not present in the sqlite_stat4 table.

FossilOrigin-Name: ec3ffb174844406a6186c3dcc41b76d0331b502c

11 years agoFix minor problems caused by adding the rowid to the records in stat4.
dan [Mon, 12 Aug 2013 09:29:04 +0000 (09:29 +0000)] 
Fix minor problems caused by adding the rowid to the records in stat4.

FossilOrigin-Name: 088d1ff94890ada50d43e6a366a58167ec5a8e96

11 years agoAdd the rowid field to the end of sample records stored in the sqlite_stat4 table.
dan [Sat, 10 Aug 2013 19:08:30 +0000 (19:08 +0000)] 
Add the rowid field to the end of sample records stored in the sqlite_stat4 table.

FossilOrigin-Name: 3a5e8ab7ddbe1d943b35ef329fe4e5a1bfdb0d9d

11 years agoFix a couple of typos in a comment in analyze.c. No code changes.
dan [Fri, 9 Aug 2013 19:04:07 +0000 (19:04 +0000)] 
Fix a couple of typos in a comment in analyze.c. No code changes.

FossilOrigin-Name: 5bcccb93df98f5dfee0ea4d797b07fe0257258a9

11 years agoUpdate the header comment on analyze.c to describe the sqlite_stat4 table
drh [Fri, 9 Aug 2013 14:07:55 +0000 (14:07 +0000)] 
Update the header comment on analyze.c to describe the sqlite_stat4 table
format.

FossilOrigin-Name: 4d97809d6b29809f12d753043bda1976bdb1bd3b

11 years agoFix problems in estimating the number of rows visited by a range query using sqlite_s...
dan [Thu, 8 Aug 2013 19:38:40 +0000 (19:38 +0000)] 
Fix problems in estimating the number of rows visited by a range query using sqlite_stat4 data when the column subject to the range query is not the leftmost of the index.

FossilOrigin-Name: 9228aaf54dd2700c4f460f94f9c2309407578983

11 years agoUse a binary search instead of a linear scan when comparing a sample key against...
dan [Thu, 8 Aug 2013 16:17:12 +0000 (16:17 +0000)] 
Use a binary search instead of a linear scan when comparing a sample key against data from the sqlite_stat4 table.

FossilOrigin-Name: e50dc30523210ba12324d5d8379503610f13aa34

11 years agoIf the SQLITE_EXTRA_INIT function is defined, make sure it is called only
drh [Thu, 8 Aug 2013 14:38:45 +0000 (14:38 +0000)] 
If the SQLITE_EXTRA_INIT function is defined, make sure it is called only
once by the effective sqlite3_initialize() call.

FossilOrigin-Name: e2b597cafe7c8a8313b051d6a302fed54f235727

11 years agoFix a segfault in "ALTER TABLE t1 ADD COLUMN b DEFAULT (-+1)". Also an assert() failu...
dan [Thu, 8 Aug 2013 12:21:32 +0000 (12:21 +0000)] 
Fix a segfault in "ALTER TABLE t1 ADD COLUMN b DEFAULT (-+1)". Also an assert() failure that could occur if SQLITE_ENABLE_STAT4 were not defined.

FossilOrigin-Name: 9fec3e38287067d60874530300fbeb602958c951

11 years agoFix a bug in using stat4 data to estimate the number of rows selected by a range...
dan [Thu, 8 Aug 2013 11:48:57 +0000 (11:48 +0000)] 
Fix a bug in using stat4 data to estimate the number of rows selected by a range constraint.

FossilOrigin-Name: f783938ea999731ea073cd2c78e278095f7bea6d

11 years agoIf the SQLITE_ALLOW_URI_AUTHORITY compile-time option is set, then allow
drh [Wed, 7 Aug 2013 23:15:52 +0000 (23:15 +0000)] 
If the SQLITE_ALLOW_URI_AUTHORITY compile-time option is set, then allow
non-localhost authorities on URI filenames and pass them through as a UNC
to the underlying VFS.

FossilOrigin-Name: 3adb6c1bfda897859dc9cf9ae7f1e6719855ee68

11 years agoReplace variable Index.avgEq (average number of rows in keys for which there is no...
dan [Wed, 7 Aug 2013 19:46:15 +0000 (19:46 +0000)] 
Replace variable Index.avgEq (average number of rows in keys for which there is no sample in sqlite_stat4) with vector Index.aAvgEq.

FossilOrigin-Name: 7b70b419c43b2c3b2daf11d833a1d60245bfaef5

11 years agoMerge latest trunk changes with this branch.
dan [Wed, 7 Aug 2013 18:42:27 +0000 (18:42 +0000)] 
Merge latest trunk changes with this branch.

FossilOrigin-Name: 08f74c45ecf711a2373af578d44470add9082377

11 years agoFix typos in a comment in analyze.c. No code changes.
dan [Wed, 7 Aug 2013 16:38:33 +0000 (16:38 +0000)] 
Fix typos in a comment in analyze.c. No code changes.

FossilOrigin-Name: 812ed0c58fc5f729a2d4f16775fad6724cc367a6

11 years agoChange the way samples for the sqlite_stat4 table are collected.
dan [Wed, 7 Aug 2013 16:15:32 +0000 (16:15 +0000)] 
Change the way samples for the sqlite_stat4 table are collected.

FossilOrigin-Name: 13ed5ac13562e7a39905d70fd47059f4d8001bba

11 years agoFix the ".dump" command on the command-line shell so that it works for
drh [Wed, 7 Aug 2013 16:04:27 +0000 (16:04 +0000)] 
Fix the ".dump" command on the command-line shell so that it works for
"sqlite_stat4" in addition to "sqlite_stat1".

FossilOrigin-Name: 1e80c4b12dbb5beab422e2a33a8782ac9d767321

11 years agoRemove the unused sqlite3Utf8to16() utility function.
drh [Wed, 7 Aug 2013 15:57:24 +0000 (15:57 +0000)] 
Remove the unused sqlite3Utf8to16() utility function.

FossilOrigin-Name: 9159b43eb2cb5d6ed18a5ad168fa27134fec2553

11 years agoWhen estimating the number of rows scanned using data from the sqlite_stat4 table...
dan [Wed, 7 Aug 2013 15:52:41 +0000 (15:52 +0000)] 
When estimating the number of rows scanned using data from the sqlite_stat4 table, avoid allocating UnpackedRecord and KeyInfo structures until they are definitely required.

FossilOrigin-Name: 353950a5269fa439cc3e57b62e16558a84ea2557

11 years agoAdd a guard #ifndef to test_intarray.h to prevent harm if it is #included
drh [Wed, 7 Aug 2013 14:18:45 +0000 (14:18 +0000)] 
Add a guard #ifndef to test_intarray.h to prevent harm if it is #included
more than once.  Add a comment on the closing #endif of the guards on
sqlite3.h and test_multiplex.h.

FossilOrigin-Name: 0ad83ceb79767738bd06a28840cf84da0464ab4f

11 years agoFix typos and add clarification to comments in where.c. No code changes.
drh [Wed, 7 Aug 2013 01:18:38 +0000 (01:18 +0000)] 
Fix typos and add clarification to comments in where.c.  No code changes.

FossilOrigin-Name: f8d8790ede0fcaf6c5b60ac22919c1d97c74e838

11 years agoFixes for builds without SQLITE_ENABLE_STAT4.
dan [Tue, 6 Aug 2013 20:15:06 +0000 (20:15 +0000)] 
Fixes for builds without SQLITE_ENABLE_STAT4.

FossilOrigin-Name: 84999e27cc0d14b89d9fe024e29d287c69285369

11 years agoWhen possible, use the multi-column samples in sqlite_stat4 to estimate the number...
dan [Tue, 6 Aug 2013 20:01:43 +0000 (20:01 +0000)] 
When possible, use the multi-column samples in sqlite_stat4 to estimate the number of index rows scanned by a query plan.

FossilOrigin-Name: 2973f5ca736c4a6f13c653d54b6a29d7cae8d0ed

11 years agoFix a test case related to partial indices so that it works even if
drh [Tue, 6 Aug 2013 19:18:17 +0000 (19:18 +0000)] 
Fix a test case related to partial indices so that it works even if
STAT3 is disabled.

FossilOrigin-Name: 153c645025637bbff14dfce793e4b92210ded7e8

11 years agoAdjust #ifdefs in test_autoext.c so that it compiles with
drh [Tue, 6 Aug 2013 18:35:31 +0000 (18:35 +0000)] 
Adjust #ifdefs in test_autoext.c so that it compiles with
SQLITE_OMIT_LOAD_EXTENSION.  Fix compiler warnings in two other
test modules.  No changes to the core.

FossilOrigin-Name: 89930ea3c3b3bd078f641b2c5203d851083bbf1a

11 years agoUpdate the configure script to use the latest version number (3.8.0).
drh [Tue, 6 Aug 2013 18:21:21 +0000 (18:21 +0000)] 
Update the configure script to use the latest version number (3.8.0).

FossilOrigin-Name: 52e8ec5e24730efa6d89cbaf1e03bc1d5c59cc05

11 years agoAdd a testcase() macro to verify OOM coverage.
drh [Tue, 6 Aug 2013 17:24:23 +0000 (17:24 +0000)] 
Add a testcase() macro to verify OOM coverage.

FossilOrigin-Name: d43dcbc488120aeb7104ab9e6a27f62bb348bf6a

11 years agoRemove unreachable branches in expr.c, replacing them with assert() and
drh [Tue, 6 Aug 2013 16:56:44 +0000 (16:56 +0000)] 
Remove unreachable branches in expr.c, replacing them with assert() and
testcase() statements.

FossilOrigin-Name: 9103c27ceb3f4023ea3a41b679a10717d3f80210

11 years agoFor the ".import" command of the command-line shell, start a transaction
drh [Tue, 6 Aug 2013 14:36:36 +0000 (14:36 +0000)] 
For the ".import" command of the command-line shell, start a transaction
if there is not one active already.

FossilOrigin-Name: 5dcc2d91bd343cd0fac79d3c8f079a5ce534cdf7

11 years agoClean up the input reader in the command-line shell for improved legibility
drh [Tue, 6 Aug 2013 14:01:46 +0000 (14:01 +0000)] 
Clean up the input reader in the command-line shell for improved legibility
and performance.

FossilOrigin-Name: 2b1743d60171635c1e5a6ede6b4928f4671f948d

11 years agoMore than double the speed of the resolveP2Values() routine in vdbeaux.c by
drh [Tue, 6 Aug 2013 07:45:08 +0000 (07:45 +0000)] 
More than double the speed of the resolveP2Values() routine in vdbeaux.c by
moving from an extended if-else on every opcode to a switch.  Opcodes are
reordered in mkopcodesh.awk to put the switched opcodes close together,
for additional performance and to reduce code footprint.

FossilOrigin-Name: 924f7e4d7a8fa2fe9100836663f3733b6e1a9084

11 years agoPerformance optimization: Avoid calling convertCompoundSelecctToSubquery()
drh [Mon, 5 Aug 2013 22:05:02 +0000 (22:05 +0000)] 
Performance optimization: Avoid calling convertCompoundSelecctToSubquery()
on queries that do not use the UNION, EXCEPT, or INTERSECT operators.

FossilOrigin-Name: c589b2fed7beabc2337d701094c22635914d9c23

11 years agoFor the vtshim module, always zero out the xChildDestroy function pointer after calli...
mistachkin [Mon, 5 Aug 2013 21:54:17 +0000 (21:54 +0000)] 
For the vtshim module, always zero out the xChildDestroy function pointer after calling it.

FossilOrigin-Name: 240f7252c66ad3ff5ae0ef06455c1ff9bd78bbb4

11 years agoFactor all KeyInfo object allocations into a single function:
drh [Mon, 5 Aug 2013 19:11:29 +0000 (19:11 +0000)] 
Factor all KeyInfo object allocations into a single function:
sqlite3KeyInfoAlloc().  Always allocate enough space so that
sqlite3VdbeRecordCompare() can avoid checking boundaries and hence
run faster.

FossilOrigin-Name: 7301bedd94c8610568349953b18ff3575203e1b2

11 years agoModify the vdbe code generated by ANALYZE to use fewer memory cells and cursor slots.
dan [Mon, 5 Aug 2013 19:04:07 +0000 (19:04 +0000)] 
Modify the vdbe code generated by ANALYZE to use fewer memory cells and cursor slots.

FossilOrigin-Name: 4a51cf289fad8aebc637b5f96488de18e861195d

11 years agoUse N separate cursors when scanning an index with N columns to collect sqlite_stat4...
dan [Mon, 5 Aug 2013 18:00:56 +0000 (18:00 +0000)] 
Use N separate cursors when scanning an index with N columns to collect sqlite_stat4 data. This fixes a problem with collecting incorrect nEq values from multi-column indexes.

FossilOrigin-Name: 3a71afe67418ce00097cd9714c395fe9ff16f23b

11 years agoImprove performance of sqlite3VdbeRecordCompare() by using an approximation
drh [Mon, 5 Aug 2013 15:32:09 +0000 (15:32 +0000)] 
Improve performance of sqlite3VdbeRecordCompare() by using an approximation
that might give false negatives and only running the more expensive exact
subexpression if the approximation fails.

FossilOrigin-Name: 28979dcd16f53e0ddca8eed74b668834e2856f03

11 years agoAdd a missing '#include "tcl.h"' to test_rtree.c.
drh [Mon, 5 Aug 2013 12:31:41 +0000 (12:31 +0000)] 
Add a missing '#include "tcl.h"' to test_rtree.c.

FossilOrigin-Name: 4b8b426f10f8ae13bf553f7adf5ae09383fa0bd4

11 years agoFix a couple of problems in code related to sqlite_stat4.
dan [Mon, 5 Aug 2013 05:34:30 +0000 (05:34 +0000)] 
Fix a couple of problems in code related to sqlite_stat4.

FossilOrigin-Name: badd24d987240db5528b37d1c177431617079f9b

11 years agoBegin adding experimental sqlite_stat4 table. This commit is buggy.
dan [Sat, 3 Aug 2013 20:24:58 +0000 (20:24 +0000)] 
Begin adding experimental sqlite_stat4 table. This commit is buggy.

FossilOrigin-Name: 2beea303a1d609cd2ff252412c50b966b9e5e8f1

11 years agoUpdates to requirements marks. No code changes.
drh [Fri, 2 Aug 2013 23:40:45 +0000 (23:40 +0000)] 
Updates to requirements marks.  No code changes.

FossilOrigin-Name: 213020769f310aec1591d97756b53891d0b64005

11 years agoAdd NEVER() and ALWAYS() macros on some unreachable yet prudent branches.
drh [Fri, 2 Aug 2013 20:11:19 +0000 (20:11 +0000)] 
Add NEVER() and ALWAYS() macros on some unreachable yet prudent branches.

FossilOrigin-Name: c5c0a8ab6c222185d5f9d4321e64d9f93cd36b7d

11 years agoAdd support for partial indices.
drh [Fri, 2 Aug 2013 16:41:02 +0000 (16:41 +0000)] 
Add support for partial indices.

FossilOrigin-Name: 478113f18b1d28606b107b5a0bed04cb90a82cf2

11 years agoSilently ignore database name qualifiers in CHECK constraints and in partial-indices
drh [Fri, 2 Aug 2013 14:18:18 +0000 (14:18 +0000)] 
Silently ignore database name qualifiers in CHECK constraints and in
partial index WHERE clauses.

FossilOrigin-Name: 2e8c845eb5011a2743dace333aa38383588f2080

11 years agoFix typos in documentation for SQLITE_DBSTATUS_DEFERRED_FKS .
drh [Fri, 2 Aug 2013 13:31:31 +0000 (13:31 +0000)] 
Fix typos in documentation for SQLITE_DBSTATUS_DEFERRED_FKS .
No changes to code.

FossilOrigin-Name: f3efbfcd515ad6ac833f4b26391dcc44603a96e8

11 years agoFix the CREATE INDEX statement so that trying to create a TEMP index on
drh [Thu, 1 Aug 2013 22:27:26 +0000 (22:27 +0000)] 
Fix the CREATE INDEX statement so that trying to create a TEMP index on
a non-TEMP table throws an error rather than segfaulting.

FossilOrigin-Name: e3c8935f8736d00dc83644fa21d86ca7fec6d2fc

11 years agoFix an incorrect expected result in a test case in corruptG.test.
drh [Thu, 1 Aug 2013 22:26:56 +0000 (22:26 +0000)] 
Fix an incorrect expected result in a test case in corruptG.test.

FossilOrigin-Name: 6913831ad2892fdc8331ee53426d935386eacb9e

11 years agoFix a potential buffer overread in sqlite3VdbeRecordCompare() when a
drh [Thu, 1 Aug 2013 20:26:04 +0000 (20:26 +0000)] 
Fix a potential buffer overread in sqlite3VdbeRecordCompare() when a
serial_type specifies a field that starts in bounds but is much too large
for the allocated buffer.  Mostly harmless.  The overread is unlikely to
go more than one or two bytes past the end of the buffer.

FossilOrigin-Name: e436b2f4e5c5e6b2f70e65332c0c7d618e2ef20a

11 years agoMake sure signed integer overflow does not cause a segfault while attempting
drh [Thu, 1 Aug 2013 19:17:39 +0000 (19:17 +0000)] 
Make sure signed integer overflow does not cause a segfault while attempting
to read a corrupt database where the header size varint on a record is larger
than the maximum 32-bit signed integer.

FossilOrigin-Name: c3baca99f4580652afb2c3f73036ab83796a1557

11 years agoAdd test case for the problem fixed by [127a5b776d].
dan [Thu, 1 Aug 2013 17:43:35 +0000 (17:43 +0000)] 
Add test case for the problem fixed by [127a5b776d].

FossilOrigin-Name: 65816718b59b286c11d939235a23c7325f25594b

11 years agoAn improved method for avoiding the use of the STAT3 samples to compute
drh [Thu, 1 Aug 2013 17:21:26 +0000 (17:21 +0000)] 
An improved method for avoiding the use of the STAT3 samples to compute
the estimated number of outputs when the left-most index is equality
constrained.  This check-in undoes the previous fix and applies a new one.

FossilOrigin-Name: 127a5b776d16e1e23c5b3d454f6aaea67f1ded3a

11 years agoAvoid using left-most column STAT3 samples if the left-most column has an
drh [Thu, 1 Aug 2013 16:52:50 +0000 (16:52 +0000)] 
Avoid using left-most column STAT3 samples if the left-most column has an
equality constrain and there are inequality constraints on the second column.

FossilOrigin-Name: 31b4e63b3c30fcad22340d84d6076a306f26b49e

11 years agoFix bug in the logic that determines the end of a CREATE INDEX statement.
drh [Thu, 1 Aug 2013 16:02:40 +0000 (16:02 +0000)] 
Fix bug in the logic that determines the end of a CREATE INDEX statement.
Added a VACUUM test case that exposed the bug.

FossilOrigin-Name: 2e3df0bc900c01286d3ce32c2bbf9e5293973f9b

11 years agoMore test cases and corresponding bug fixes.
drh [Thu, 1 Aug 2013 15:09:57 +0000 (15:09 +0000)] 
More test cases and corresponding bug fixes.

FossilOrigin-Name: 0c8cfdfae215c95cf167f404a1d346690b28e972

11 years agoFill out an initial implementation of the sqlite3ExprImpliesExpr() function.
drh [Thu, 1 Aug 2013 13:04:46 +0000 (13:04 +0000)] 
Fill out an initial implementation of the sqlite3ExprImpliesExpr() function.

FossilOrigin-Name: 8e07aa2ad5579aeb82174ce5bd432ddb9c058bc1

11 years agoRefactor internal function name sqlite3VdbeGetValue() to
drh [Thu, 1 Aug 2013 12:21:58 +0000 (12:21 +0000)] 
Refactor internal function name sqlite3VdbeGetValue() to
sqlite3VdbeGetBoundValue().

FossilOrigin-Name: 81834c3023876487a1188390aae850cf71683701

11 years agoFix the ANALYZE command to work with partial indices.
drh [Thu, 1 Aug 2013 04:39:17 +0000 (04:39 +0000)] 
Fix the ANALYZE command to work with partial indices.

FossilOrigin-Name: 60353124f4e965393ecd864019bdbca1999fb69e

11 years agoTest cases and bug fixes for the partial index logic.
drh [Thu, 1 Aug 2013 03:36:59 +0000 (03:36 +0000)] 
Test cases and bug fixes for the partial index logic.

FossilOrigin-Name: 6b73ae7c123801787c8994113cbeb87ee96ba653

11 years agoAdd the logic to keep partial indices up to date through DML statements and
drh [Thu, 1 Aug 2013 01:14:43 +0000 (01:14 +0000)] 
Add the logic to keep partial indices up to date through DML statements and
when new partial indices are created.  This new logic is untested except to
verify that it does not interfere with full indices.

FossilOrigin-Name: fb9044d15ad4fd6ae4a38858c0c0e6fe9d4faa25

11 years agoLimit the number of memset() calls used when determining a temporary file name on...
mistachkin [Wed, 31 Jul 2013 23:28:36 +0000 (23:28 +0000)] 
Limit the number of memset() calls used when determining a temporary file name on Windows.  Also, fix a harmless compiler warning.

FossilOrigin-Name: 136fc2931b156f91cdd76a7a009298cdf09d826a

11 years agoAdd logic to the query planner to only use partial indices if the WHERE clause
drh [Wed, 31 Jul 2013 23:22:39 +0000 (23:22 +0000)] 
Add logic to the query planner to only use partial indices if the WHERE clause
constrains the search to rows covered by the partial index.  This is just
infrastructure.  The key routine, sqlite3ExprImpliesExpr(), is currently a
no-op so that partial indices will never be used.

FossilOrigin-Name: 8ca3eac111e06a1854f878a74bffe8f20eb47f1b

11 years agoSlight modifications to path name translation handling for Cygwin.
mistachkin [Wed, 31 Jul 2013 22:39:26 +0000 (22:39 +0000)] 
Slight modifications to path name translation handling for Cygwin.

FossilOrigin-Name: 33ba1f4c5dc2ef8292adf17a32ade0cde0887d88

11 years agoUse a new error code to represent a failure to get the configured temporary directory...
mistachkin [Wed, 31 Jul 2013 22:27:16 +0000 (22:27 +0000)] 
Use a new error code to represent a failure to get the configured temporary directory on Windows.

FossilOrigin-Name: c93d891b03c626b9ed01ed5ef2f246b2d4a40a64

11 years agoThe MAX_PATH constant in windows is measured in characters, so multiple by 3
drh [Wed, 31 Jul 2013 19:55:25 +0000 (19:55 +0000)] 
The MAX_PATH constant in windows is measured in characters, so multiple by 3
to get the number of bytes assuming worst-case UTF8 pathnames.

FossilOrigin-Name: bb06e1579022c24546ac5117a99846b3c37ef59b

11 years agoResolve names in CREATE INDEX WHERE clauses and detect errors. Disallow
drh [Wed, 31 Jul 2013 19:05:22 +0000 (19:05 +0000)] 
Resolve names in CREATE INDEX WHERE clauses and detect errors.  Disallow
expressions that contain variables, subqueries, or functions.
The expression is still not used for anything, however.
still unused.

FossilOrigin-Name: f2aa7842c8b9df24294f09e2bde27b3f08c455c7

11 years agoHere begins an experimental branch for exploring the idea of a partial index.
drh [Wed, 31 Jul 2013 18:12:26 +0000 (18:12 +0000)] 
Here begins an experimental branch for exploring the idea of a partial index.
This check-in is able to parse a WHERE clause on a CREATE INDEX statement, but
does not actually do anythingn with that WHERE clause yet.

FossilOrigin-Name: 6794b2dcb48b3507caccfc7867fc185818cf8291

11 years agoReduce the size of the stack required by the codeOneLoopStart() function in
drh [Tue, 30 Jul 2013 15:10:32 +0000 (15:10 +0000)] 
Reduce the size of the stack required by the codeOneLoopStart() function in
where.c.

FossilOrigin-Name: eb6d4278b8516e0571269049d1eaa55066f51b1a

11 years agoFor the MSVC makefile, recompile vdbe.lo and parse.lo first.
mistachkin [Mon, 29 Jul 2013 19:03:20 +0000 (19:03 +0000)] 
For the MSVC makefile, recompile vdbe.lo and parse.lo first.

FossilOrigin-Name: 9e819f0f12b6f2a8e0e7a90251b3115ff1595f25

11 years agoComment and preprocessor macro cleanup.
drh [Mon, 29 Jul 2013 15:54:06 +0000 (15:54 +0000)] 
Comment and preprocessor macro cleanup.

FossilOrigin-Name: c0809b5e32c2ca0600098447a573e718eaeb319f

11 years agoIn main.mk, always recompile vdbe.o and parse.o first, since changes to either
drh [Mon, 29 Jul 2013 13:51:54 +0000 (13:51 +0000)] 
In main.mk, always recompile vdbe.o and parse.o first, since changes to either
parse.y or vdbe.c will cause all files to be recompiled and if there are
syntax errors in vdbe.c or parse.y we want to hit them early in the compile
process.

FossilOrigin-Name: a94a66d10f160ee79fffa8527655c2cc4a0c7103

11 years agoIn the command-line shell, work around the fact that popen() and pclose()
drh [Thu, 25 Jul 2013 17:07:03 +0000 (17:07 +0000)] 
In the command-line shell, work around the fact that popen() and pclose()
are not defined in stdio.h. in C89 and later.

FossilOrigin-Name: 8bcbb33fd0a970e16a920e1d35571836dbb9ba50

11 years agoFix a typo in main.c: SQLITE_DEAULT_AUTOMATIC_INDEX -> SQLITE_DEFAULT_AUTOMATIC_INDEX
dan [Thu, 25 Jul 2013 16:41:39 +0000 (16:41 +0000)] 
Fix a typo in main.c: SQLITE_DEAULT_AUTOMATIC_INDEX -> SQLITE_DEFAULT_AUTOMATIC_INDEX

FossilOrigin-Name: cc78e21c7794948a187e694773735058fc7460d7

11 years agoEnhance the progress handler so that it keeps track of the number of VDBE
drh [Thu, 25 Jul 2013 16:27:51 +0000 (16:27 +0000)] 
Enhance the progress handler so that it keeps track of the number of VDBE
cycles across sqlite3_step() calls and issues callbacks when the cumulative
instruction count reaches threshold.

FossilOrigin-Name: 4698a82ef855a8e56163622283fb25317d7efdc4

11 years agoAdd 'queryplantest' target to the MSVC makefile.
mistachkin [Sat, 20 Jul 2013 00:34:31 +0000 (00:34 +0000)] 
Add 'queryplantest' target to the MSVC makefile.

FossilOrigin-Name: ad0551e039ccaa9e7a28682b756b56ac2b8fef0d