Commit Graph

12153 Commits

Author SHA1 Message Date
drh
9dfaf621d1 Make sure ORDER BY clauses on joins that involve virtual tables and that
have a DISTINCT clause work correctly.  This is a candidate fix for
ticket [388d01d4bb8f9].  Test cases for that ticket will be checked in
separately.

FossilOrigin-Name: 171138122690faafde0dcab0201b90bdf02d3637
2014-04-25 14:42:17 +00:00
drh
a01c7c70fd When VDBE_PROFILE is enabled, ignore negative opcode times, which sometimes
occur, perhaps due to context swaps.

FossilOrigin-Name: 4e88042f9d3e678914da96c0eb276f3d8fca5a94
2014-04-25 12:35:31 +00:00
drh
f0582f43dd Comment tweaks on the test case for the [b75a9ca6b0] bug fix.
FossilOrigin-Name: 65d2544af9adc1e2f1d193e57f8be0422fb0d5eb
2014-04-21 13:36:54 +00:00
dan
374cd78c1d Avoid discarding an ORDER BY clause in the case where an identical GROUP BY clauses uses an index to group, but not sort, the rows. Fix for [b75a9ca6b0].
FossilOrigin-Name: de9a490f594183f337a2ec9e0f87792eac83548b
2014-04-21 13:21:56 +00:00
drh
b355c2cc12 Clean up the proper-subset cost adjustment logic to make it more compact
and easier to read and so that full branch test coverage is more easily
obtained.

FossilOrigin-Name: 9a5d38c79d2482a23bcfbc3ff35ca4fa269c768d
2014-04-18 22:20:31 +00:00
drh
71794dbaeb Add the SQLITE_RUNTIME_BYTEORDER compile-time option to force SQLite to check
the processor byte-order at run-time.  Add additional compile-time byte order
checks for ARM, PPC, and SPARC.

FossilOrigin-Name: 2c5363873a6f990a0abaacac6303acd46b48befc
2014-04-18 00:49:29 +00:00
drh
2cf4acbd9f Add the SQLITE_TESTCTRL_BYTEORDER test control to interrogate SQLite's notion
of the processor byte order and whether the byte order is known at compile-time
or determined at run-time.

FossilOrigin-Name: 9c6961967ae00e563ebe2859eaf2639a79f2cb01
2014-04-18 00:06:02 +00:00
drh
65b9ac5224 Make sure the undocumented sqlite_rename_parent() function does not
crash even if it is invoked with NULL arguments.
Ticket [264b970c4379fd4b94]

FossilOrigin-Name: c6fa8d0d82805be230f672eabccdfa5680d4ddfd
2014-04-14 19:48:25 +00:00
drh
d249090450 Remove the unused second argument from sqlite3ExprCachePop(). Add an
ALWAYS() on an always-true conditional in sqlite3VdbeResolveLabel().

FossilOrigin-Name: ab23abf392175d3e256ff619b13abbbe732a49ed
2014-04-13 19:28:15 +00:00
drh
87744513e7 Make sure column cache elements are cleared correctly when jumping over
code for key generation in a partial index. 
Fix for ticket [2ea3e9fe6379fc3f6].

FossilOrigin-Name: 3122b8364082be783821da01d4af2af6a9586327
2014-04-13 19:15:49 +00:00
drh
d83cad235a Modify the OR-clause handling so that it can safely deal with OR-clause
with 17 or more terms.  Fix for ticket [10fb063b1179be53ea0b53bb].

FossilOrigin-Name: a67b5312f63909737c052fe58ab5772d45530d49
2014-04-10 02:24:48 +00:00
drh
48e080b26c Performance improvements when reading large blobs, especially if
SQLITE_DIRECT_OVERFLOW_READ is defined.

FossilOrigin-Name: 2312eb6a9eb31051db4e0baf19e033ba39adc7b1
2014-04-04 18:49:19 +00:00
drh
853546d047 Merge changes to the query planner that strive to ensure that any index
usage that is a proper subset of some other index usage always has a slightly
higher cost.

FossilOrigin-Name: 683dd379a293b2f330e1e4cd746f190527fe48ee
2014-04-04 18:20:35 +00:00
drh
1fb6a11072 Ensure the "PRAGMA journal_mode=WAL" works coming from any other journal_mode
with ATTACH-ed databases.

FossilOrigin-Name: e54330b43127e46fc6494748cbb353a6fc91cfd7
2014-04-04 14:12:52 +00:00
drh
c438df1be0 Use OP_Copy instead of OP_SCopy when moving results out of a subquery,
to prevent the subquery results from changing out from under the outer
query.  Fix for ticket [1e64dd782a126f48d78].

FossilOrigin-Name: d5513dfa23baa0b0a095aaf17d19aacd30dcef61
2014-04-03 16:29:31 +00:00
drh
831116d164 Fix a typo in the "Synopsis:" comment for the OP_VFilter opcode.
FossilOrigin-Name: 48ecdd4aff03741f96c070dced69c3c273b652cb
2014-04-03 14:31:00 +00:00
drh
54d0d2dd9a In the command-line shell, run set writable_schema before running the
".clone" command.

FossilOrigin-Name: 9d2ae6342c8afa904bec591ebe134ff7f536b71c
2014-04-03 00:32:13 +00:00
drh
a38c9516e8 Remove an unnecessary conditional, replacing it with an assert().
Improvements to comments.

FossilOrigin-Name: 834bf1c367e1ccd498c7f9f843be2d2aa11ffb3c
2014-04-01 01:24:34 +00:00
drh
4c417181c2 Fix a compiler warning when SQLITE_DIRECT_OVERFLOW_READ is defined.
Minor performance enhancement and size reduction.

FossilOrigin-Name: 96385dc460545807a5c8fcf6280a971700f84866
2014-03-31 23:57:41 +00:00
drh
e4529c5724 Merge in the latest changes and fixes from trunk.
FossilOrigin-Name: f6211540c9d66a08dc580dd733e4f4a98968ae30
2014-03-31 22:03:32 +00:00
drh
d3c156638a Remove an unnecessary conditional.
FossilOrigin-Name: 7473c4dfc10a47594affa6f4e071a08dc8838c0c
2014-03-31 20:05:20 +00:00
drh
3fb183d2f7 Also make sure an index that is a proper subset of some other index has a
higher cost than that other index.  Add test cases.

FossilOrigin-Name: b7830d232b073a197aa1092e78cb24e88cb10fd3
2014-03-31 19:49:00 +00:00
drh
53cd10afcd Make sure that an index that covers a proper superset of the WHERE clause
terms of some other index has a lower cost than the other index.

FossilOrigin-Name: ea8b0910040198751551b0b960e6b783913607df
2014-03-31 18:24:18 +00:00
drh
b663587890 Avoid a (harmless) buffer overread that is possible on an OOM when
MEMSYS5 is engaged.

FossilOrigin-Name: b3296267fb67b9f59719a37093253062edde3746
2014-03-31 13:42:42 +00:00
drh
7a4b1642a7 Experiments in picking better query plans, especially when the usage of one
index is a subset of another.

FossilOrigin-Name: 8f869ca7a6eaa9ca7a08102290e6c606735f9090
2014-03-29 21:16:07 +00:00
drh
70c93204ea Disable the wal64k.test script for non-unix systems since it depends on
unix-only features.

FossilOrigin-Name: 27deb6e49bcc76714dbdc61b34748603155ac770
2014-03-28 14:41:35 +00:00
drh
36ed03428d Fix a harmless compiler warning.
FossilOrigin-Name: a4e47150f32b3a4120b1f89ccc66d633d829e3bb
2014-03-28 12:56:57 +00:00
drh
a1f7c0a21c Enhance the sqlite3VdbeRecordCompare() routines so that if they encounter
database corruption, they will set the UnpackedRecord.isCorrupt field and
return 0.  The sqlite3BtreeMovetoUnpacked() routine detects this and returns
SQLITE_CORRUPT, causing the corruption to be reported back to the top-level.

FossilOrigin-Name: 7fa85eaaaf6d211378620d728a759fdfe30a15b0
2014-03-28 03:12:48 +00:00
drh
27de5c5cb6 Minor cleanup of the code in the query planner that computes the costs
estimates for the various plans.  There are no changes to the costs at this
time.  But the code is slightly more readable now and that might facilitate
future enhancements.

FossilOrigin-Name: 9b4d7226bcee38be5ac68a54bee03b4179cb69fc
2014-03-27 18:36:34 +00:00
drh
382bdeabef Enhance the logest.c utility with new operators: "dup", "inv", "log", and
"nlogn".  Provide help on an invalid input.

FossilOrigin-Name: b4bd2a062c4baf5f622d61b7411f00de5904ef56
2014-03-27 14:05:38 +00:00
dan
68916c9fd3 Add an extra test case for the potential buffer overread patched by [28ddecff04].
FossilOrigin-Name: f585f5d7a0f9bf8c590388654a3638231eba8892
2014-03-26 15:14:59 +00:00
drh
d9c131c366 Add a test case to verify that the previous change avoids excess buffer
overread in sqlite3VdbeRecordCompare().

FossilOrigin-Name: 2b28e8d582cf10936fa1faca04a16ca2eeead66f
2014-03-26 15:05:56 +00:00
drh
182ea4e324 Earlier detection of corruption in sqlite3VdbeRecordCompare() in order to
avoid a potential buffer overread.

FossilOrigin-Name: 28ddecff044dbc2dff50a7d8406ab67dfe06587f
2014-03-26 14:51:07 +00:00
drh
e2ac506704 Add an assert() and a comment to clarify the operation of the
vdbeRecordCompareInt() routine.

FossilOrigin-Name: 851abdb8fd9b5a8a6ce21db53d30dbac3c430cc7
2014-03-26 12:02:38 +00:00
drh
5e8980ddb1 Adjust the repeat counts on several tests in speedtest1 so that the relative
time spent on the test is roughly the same regardless of --size.

FossilOrigin-Name: 7922809ee0d3978ce9221fbb7df63aa0684d0c4d
2014-03-25 20:28:38 +00:00
drh
c872966ef4 Add another performance test case to speedtest1. This case is another
ORDER BY test but this time without LIMIT.

FossilOrigin-Name: 9ab7ffd59209aef0ffbf384b3902a93fd3b86a6d
2014-03-25 17:45:49 +00:00
drh
0c60c1fe66 Add an ORDER BY test case to speedtest1.c
FossilOrigin-Name: 588122641e57e957813d329ea071e13ccbde5acd
2014-03-25 14:54:36 +00:00
drh
86dd3716b9 Detect when a VdbeCursor is still pointing at a valid row but that row has
moved, and invalidated the return from prior sqlite3BtreeDataFetch() or
sqlite3BtreeKeyFetch() calls.

FossilOrigin-Name: e6798871ce94961135762669af418cd78540c121
2014-03-25 11:00:21 +00:00
dan
b22f38a779 Remove unused variables Parse.nColCache and Parse.iColCache.
FossilOrigin-Name: 4d7551ce464c8038147e81667368924f2a7485a6
2014-03-24 16:30:06 +00:00
drh
3d1d90a13d Fix arithmetic operators so that they do not change the affinity of their
input operands.  Ticket [a8a0d2996a].

FossilOrigin-Name: 221f8f944703108e47d789fa8ce6c00fe2abcbb6
2014-03-24 15:00:15 +00:00
dan
4979088506 Avoid attempting to mmap memory from an offset that is not a multiple of the system page size on systems with page sizes larger than 32KB.
FossilOrigin-Name: db7d62c8d58eb1e8654a762c9b199ae4e2759038
2014-03-24 11:23:17 +00:00
drh
323913c880 Avoid a possible use of an uninitialized variable following an I/O or OOM
error.

FossilOrigin-Name: 641408a1395bfc911ca619ef9e5f073b913d856b
2014-03-23 16:29:23 +00:00
drh
dbfca2b7f8 Clear the sort-order flags on the KeyInfo object associated with the
OP_Compare/OP_Jump of the block-sort logic, in order to make the OP_Jump
fully testable.

FossilOrigin-Name: 9b2838f23e5f52369eeb078f60bd231cc54362f8
2014-03-22 02:19:53 +00:00
drh
c83a6bed04 Increase the version number to 3.8.5.
FossilOrigin-Name: 9760879d086b61476890927f01806a93798d4eee
2014-03-22 01:52:17 +00:00
drh
59b8f2e108 Fix the ORDER BY optimization logic so that it will do a block-sort on
a partial DESC ORDER BY.  This enhancement uncovered a memory leak in
pushUntoSorter() which is also fixed.

FossilOrigin-Name: c36f74611cf17ad2ff198a2ac2054d7ab451a72c
2014-03-22 00:27:14 +00:00
drh
9a4444778f Add the ability to use indices for the first few terms of an ORDER BY clause,
then sort in batches to handle the later terms.

FossilOrigin-Name: fa06a6fed9f48322d9b89721799ba12c46efa898
2014-03-21 20:58:42 +00:00
drh
8e1ee88c88 Change the names of SRT_DistTable and SRT_Table used by CTE to more
meaningful SRT_DistFifo and SRT_Fifo, respectively.  Simplify the
IgnorableOrderby() macro in the process.

FossilOrigin-Name: 45d8cc678d128f1dda6469864215a8ed9de4366a
2014-03-21 19:56:09 +00:00
dan
9afccba269 Avoid leaking memory in an obscure case where the flattener adds an ORDER BY clause to the recursive part of a recursive query.
FossilOrigin-Name: 1f413aca00015100224273480e1ce39a76bf93ab
2014-03-21 19:27:54 +00:00
drh
cc08fa48b8 Merge the OFFSET-on-query-without-FROM fix from trunk.
FossilOrigin-Name: 71e9ae72c272dc86720b2bfe719f57de437c400b
2014-03-21 18:45:19 +00:00
drh
a22a75e5ca Fix the OFFSET clause so that it works correctly on queries that lack
a FROM clause.  Ticket [07d6a0453d4ed8].

FossilOrigin-Name: 179ef81648b0ad557df78b7712f216b876b6fb65
2014-03-21 18:16:23 +00:00