Commit Graph

11280 Commits

Author SHA1 Message Date
drh
cf9f83dca2 Merge the fork that resulted from a check-in race.
FossilOrigin-Name: b7fe4f362bdf7b233a7b09eb9ce16d296165f82a
2013-08-16 14:51:32 +00:00
drh
0e1f0029c0 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
2013-08-16 14:49:00 +00:00
dan
22d73b1cbe 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
2013-08-16 14:48:23 +00:00
dan
585c823256 Add extra tests. No code changes.
FossilOrigin-Name: 949127d53e0a907ed6f73c6828637d94b265468c
2013-08-16 14:23:02 +00:00
dan
c367d4c052 Avoid buffer overreads and false OOM error reports that could be caused by corrupted sample records in the sqlite_stat4 table.
FossilOrigin-Name: 9f85b6a52a0b9b1524daa6f24d85257e7f591e95
2013-08-16 14:09:43 +00:00
drh
61b3440603 Fix a potential segfault following an OOM while running ANALYZE.
FossilOrigin-Name: 0118797823c9093e68113578f3f3aae65de41453
2013-08-16 13:34:50 +00:00
drh
d94f512f58 Merge recent trunk changes into the STAT4 branch.
FossilOrigin-Name: c69b512af276a438399747af22659415af3a5d4d
2013-08-16 12:26:33 +00:00
drh
0af16ab2c2 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
2013-08-15 22:40:21 +00:00
drh
e35463b312 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
2013-08-15 20:24:27 +00:00
mistachkin
fc7df53aee Make it easy to attach a debugger the test fixture process prior to any tests being run.
FossilOrigin-Name: 53cd9ebfaf401c7932bf591e134a527c9962b88e
2013-08-15 20:05:03 +00:00
dan
0adbed8a60 Fix a crash that can occur if the sqlite_stat3 or sqlite_stat4 table is corrupt.
FossilOrigin-Name: d51df8a8fcc31c37f6e1c9612204af5738ed865e
2013-08-15 19:56:32 +00:00
dan
af2583c83c Fix a crash that can occur following an OOM fault.
FossilOrigin-Name: 9f80b2687012ab7c4d6d654fe19f40878bd78bd8
2013-08-15 18:43:21 +00:00
dan
3bc9f74fe9 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
2013-08-15 16:18:39 +00:00
drh
f0459fc410 Make sure the ANALYZE command allocates enough VDBE registers.
FossilOrigin-Name: 46fec9b1a1c4616df5a634dbf9235bd13408d3a9
2013-08-15 16:15:00 +00:00
dan
1f616ad8fa Add tests for sqlite_stat4 sample selection. And a fix for the same.
FossilOrigin-Name: 1fb4d9d6f2675515feb8e3d971bbd54716372549
2013-08-15 14:39:09 +00:00
drh
26080d9241 Clarification and typo fixes in comments related to name resolution.
No changes to code.

FossilOrigin-Name: f30abdf9d814d6c75bf1c803054737c737ad636f
2013-08-15 14:27:42 +00:00
mistachkin
1f28e0703f Make it easy to attach a debugger the test fixture process prior to any tests being run.
FossilOrigin-Name: c23acba11bfefc019b5945cfb345f9afcf4b6242
2013-08-15 08:06:15 +00:00
dan
f00e902580 Change the way ANALYZE works to use a single cursor when scanning indices.
FossilOrigin-Name: bdce612b35193abf72de1a563ea7962375b3574e
2013-08-14 19:54:12 +00:00
mistachkin
3dfaf6766c Fix a few more minor comment typos. No changes to code.
FossilOrigin-Name: 9e999081a59b161a0a1f968fbc01a1db9ea43b93
2013-08-14 00:20:23 +00:00
mistachkin
037933b8a7 Fix an outdated comment and a comment typo. No changes to code.
FossilOrigin-Name: ac336959490083ffeaaf25aaec97ecb59a2f4536
2013-08-13 22:33:41 +00:00
dan
8ad169abb4 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
2013-08-12 20:14:04 +00:00
dan
86f69d98d2 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
2013-08-12 17:31:32 +00:00
drh
6b0ae91930 Handle a NULL input to decodeIntArray() that can result from a prior OOM.
FossilOrigin-Name: fa1588adab6759fd3d1be02524aa19a0d1c6adaa
2013-08-12 17:00:08 +00:00
dan
0106e378f1 Re-enable reading from the sqlite_stat3 table (as well as sqlite_stat4).
FossilOrigin-Name: 6d45078e621526fc2bac0eaefbb0f9602b9a8ec5
2013-08-12 16:34:32 +00:00
dan
5133c78cae Fix a bug in calculating the average number of entries for keys not present in the sqlite_stat4 table.
FossilOrigin-Name: ec3ffb174844406a6186c3dcc41b76d0331b502c
2013-08-12 11:21:10 +00:00
dan
568cd51b79 Fix minor problems caused by adding the rowid to the records in stat4.
FossilOrigin-Name: 088d1ff94890ada50d43e6a366a58167ec5a8e96
2013-08-12 09:29:04 +00:00
dan
dd6e1f193e Add the rowid field to the end of sample records stored in the sqlite_stat4 table.
FossilOrigin-Name: 3a5e8ab7ddbe1d943b35ef329fe4e5a1bfdb0d9d
2013-08-10 19:08:30 +00:00
dan
84d4fcc52d Fix a couple of typos in a comment in analyze.c. No code changes.
FossilOrigin-Name: 5bcccb93df98f5dfee0ea4d797b07fe0257258a9
2013-08-09 19:04:07 +00:00
drh
c8af850479 Update the header comment on analyze.c to describe the sqlite_stat4 table
format.

FossilOrigin-Name: 4d97809d6b29809f12d753043bda1976bdb1bd3b
2013-08-09 14:07:55 +00:00
dan
b3c02e210f 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
2013-08-08 19:38:40 +00:00
dan
84c309b6ae Use a binary search instead of a linear scan when comparing a sample key against data from the sqlite_stat4 table.
FossilOrigin-Name: e50dc30523210ba12324d5d8379503610f13aa34
2013-08-08 16:17:12 +00:00
drh
ab80be99e3 If the SQLITE_EXTRA_INIT function is defined, make sure it is called only
once by the effective sqlite3_initialize() call.

FossilOrigin-Name: e2b597cafe7c8a8313b051d6a302fed54f235727
2013-08-08 14:38:45 +00:00
dan
ad45ed7414 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
2013-08-08 12:21:32 +00:00
dan
6cb8d76ccb Fix a bug in using stat4 data to estimate the number of rows selected by a range constraint.
FossilOrigin-Name: f783938ea999731ea073cd2c78e278095f7bea6d
2013-08-08 11:48:57 +00:00
drh
869c0409e3 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
2013-08-07 23:15:52 +00:00
dan
eea568d68e 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
2013-08-07 19:46:15 +00:00
dan
3d40759803 Merge latest trunk changes with this branch.
FossilOrigin-Name: 08f74c45ecf711a2373af578d44470add9082377
2013-08-07 18:42:27 +00:00
dan
32c693a6e6 Fix typos in a comment in analyze.c. No code changes.
FossilOrigin-Name: 812ed0c58fc5f729a2d4f16775fad6724cc367a6
2013-08-07 16:38:33 +00:00
dan
1f28eaddc4 Change the way samples for the sqlite_stat4 table are collected.
FossilOrigin-Name: 13ed5ac13562e7a39905d70fd47059f4d8001bba
2013-08-07 16:15:32 +00:00
drh
7ed103210d Fix the ".dump" command on the command-line shell so that it works for
"sqlite_stat4" in addition to "sqlite_stat1".

FossilOrigin-Name: 1e80c4b12dbb5beab422e2a33a8782ac9d767321
2013-08-07 16:04:27 +00:00
drh
4bfd4ad9a7 Remove the unused sqlite3Utf8to16() utility function.
FossilOrigin-Name: 9159b43eb2cb5d6ed18a5ad168fa27134fec2553
2013-08-07 15:57:24 +00:00
dan
87cd93215e 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
2013-08-07 15:52:41 +00:00
drh
3b449ee481 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
2013-08-07 14:18:45 +00:00
drh
4a6fc3596b Fix typos and add clarification to comments in where.c. No code changes.
FossilOrigin-Name: f8d8790ede0fcaf6c5b60ac22919c1d97c74e838
2013-08-07 01:18:38 +00:00
dan
ddc2d6e8f5 Fixes for builds without SQLITE_ENABLE_STAT4.
FossilOrigin-Name: 84999e27cc0d14b89d9fe024e29d287c69285369
2013-08-06 20:15:06 +00:00
dan
7a4192358a 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
2013-08-06 20:01:43 +00:00
drh
9fe809c561 Fix a test case related to partial indices so that it works even if
STAT3 is disabled.

FossilOrigin-Name: 153c645025637bbff14dfce793e4b92210ded7e8
2013-08-06 19:18:17 +00:00
drh
d3f4964168 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
2013-08-06 18:35:31 +00:00
drh
d9b8c0d761 Update the configure script to use the latest version number (3.8.0).
FossilOrigin-Name: 52e8ec5e24730efa6d89cbaf1e03bc1d5c59cc05
2013-08-06 18:21:21 +00:00
drh
812ea83343 Add a testcase() macro to verify OOM coverage.
FossilOrigin-Name: d43dcbc488120aeb7104ab9e6a27f62bb348bf6a
2013-08-06 17:24:23 +00:00