Commit Graph

21109 Commits

Author SHA1 Message Date
dan
229ae1ae72 Fix a potential crash in fts5 caused by using an auxiliary function on a "special" query like '*id' or '*reads'.
FossilOrigin-Name: 9490683ae883561fa347cbe54ebdd61188d849b4852d904b508250ba5d0807ef
2019-09-02 14:46:12 +00:00
drh
dd668c26b5 When applying the IN_INDEX_NOOP optimization and the LHS has REAL affinity,
also apply REAL affinity to each element of the RHS.
Ticket [2841e99d104c6436].

FossilOrigin-Name: 88833a9c2849c959a37a80e0e4d2b211ce3c83a48319724c89b172b060c876b4
2019-09-02 02:21:58 +00:00
drh
0167ef202b Fix an obsolete comment that defines the meaning of one of the parameters
to the sqlite3FindInIndex() subroutine.  No changes to code.

FossilOrigin-Name: 0c946f0846b2835f8facca806a4d4ecc2b2e97343de245a0d91716d998b2a829
2019-09-02 01:25:07 +00:00
drh
bffdd63633 When computing an expression value for an index-on-expression or a CHECK
constraint and the expressions uses a REAL table column, but the value of
that column is an integer (in other words, when it is using the 
store-real-as-integer optimization) be sure to promote the value to real
before evaluating the expression.  Ticket [57af00b6642ecd68].

FossilOrigin-Name: 0658c16e311393c8a347b1bd41fa5dbfd2e184aa75d84c011aa8dbac79b632e9
2019-09-02 00:58:44 +00:00
drh
cc80db69e9 Remove an obsolete paragraph from the OP_Column documentation. No code
changes.

FossilOrigin-Name: f6d8956cf8b5993a4332b9330e89d5c3d5f8872ea5a2ce3d2e91127406cc1839
2019-09-01 23:36:33 +00:00
drh
35a38e0836 Fix a harmless compiler warning.
FossilOrigin-Name: 63c67a54b4d3e501f3059dcdfc6bb50c6b8dad63a34eb773e4408d9e4e780d7a
2019-08-31 20:29:28 +00:00
drh
81d25cf53d Mark new VDBE branches never taken.
FossilOrigin-Name: 83c2adffbfb6dcdddb38ad9f888647b0e39fa24dc0bff344238e1f75a6c7d2ed
2019-08-31 20:26:06 +00:00
drh
80f6bfc064 Improvements to the algorithm that determines which SELECT in a sequence
of nested SELECT statements that an aggregate function belongs to.  This
resolves an issue identified by dbsqlfuzz.

FossilOrigin-Name: d768007473f4ed40abbdf2c7e501b580b1cc37c1620c7cb90af1f208a8c35145
2019-08-31 20:13:30 +00:00
dan
f66bfcb740 If a DELETE trigger fired by an UPDATE OR REPLACE statement deletes the row being updated, do not attempt to proceed with the original UPDATE operation. Fix for [d6a0fbc1].
FossilOrigin-Name: 4145b3e05051ba6729105157a876793ad14a05d895fc10fe704f437eab16ea93
2019-08-31 17:14:35 +00:00
drh
6a19865ff2 Remove some affinity tests that became unreachable due to the prior change.
FossilOrigin-Name: e2db1123faac26c0e0b6a1ebef1685ea7633bfcafd1ff743ba5380700f7745af
2019-08-31 01:33:19 +00:00
drh
7314495ff8 When the affinity of a table column is INT or REAL, make the affinity of
corresponding index columns NUMERIC.  This increases the precision of
index lookups for large numbers so that it matches the precision of
ordinary comparison operators.  Ticket [40812aea1fde9594]

FossilOrigin-Name: e0d909c740b774d8a46731696e33342be83206cc4a95d07f42fdb3d8cc2d7a8e
2019-08-30 23:56:34 +00:00
drh
a7ce167e5b Make sure OP_RealAffinity has been applied to all columns of type REAL
in the excluded.* pseudo-table of an UPSERT.
Ticket [5a3dba8104421320]

FossilOrigin-Name: 67381dadede98a55d8d9e085d021e6fa6473071978967b6302e03b28cf2245e1
2019-08-30 23:15:00 +00:00
drh
efb5f9a173 Improvements to VDBE tracing. No changes to code in normal deliverables.
FossilOrigin-Name: 54553bf16fabd72d1967acef317beb518e086707ccd45890b7c7256b8da08b75
2019-08-30 21:52:13 +00:00
dan
9889ede28d Add test case to window8.test. Also fix an error in a comment in window.c.
FossilOrigin-Name: 2925bfa5971c8557ecaa6ac18df0825ebbbd1622017509e83451d90640146fa8
2019-08-30 19:45:03 +00:00
drh
db3a32ed1c Back out the change at [47cd634c98b502d4] which was incorrect. Add a test
case so that we don't accidently back out that change again.

FossilOrigin-Name: 596ac2a4eab28b74f4050fb4eb71883f2a1421fdbccf302413e4653391bb52c9
2019-08-30 18:02:49 +00:00
dan
1cac1766df Add further comments to window.c.
FossilOrigin-Name: 900464567b2a5ce0c278a3297e4be1968f609258608aa0fbe2fc67709aa22a4b
2019-08-30 17:28:55 +00:00
drh
ac6627327c New test cases for window functions with RANGE BETWEEN and DESC NULLS FIRST.
FossilOrigin-Name: f7002f86c780e279c9f8a6268f317586519c059c9de2115ff6f1cad272570c29
2019-08-30 16:46:12 +00:00
dan
8b47f52082 Fix a bug in RANGE window functions that use "ORDER BY <expr> DESC NULLS FIRST" as the window-frame ORDER BY clause.
FossilOrigin-Name: 39b4cad4a51bb5116d62ffb16ac36d96a9280321b049eb2d008605392f52a459
2019-08-30 16:14:58 +00:00
drh
ae144a1c9f The expression "(X IS FALSE) IN (FALSE)" does not imply that X is NOT NULL.
Ticket [f8f472cbc77ba9c9]

FossilOrigin-Name: dd66134817ecbda01c59a05ad0d6ac44bee700ab10cd2119c869dd69af293fe2
2019-08-30 16:00:58 +00:00
drh
7a231b4973 The expression "(X IS FALSE) BETWEEN FALSE AND TRUE" does not implie that
X is not NULL.  Ticket [fba33c8b1df6a915]

FossilOrigin-Name: 057fb8b1809b8b9c8fff0fd0804153b9644f0545c23c6ddc4758bda3381094b9
2019-08-30 15:11:08 +00:00
drh
38cefc83c8 The expression "(x IS FALSE) IS FALSE" does not imply that X is not NULL.
Ticket [a6408d42b9f44462]

FossilOrigin-Name: 45ff2b1f2693bb0231a864a511bb82cf2a5945ab3d806a5bbaf1517ecb287883
2019-08-30 13:07:06 +00:00
drh
f4d9c9822d Remove a faulty testcase() macro.
FossilOrigin-Name: 80124ae55246b79023d23d3f55487ac3c0b40e8ff301c5daf4dd0631de8ddb29
2019-08-29 23:24:18 +00:00
dan
bd717a4d2e Improve vdbe branch coverage of NULLS LAST code.
FossilOrigin-Name: e8e9f77d52974f6ba0a536d05837b280a996745deb3a2169bb29379f10e49df4
2019-08-29 21:16:46 +00:00
dan
9d23ea74d4 Fix other problems similar to ticket [c0390363].
FossilOrigin-Name: 96ff2ba9c4bb71d5f7c6f359986a76a5364b7ac3e1a612441543a9eabecf31df
2019-08-29 19:34:29 +00:00
drh
db586e4843 Add a missing VdbeCoverage() macro.
FossilOrigin-Name: 33da6092d3d04b6eb6ab396b8c4f668e3529e26bf11e26f5fcb9b61fe3470197
2019-08-29 16:48:10 +00:00
drh
f76ccb7d54 Remove an unreachable branch in the NULLS LAST logic of RANGE window
functions.

FossilOrigin-Name: 47cd634c98b502d40a493455ba6d73cbd0dae74944f9cf06fcbcd025f4b49d6e
2019-08-29 16:17:59 +00:00
dan
b6a9121bb3 Fix another case where SQLite assumes that if "~(? AND FALSE)" is true, "?" must be non-null.
FossilOrigin-Name: 616f5663b3dbd0929128c0990fc6d8bba1513c7ae196b87c450ac0b3b3203ecd
2019-08-29 15:50:16 +00:00
dan
1cd382e350 Avoid assuming that for "~ (? OR TRUE)" to be true, "?" must not be NULL, just as we do for "NOT (? OR TRUE)". Fix for ticket [c0390363].
FossilOrigin-Name: 84ae41fd2f50cb7c0c3f6522d0f94817e1bbf96eae5316279e3e32cee4e46e91
2019-08-29 15:06:35 +00:00
dan
50b3ea2daf Fix a potential buffer overrun in fts5 caused by corrupted database records.
FossilOrigin-Name: c465d0eb478e42045e08efe8b6fa64d4bd4d747cdf743beae4608562b014169e
2019-08-29 14:25:44 +00:00
drh
0b79824ec5 Improve Lemon so that it enlarges some of its tables slightly in order to
avoid having to index range checks on table lookups for a performance
increase.

FossilOrigin-Name: 4be6a23a188bd1fea445283d6dcc2f5c3470c28852dc4895d63117ad0c773fcf
2019-08-29 00:27:12 +00:00
drh
6ee3fa87fd Fix an unreachable branch in sqlite3ParserFallback()
FossilOrigin-Name: e059178b47109caee2c2211b2db6e594c014af636677118a64e10edf01ac017d
2019-08-28 11:49:45 +00:00
drh
010bdb4c79 Further improvements to parser speed by enlarging lookup tables to eliminate
the need to do range checking on the index prior to lookup.

FossilOrigin-Name: 47d3e091ae49eb7947af5abef9b5b96b16b86d349e51fe0677795649be6db473
2019-08-28 11:31:11 +00:00
drh
2e51716b15 Increase the size of the yy_lookahead table so that it is never necessary to
down bounds checking on the index.

FossilOrigin-Name: bafd872398e58766e996963372c7acc03a1e20a6d39a3867ca45d3ea0ed2ac1d
2019-08-28 02:09:47 +00:00
dan
8085d53d3c Add support for "ORDER BY ... NULLS FIRST" and "ORDER BY ... NULLS LAST". Use this to fix ticket [f8a7060e].
FossilOrigin-Name: 94085fb3e756bc984237b74b6e29c68462ad860870c64dcb5124feaeec387660
2019-08-27 19:59:21 +00:00
drh
e893759cac The ALWAYS() added by the previous check-in was incorrect. Take it back out.
FossilOrigin-Name: 336235db2b1167cdb2feb64b47eb6368c97c43ee9641b7bfccc5775a41dd0d0e
2019-08-27 17:59:01 +00:00
drh
7ec796d002 Add ALWAYS() to an always true conditional that results from the
previous check-in.  Add a test case for ticket [dbaf8a6820be1ece] to
supplement those already checked into TH3.

FossilOrigin-Name: aff209804722ac902c7abfde80ad2677e0f51beb2c7f28f65d51105d984a1640
2019-08-27 17:28:05 +00:00
drh
790b37a240 Omit the "x IN (y)" to "x==y" optimization of check-in [e68b427afbc82e20]
(and ticket [e39d032577df6942]) as it causes difficult affinity problems
as demonstrated by ticket [dbaf8a6820be1ece] and the original assertion fault
is no longer a factor due to countless other changes of the previous 5 years.

FossilOrigin-Name: 7f5168a76a400fc2e1e40c6950470b1bfb38a0be54fc5518c17c29fdae7d8f1f
2019-08-27 17:01:07 +00:00
drh
6397a78b2b If a TEMP TRIGGER references an auxiliary schema, and that auxiliary schema
is detached, move the trigger to reference the TEMP schema before completing
the detach, so that the trigger does not hold a dangling schema pointer.

FossilOrigin-Name: 069c2f4c61f06211a8981abc412afcc1536ece13380b13a70aa99123f8f527cd
2019-08-27 10:05:45 +00:00
drh
512e46a74c Merge in recent fixes from trunk.
FossilOrigin-Name: ad816d01d4bd3908ff2c574d79d1a29b6d732df308f2f1b1cdf7c0bc7c1bd7cf
2019-08-26 20:41:33 +00:00
dan
d790c9a161 Tweak the shell tool ".recover" command so that it can recover rows that consist of a rowid and no fields.
FossilOrigin-Name: 279ac7fdec0b1409cd400b7b093f89089d93c49f596f378c6a3032434a85bf83
2019-08-26 14:57:58 +00:00
drh
554a9dc78a Improved detection of number of column mismatch for vector assignment
in UPDATE statements.  Ticket [78acc9d40f0786e8]

FossilOrigin-Name: bd4bda73df3794eef424eb13e08fc7cc54347d1ac69febaeec41f6b6cb4a42bc
2019-08-26 14:18:28 +00:00
drh
d86fe44ab5 Fix typo in a comment. No code changes.
FossilOrigin-Name: d0cc06d8a30444125e5655f6587a6355471c3447c08a2e5f7a046a4ed5cc5f09
2019-08-26 13:45:49 +00:00
drh
e2754c1fba Enforce 80-character line discipline in the CLI. Minor improvements to the
CLI built-in help.

FossilOrigin-Name: 9690013a00d73a8047b25149ded50d20c74b5c62c0725eec50ed8477688e58a0
2019-08-26 12:50:01 +00:00
dan
666a42ffb3 Minor performance improvement for balance_nonroot().
FossilOrigin-Name: d7434cae3edc321e2f1f8d340a0e656b1613b736f8400fb271a0e80f59401b9e
2019-08-24 21:02:47 +00:00
dan
298680d15a Fix a potential buffer overrun in fts5 caused by corrupt database records.
FossilOrigin-Name: 156d612800a7282fe0ebb20feb31d3fd577f4ab60fab8c00940c87143997aefb
2019-08-24 17:11:29 +00:00
drh
ee37f8b0a3 Fix the built-in edit() SQL function in the CLI so that it works with
zero-length blobs.

FossilOrigin-Name: e32490128684cfeeb8213baecc78a7942b8fb63d00e375edd965bf236faeed18
2019-08-23 23:05:32 +00:00
dan
ee6c5e5ae7 Move some things in parse.y so that TK_COLUMN and TK_AGG_COLUMN are assigned the same values as they are on trunk for a very small speedup.
FossilOrigin-Name: d26fdfa3bc5f8d9c4a6000462080b0dd508e5cae9a83e0d126be48195224da8c
2019-08-23 20:33:01 +00:00
drh
a31d3554c5 Revise the VDBE comments for NULL-scan so that they also work make
sense when reading a NULLS FIRST plan.

FossilOrigin-Name: bfe793780fa6fc7a1e7d0ee60606dda272985de9573887dca118e9510fc609f2
2019-08-23 17:09:02 +00:00
drh
5f6a4ea2e2 Additional simplifications of the WHERE loop code generator logic for
NULLS LAST.

FossilOrigin-Name: 1383680d927d7d703933be7653c0019199845e7f7e82bcc76d9ca3808093e9d8
2019-08-23 17:00:22 +00:00
drh
0086e07865 Simplification of the WHERE loop code generator for NULLS LAST saves a
few CPU cycles and about a hundred bytes of code space.

FossilOrigin-Name: e3ed2f496f51234a8f81d90d47ba603b06dbed38b8bd8f1934294379cde74d3a
2019-08-23 16:12:20 +00:00
drh
ec3dda5b11 Invert the meaning of the regBignull flag so that it is 1 when doing the
normal scan and 1 when scanning nulls.  This enables the re-do jump at the
bottom of the loop to be coded with a single OP_IfNotZero opcode, rather
than a sequence of OP_If, OP_Integer, OP_Goto.

FossilOrigin-Name: bf875e1a259a4167694e06349458452dc36c1d38aa6843518d9ae46ce74e5559
2019-08-23 13:32:03 +00:00
drh
74e1b861ad Extra VDBE comments in the NULLS LAST logic provide landmarks to help
understand the EXPLAIN output.

FossilOrigin-Name: 649b08ead50f10a9ec0357a5e1ed020195d9f93be61ef703ea036a8e53f07a34
2019-08-23 13:08:49 +00:00
drh
505ae9def8 Add additional VDBE coverage marcros.
FossilOrigin-Name: d3531f5be7d3769689e2cd8bdc9bab5608759de027d44cc123996f32a4a89583
2019-08-22 21:13:56 +00:00
drh
a677eecad3 Merge fixes from trunk. Also fix a reference to the KeyInfo.aSortOrder field,
which should now be KeyInfo.aSortFlags

FossilOrigin-Name: 63e625c8eb06720eef30573aa562e38c90d228a9cf493f8bb59f09e50f0e3168
2019-08-22 19:35:24 +00:00
drh
0d950af311 Fix the likely(), unlikely(), and likelihood() functions so that they have
no affinity, just like any other function.
Ticket [7e07a3dbf5a8cd26]

FossilOrigin-Name: 44578865fa7baf9760e355691ca9ce753295aaba7a4ee0bba29d4f85d9335bab
2019-08-22 16:38:42 +00:00
drh
af8664020a Fix a false-positive in sqlite3ExprNeedsNoAffinityChange().
Ticket [ac184eb571d5e6e0]

FossilOrigin-Name: e62eddbb048cbc2c15cb8eeb5b7a907e7cb08c21a27ebba96a069f62dbcb0f30
2019-08-22 11:11:28 +00:00
drh
3e36480232 Fix the OP_SeekGE, OP_SeekGT, OP_SeekLE, and OP_SeekLT opcodes so that they
preserve the datatype of the value in the register used as the key.
Ticket [d9f584e936c7a8d0]

FossilOrigin-Name: 81b9f0f55042777b37de78069f7089041a9ee21dd0a0c86b879053fb46e140b4
2019-08-22 00:53:16 +00:00
dan
f236b21f4b Add missing VdbeCoverage() macros to new code.
FossilOrigin-Name: b1cbcdc6eb42cca0c42a05e0d6ba4c6c7f09adff0c59ecfc5b434a94dec07a41
2019-08-21 19:58:11 +00:00
dan
37874d7dcc Disable broken test case in expert1.test.
FossilOrigin-Name: 73e30c2e92ccab274ff7cee48511c461de148786bb9d338921c1ecb193822282
2019-08-21 17:46:34 +00:00
dan
2ebb550824 Update this branch with latest trunk changes.
FossilOrigin-Name: 6153bcf41a9aa0497f8210311c99ac23846223068f2b6a3a1c2d9dec7673c7e1
2019-08-21 15:41:50 +00:00
dan
f7c92e82d2 Avoid assuming that "column IS ?", where column is declared UNIQUE, matches only a single row (as "?" might be NULL). Fix for [b8689402].
FossilOrigin-Name: d02490a2f0cae047087130b4ad8f55f265845c2ffb3bde3b7d507edb54acea6d
2019-08-21 14:54:50 +00:00
dan
6fcb9f3ad9 Fix a broken assert() in the fts3 snippet code that was failing for queries containging more than 64 phrases.
FossilOrigin-Name: 4c01e0170e113ad052b6c3980beb4be9f1dc03fb3cf34132b90e8b82b23f654e
2019-08-21 11:31:48 +00:00
dan
546738f855 Further tests for the special null-handling on this branch.
FossilOrigin-Name: 0dbbb51f4d39cafb01d625d65c12dcb232a9c1da7ed5a9397bf55cfea1b980d2
2019-08-20 20:09:51 +00:00
dan
35fb866ea3 Fix a problem with fts5 "ORDER BY rank" queries when the fts5 table name requires quoting.
FossilOrigin-Name: 00e9a8f2730eb7239bf7fd107c97c409e4f9fbd968510766373440a9079898eb
2019-08-20 19:11:29 +00:00
dan
2a0c16f276 Add tests for sort-by-index cases that use IN() and non-default NULL handling.
FossilOrigin-Name: 09d660ecde723fb30f3bb3684bbb7f95825d78da6a6f33ddf57846054cd563e0
2019-08-20 17:51:13 +00:00
dan
4fcb9caa60 Do not pass ORDER BY clauses with non-standard NULL handling to virtual table implementations.
FossilOrigin-Name: a9a82ee88d2d12209a674bd19167277aa91a6912e7a8bbf3714f90d559307fee
2019-08-20 15:47:28 +00:00
dan
4780b9ad46 Fix a segfault that could occur following an OOM while processing a SELECT statement for which one or more of the expressions in the window frame declaration are themselves sub-selects that use window functions.
FossilOrigin-Name: 75aec4fc886c04fe098828cc03bc72c197cbf40f0a1890fe5bbb98d4fd5c3c7e
2019-08-20 14:43:01 +00:00
drh
95da9d5d46 Add the new sqlite3_drop_modules() interface to the loadable extension
mechanism.

FossilOrigin-Name: 658bd51623787be4ca87b066a051d119f39056286e223afef3691629cf1ab0e1
2019-08-20 13:49:12 +00:00
dan
b6ce71bd26 Retain the affinity of an expression in a WHERE clause when it is transformed to a reference to an index column on the same expression. Fix for [f043b113].
FossilOrigin-Name: 511da0815673ca4a176aa61dc23a8231b2ab77e8363fc184a78b6e17dba64d49
2019-08-20 11:43:44 +00:00
mistachkin
3722b3abf1 Fix a typo and a harmless compiler warning.
FossilOrigin-Name: ec4c63e00c957f98d61ddc1b9d20406c7e1072d6ab0c12ac6939db6c63d90cb8
2019-08-20 02:19:26 +00:00
drh
b6e0286c49 Add the sqlite3_drop_modules() interface.
FossilOrigin-Name: e2c6fed8f84929ed51a4e876bb09c85ac4b86a2e4cf0832a7da724bb9f4df5bf
2019-08-19 20:44:07 +00:00
drh
8c754a3613 Omit the "_except" term from the name of the new interface.
FossilOrigin-Name: e5ba47c2d8eb9f48a0e0d325e57d0092d536f85983819634c871ebd51829f1d1
2019-08-19 20:35:30 +00:00
dan
ae8e45cb0c Fix problems with window frames that use ORDER BY ... NULLS LAST etc.
FossilOrigin-Name: 75d665a494dd7d6e77d5a80af386ee5accc0a53416d5493424dc0fef6c7b01a0
2019-08-19 19:59:50 +00:00
dan
9105fd5189 Prevent NULLS FIRST/LAST from being used in CREATE INDEX and other statements.
FossilOrigin-Name: bb9767a287097a615aeb4abdba689b10e1a1c36c016c8e55905b508075e62c86
2019-08-19 17:26:32 +00:00
dan
dac7e69dc2 Add some extra tests for the lsm virtual table module.
FossilOrigin-Name: 4cb009b0f724f72eaea90e45488122f7c2a7d0caf31a8422da4060469507e921
2019-08-17 19:58:26 +00:00
drh
5976b2c805 Fix to the query planner for the LSM1 extension.
FossilOrigin-Name: 7496e872a1a50ac65ad04709365a43038fb015ac9c690196de3cb02ce54c2e57
2019-08-17 19:55:26 +00:00
drh
5df8428069 The experimental sqlite3_drop_modules_except() interface.
FossilOrigin-Name: 0851db4d337a87f8b2d3ce2ae9f9c928b9483591ca41a9e39cc01548059b1888
2019-08-17 19:45:25 +00:00
drh
87ca8067af Fix the new ability to unregister virtual table modules so that it works
for the automatic PRAGMA virtual tables.

FossilOrigin-Name: 5d6f4dfeea75c7dcd8c511545accb9eb4b405a02db034332249ba54794e313d2
2019-08-17 19:31:09 +00:00
dan
c324d44690 When populating an ephemeral b-tree for the RHS of an IN(...) clause, avoid applying an affinity to a value that may be used later on for some other purpose. Fix for [c7a117190].
FossilOrigin-Name: 43e8b14314d876178d487c3b519296ac1de065fdcaa70768e40d684015bceb9d
2019-08-17 19:13:49 +00:00
dan
8328369740 Add tests to ensure that this branch really does fix ticket [f8a7060ece].
FossilOrigin-Name: f892066425671a8a0ac923e3ad4744677f6434a66f97b91afa8141f11f179975
2019-08-17 18:16:59 +00:00
dan
cc491f4b1b Fix problem with DESC indexes on this branch.
FossilOrigin-Name: b49df1fe9b7174ebc60023179e8da628c926e59df3dc01b15d4a28e17807bb97
2019-08-17 17:55:54 +00:00
drh
9e9a67adb0 Ensure the functions that appear to be constant are not factored out of
expression that originate on the right-hand side of a LEFT JOIN.
Ticket [6710d2f7a13a2997]

FossilOrigin-Name: 500c9152daaf11cf69d778aa8592175f6088337c6667c59af6df3a24cd81eb0e
2019-08-17 17:07:15 +00:00
dan
5b32bdff80 Merge trunk changes into this branch.
FossilOrigin-Name: db1e60800bc260cdcd604739daaba72c6b486158123fc62a3898aca4ead33cd3
2019-08-17 15:47:32 +00:00
drh
cc3f3d1f05 Activate introspection pragmas by default. The new option
SQLITE_OMIT_INTROSPECTION_PRAGMAS must be provided to keep them out.

FossilOrigin-Name: 9c4bca64fb5f635296a8d7d7c1bf2808e02ca734a9983e5cee9132f5352a9a6d
2019-08-17 15:27:58 +00:00
drh
217ca657d8 The SQLITE_DIRECTONLY flag, when added to sqlite3_create_function() prevents
the function from being used inside a trigger or view.

FossilOrigin-Name: de767376987f7668b0770c4920f1532e341b5a27f797d69c0f5e92b87d036170
2019-08-17 00:53:29 +00:00
drh
cc5979dbd3 Add the ability to unregister a virtual table module by invoking
sqlite3_create_module() with a NULL sqlite3_module pointer.

FossilOrigin-Name: 31e34fa3390196cdc3178bf120224b08df5ec58fa2c77079ede6e9461a430dad
2019-08-16 22:58:29 +00:00
dan
15750a26fa Add support for using indexes for some ORDER BY clauses that use non-default NULL handling. Still some problems on this branch.
FossilOrigin-Name: 81069d7196857e909c94195d67388f71bc9f832eafd9156d8c5cdddb63513b4a
2019-08-16 21:07:19 +00:00
drh
4043cfef75 Fix harmless compiler warnings in the TCL interface.
FossilOrigin-Name: f17e72291f197a92b3e15e054271b997d45211a5a31ca4ea6c7fbb33026d5f1f
2019-08-15 23:11:42 +00:00
drh
11d88e68ab Add the SQLITE_DBCONFIG_ENABLE_VIEW option, together with a "db config"
command in the TCL interface that can access that option as well as all the
other sqlite3_db_config() boolean options.

FossilOrigin-Name: 61b4bccd2984f4c2cf50f58ef08677588e57aa7e079af07473b2e188d9ce4f52
2019-08-15 21:27:20 +00:00
drh
42d2fce7f5 Provide the SQLITE_DIRECTONLY flag for app-defined functions that prohibits
the use of those functions within triggers or views.

FossilOrigin-Name: fc745845d8d76adc165575e2192f4176e3c28e614c72571d56f4011560499fe1
2019-08-15 20:04:09 +00:00
drh
725dd72400 Ensure that the optional "sz=N" parameter that can be manually added to the
end of an sqlite_stat1 entry does not have an N value that is too small.
Ticket [e4598ecbdd18bd82]

FossilOrigin-Name: 98357d8c1263920b33a3648ef9214a63c99728bafa7a8d3dd6a1241b2303fd42
2019-08-15 14:35:45 +00:00
dan
a3fcc000cb Ensure that SQLite does not attempt to process incompatible window functions in a single scan. Fix for [256741a1].
FossilOrigin-Name: 4f5b2d938194fab7627486e2ced633def2c90d9d3328e3700612feb9dbfa3d9a
2019-08-15 13:53:22 +00:00
drh
d4da4936cd Avoid downgrading SQLITE_CORRUPT errors detected by the schema parser into
SQLITE_NOMEM or SQLITE_ERROR errors.

FossilOrigin-Name: b2e79f8ff0836fcc98a2df9377aad9137307c34058030ecd1b5d4ec3277ed36a
2019-08-15 13:46:39 +00:00
drh
27e80a3b68 Ensure that the cell overwrite optimization does not overwrite the header
of the b-tree page.

FossilOrigin-Name: 4cc5694cbd69749c146679c367860952fdf3f5356426ddfd1dce470569702bc1
2019-08-15 13:17:49 +00:00
drh
b9fc45534d Early detection out-of-bounds page numbers on the direct-overflow-read
optimization gives consistent error messages regardless of whether or not
the optimization is enabled.

FossilOrigin-Name: b517a52fa36df0a0854a75858b5e81861771d2e9032a5a0ad79aa76ae64130a2
2019-08-15 00:04:44 +00:00
drh
908e7c43a7 Always check for reads past the end of the file on the in-memory journal
driver.  This used to be an assert().

FossilOrigin-Name: 4d41ca7d6efbdac70890a8d4159488fc7f59bf78a550b00597b4df990c4fcaef
2019-08-14 15:17:21 +00:00
mistachkin
87ae34ba1a Add some static to the 'regexp' extension.
FossilOrigin-Name: a21d1dde73f811244b5b43f9fed5877263a9c5061470221f417e501f5530edfa
2019-08-13 20:34:35 +00:00
dan
7c2321fdf3 Update test cases so that they work with ICU enabled.
FossilOrigin-Name: 408144a1832569ced8e04840f0dd36a3867405f36b13631b0f13c0f7b8a0fb01
2019-08-13 17:56:56 +00:00
dan
3c1970fcee Update some corruption test cases to take [724f4df9c] into account.
FossilOrigin-Name: 927cd7b4c52fae665e57fb6039c6829e339cff5ad5c405800cac3ee149ef5be1
2019-08-13 17:27:43 +00:00
dan
b8a8d523cb Fix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU vacuum.
FossilOrigin-Name: 8c44b02f1479cec61554800702a3c1d806e4ee64b41ba2af17320f62794a02fe
2019-08-13 15:11:25 +00:00
drh
554a19dbee Make sure the btree cursor overflow cache is cleared when overwriting
a cell in sqlite3BtreeInsert().  Ticket [3cf9bb227e9a5d32]

FossilOrigin-Name: 7dae7b969ed314605a3a2da2cfdce4d81152740f5d3bfbc2a6e311b13ee325a7
2019-08-12 18:26:46 +00:00
dan
6e11892db8 Experimental implementation of NULLS FIRST/LAST. This branch still has problems - the most significant of which is that ORDER BY clauses with a non-default NULLS FIRST/LAST qualifier can never use an index.
FossilOrigin-Name: 07babb0f897fc8c9cb5b30481899c32fdd743f3f3ca508d8d957826252107dd5
2019-08-12 16:36:38 +00:00
drh
41428a97b8 For the ".testctrl prng_seed" command in the CLI, if the argument is "random"
then select a random integer seed and print the seed value on stdout.

FossilOrigin-Name: 636ca4472c9f41eb3989f28854d4968867837399a2092f389d1b814d98cccbae
2019-08-12 16:25:11 +00:00
drh
30842990b2 Add a TESTCTRL that disables the verification of type, name, and tbl_name
in the sqlite_master table.

FossilOrigin-Name: 48d9b48ab4ace234eb1a055cf33cb533a1c3aa82d0a6e086d96226bd9474ceca
2019-08-12 14:17:43 +00:00
drh
c5a93d4c85 Validate the type, name, and tbl_name fields of the sqlite_master table when
loading the schema, unless writable_schema is engaged.

FossilOrigin-Name: 724f4df9ccc2b683f7091a3f7a8c20ee210f44d7a610cd1b4c49da1c274add08
2019-08-12 00:08:07 +00:00
drh
14c865e859 Fix the sqliteExprImpliesExpr() routine so that it recognizes that
"(NULL IS FALSE) IS FALSE" doe not implie "NULL NOT NULL".
Ticket [9080b6227fabb466]

FossilOrigin-Name: da01ba4fa47c6508b31533ccd769e637af04bd37f51463372fbc6c848d892a4d
2019-08-10 15:06:03 +00:00
dan
b6299681c6 Add extra test cases related to the previous commit.
FossilOrigin-Name: 3c690b2b05b7338f3325c50a0750c6023e1173afa4388e836ecb2cc49f19a0ac
2019-08-10 14:35:06 +00:00
drh
3251a2031b Remove two incorrect assert() statements from the logic used to derive
column names and types from subqueries.

FossilOrigin-Name: 712e47714863a8ed7ff73324d9fec569633e8b901c436c633b0220d16a7a9302
2019-08-10 14:16:17 +00:00
drh
cb99c57a66 Allow the RHS of a row-value IN operator to use a compound query with
an ORDER BY clause.

FossilOrigin-Name: eaf15d9bae6773058341d6219241f44ce728ad1cb9cf649f2efd4dddd81ec461
2019-08-09 20:26:01 +00:00
mistachkin
044388cf98 Modify signature of sqlite3VdbeChangeOpcode() to accept int instead of u32.
FossilOrigin-Name: 68b7f2acf4d228f32250e37cbc0eb5d275b512d49071bbb38e1f5634b705f7d3
2019-08-09 01:59:14 +00:00
drh
3728b84c03 Fix more compiler warnings.
FossilOrigin-Name: 1b85442b614df0808c10c34ec281282e5dfd93d6d5f9737b51263ffaa4da5c72
2019-08-09 01:11:32 +00:00
drh
51755a78a9 Fix harmless compiler warnings.
FossilOrigin-Name: 1eef4ddea9a2a8c97b97183402c774caa40ef906ea9cccade307381b29a9785d
2019-08-08 19:40:29 +00:00
drh
690f04a0d7 Remove support for SQLITE_ENABLE_STAT3. The sqlite_stat3 table is now ignored,
if it exists.  Run ANALYZE using STAT4 to get the equivalent functionality,
which presumably everybody has been doing for a long time now.

FossilOrigin-Name: f1cd234c9888142e0ac542d866d7fb55a81fb7edd0a5cd810191b4e0395ffc7d
2019-08-08 19:19:42 +00:00
drh
af97c3f35a Fix a case of the Expr.affinity to Expr.affExpr refactor that was missed
in the [a29f2a7d07beff64] check-in.

FossilOrigin-Name: 83450d10707e2c7c075f3930a8c231c49c593b9cdf0e6097b0187eb877755d2d
2019-08-08 18:49:16 +00:00
drh
5eae1d1b33 More legacy STAT3 code removed.
FossilOrigin-Name: 845d2f17de5b4740f95884307d9efec3223737bb0f2c4a74693666caf5f61c21
2019-08-08 16:23:12 +00:00
drh
175b8f06f7 Remove support for STAT3. The sqlite_stat3 tables are ignored, if they
exist.  STAT4 continues to work as it always has, and as it is a superset of
STAT3 is the recommended replacement.

FossilOrigin-Name: 1e17ea2fd1df4ad49138c787c8fe3207dd0c25c93f9001d52a9b69f8c12e841c
2019-08-08 15:24:17 +00:00
drh
1c269a9ff8 Remove a NEVER() that is reachable from a corrupt database.
FossilOrigin-Name: 30e6ee27a9fb78291c324ac9b80db4579280140430804ecd4692e312f9938525
2019-08-08 01:39:07 +00:00
dan
679c9613f6 Remove use of the affinity() function from view.test, as it is only available in SQLITE_DEBUG builds.
FossilOrigin-Name: 7f2246a17be9915b3492624a3d8deff56694bdc372f7627e3f16c1869415b1a3
2019-08-07 19:57:21 +00:00
dan
e7e48dc629 Add "set TMP=%CD%" to the start of each msvc script output by releasetest_data.tcl. Otherwise, since binaries compiled with SQLITE_TEST all choose the same sequence of pseudo-random numbers, collisions between temp file names cause errors when running multiple tests in parallel.
FossilOrigin-Name: f5d0436d8dc650cadb61a5fe76fd1a0d68dabba54ff0c2a8c138f9dfbdab1c3f
2019-08-07 18:34:21 +00:00
dan
0e3c50c5dc Eliminate some more cases of redundant sorting in window-function queries.
FossilOrigin-Name: 8158d2aca68c5a253054376fdf1b8eaab2db874f4b93524742be7340e9c50dd5
2019-08-07 17:45:37 +00:00
drh
74c490e045 Do not make SQLITE_READ authorizer calls for tables without names, as all
such tables will be internal-use-only tables for subqueries and whatnot.

FossilOrigin-Name: 193c87fc96f964984a144c1a4506ef9db033ab2b80e64dd4d09d820fef466407
2019-08-07 13:25:21 +00:00
dan
2712b022ab Ensure that when the col in an operator like "val IN(col)" is a column of a view, its affinity is not used to coerce val. Fix for [0a5e2c1d].
FossilOrigin-Name: 17b3d2218c02a4005d4c96471c452105b54abb25901ae62990b01f0c955135fe
2019-08-06 21:16:28 +00:00
drh
55220a6c70 Improved reuse of file descriptors for which close() is delayed to prevent
clearly of posix advisory locks.

FossilOrigin-Name: 509c1ba26a4c12c63ecf04ddfa2f175eaf4dd9b96ab7be15faebd36deb0a0a31
2019-08-06 20:55:06 +00:00
drh
a2de66c6b4 Enhance the ".recover" output in the shell to use double-quotes around table
and column identifiers.

FossilOrigin-Name: 846d2d2d2f7fd2e4178c70bc2b92f18941a7972fe88c0129035b7a253ed21785
2019-08-06 20:26:17 +00:00
dan
f32105708e Add "PRAGMA foreign_keys=OFF;" to the start of the script output by ".recover", just as is done for ".dump".
FossilOrigin-Name: bfc29e62eff0ed00c153e18a27815f7e3ba316f46871e9645b84ab1e6709a392
2019-08-06 18:40:36 +00:00
drh
9ce3c8ac26 Ensure that columns of views and sub-queries that are expressions with
no affinity are comparied without any type conversions, as required in the
documentation.  Tickets [61c853857f40da49] and [d52a29a9e6bc55c5].

FossilOrigin-Name: 9c8c1092a8ce80e114fcfe8ce780332a6f269b8c87df226242b582d2d825c393
2019-08-06 15:32:42 +00:00
drh
915e434c35 Performance optimization to the new affinity handling logic.
FossilOrigin-Name: c9724e761bce7a4ae63ce3c1408795915865e8d3024dcb90690456f724f0df53
2019-08-06 15:18:15 +00:00
drh
96fb16eecd Use 0x40 (ASCII '@') instead of 0x00 to mean "no affinity" so that columns
with no affinity can appear in a zero-terminated string.  Use the new
SQLITE_AFF_NONE macro for this new magic number.

FossilOrigin-Name: e8234f6939ccff4c10f741cf66d1c537cfebcbd0d1d79a618a64c755a7f087b5
2019-08-06 14:37:24 +00:00
dan
5978a7a525 Ensure that columns of views and sub-queries that are expressions with no affinity are not assigned BLOB affinity. This matches the documentation. Fix for [61c853857f40da49].
FossilOrigin-Name: e15a0977ddfad3d0f4c7654c5665ff10830c25b20ecf6ef500b1ba23fb89e31f
2019-08-05 20:53:19 +00:00
dan
0a8d06a93f Add test cases to this branch.
FossilOrigin-Name: f37317d81cc2864ed57c76a7347351310d61c8056a2a0179218530ba60a44986
2019-08-05 20:45:53 +00:00
dan
2046a77365 Fix the patch on this branch so that it works with sub-queries, as well as views.
FossilOrigin-Name: 7480db307c39b86bce269583e5917f5e1a3990500552fd98400ef3e7088c0b2a
2019-08-05 19:44:47 +00:00
drh
81506b88b8 One of two options on how to address ticket [61c853857f40da49]. In this
mode, we back out the documentation change of
[https://www.sqlite.org/docsrc/info/07b7749da88d54e5|&#91;07b7749da88d54e5&#93;]
and change the core to work as it has been documented to work since 2017,
rather than how it has actually worked since 2009.

FossilOrigin-Name: 09cd0c0c6e6c963e0039a733876e5149adb3cd10e9b92699fa1dcb0633e997a4
2019-08-05 19:32:06 +00:00
drh
1194904b81 Refactor field Expr.affinity into Expr.affExpr to avoid confusion with other
fields and variables named "affinity" and display affExpr it in
sqlite3TreeViewExpr() output.

FossilOrigin-Name: a29f2a7d07beff64e489e8f824babc6228c4a499fadc0ee701caa60a63baadcd
2019-08-05 18:01:42 +00:00
drh
2b96b6969a Improved detection of corruption on the freeblock list of a btree page.
FossilOrigin-Name: 4b00799bdf107fce8a9dd84fd5bf6597e4f3373659b89aae4a1242be5964726f
2019-08-05 16:22:20 +00:00
dan
72d1eac673 Fix a problem with renaming a table when a view or trigger within the schema uses a FILTER with an aggregate function that is not currently registered with the database.
FossilOrigin-Name: 2ac0e42f8ab7a9184c2a2efd13bd50ab51bc01f9f34e9e63591fd18db02dff54
2019-08-05 13:19:25 +00:00
dan
3cbbd195ca Prevent an fts5 table from being its own content table, or part of a view that is the content table.
FossilOrigin-Name: b6d52c9364767ff4ab7279ae981afb97799299dcfaf38a0110c40ca82c72a825
2019-08-05 12:55:56 +00:00
drh
45f3b3cf1d Stregthen an assert() in the WHERE clause code generator for the min/max
optimization.

FossilOrigin-Name: 1bd4b97d6405c9b093f3bfed914c56088ee13e4a2242be62b74a86660f74f533
2019-08-03 19:06:18 +00:00
dan
192418bd49 Fix a problem with queries of the form "SELECT min(<expr>) ... WHERE <expr>=?" where there is an index on <expr>. Fix for [71e183ca].
FossilOrigin-Name: d465c3eef458c851d97eea6e4117247d9c69386b276168080dbff7bb64070c93
2019-08-03 16:37:40 +00:00
drh
55b4c827fa In the ".wheretrace 0x100" debugging mode, show the structure of the
main parameters to sqlite3WhereBegin() calls.

FossilOrigin-Name: fd598e475d353363e19adc27a671170f11ae9f6d8cad58cb2303fb2ad8ac6bec
2019-08-03 16:17:46 +00:00
drh
9f8c028221 Add the SQLITE_TESTCTRL_PRNG_SEED which can control the PRNG seed either
directly or through the schema cookie of a supplied database connection.

FossilOrigin-Name: 2660e9292ae2c229eb7c57a6a79bb19f0c970072f86750fbe9cca3113d44ffe4
2019-08-03 01:40:17 +00:00
drh
2e6d83bc49 Give the SQLITE_TESTCTRL_PRNG_SEED two arguments. The second argument if not
NULL is a pointer to a database connection which seeds the connection from
its schema cookie.  In this way, fuzzers can control the PRNG seed.

FossilOrigin-Name: 49aa34480622cce4d7a72c59d9cfa8336886387acec8ee15b72f295ea1a52d8c
2019-08-03 01:39:20 +00:00
drh
e6e96b1b45 Fixes to the PRNG_SEED pragma idea.
FossilOrigin-Name: c71098409c98af8360f8f28b9238a12ec764018a5782e8ff03fdf5db54031d6e
2019-08-02 21:03:24 +00:00
drh
ade54d68ee Add the SQLITE_TESTCTRL_PRNG_SEED test control.
FossilOrigin-Name: 3ac5723164ae801e209ce525a5d94692767136f9d06be2a84883dcea677d02da
2019-08-02 20:45:04 +00:00
dan
0bf6549cd1 If a query like "SELECT min(a), b FROM t1" visits no rows where "a" is not null, extract a value for "b" from one of the rows where "a" is null. Fix for ticket [41866dc37].
FossilOrigin-Name: faaaae4940b5f4f70e4988ad5b45582410b381ace0031e6abcde0b9217c06796
2019-08-02 19:40:01 +00:00
dan
ddd7421c91 If a query like "SELECT min(a), b FROM t1" visits no rows where "a" is not null, extract a value for "b" from one of the rows where "a" is null. Possible fix for ticket [41866dc37].
FossilOrigin-Name: a7277ed0623dccdbf775ae6127611d6bc6e150f6942a048ab4281e5136c0e98d
2019-08-02 18:43:59 +00:00
drh
d744ee0b50 The sqlite3_set_authorizer() interface should only expire prepared statements
when it is setting a new authorizer, not when clearing the authorizer.  And
statements that are running when sqlite3_set_authorizer() is invoked should be
allowed to continue running to completion.

FossilOrigin-Name: 961e2f08c35238bcb1d32430d16451a96807b2c4bbb194ee621128dd09cd3981
2019-08-01 22:48:45 +00:00
dan
401593e348 Add new release tests for windows to releasetest_data.tcl.
FossilOrigin-Name: 1b330ec24c350c59f6d3779f6c0819fe95b89f4dfca5a1f2c22f22b5fe9cd087
2019-08-01 15:18:51 +00:00
dan
71f059c880 Fix a problem in ALTER TABLE triggered by views or triggers that include the construction "ORDER BY true" or "ORDER BY false".
FossilOrigin-Name: 8168021f9ab5fb8b4888257963c9ec68fd1dfeedaf6bba4b8e07438001d0be0f
2019-08-01 10:58:46 +00:00
dan
45cb2aa98c Update "releasetest_data.tcl" so that it is a standalone script that generates sh or batch scripts to run each tcl test run at release time. Update wapptest.tcl to use it.
FossilOrigin-Name: 559c2dd6724b2fc238760863d4be7132b591457e72ca5758fdd4002fbf7df4bc
2019-07-31 21:08:55 +00:00
drh
9252df4969 New test cases in test/fuzzdata8.db.
FossilOrigin-Name: 6e92d71c24c6039e7116f02fc5f39b2b87efcd3674ea828077c03d760bf49c45
2019-07-31 15:16:14 +00:00
drh
7e35e81dcb Do not allow the json_set() function to overwrite the same element more than
once.

FossilOrigin-Name: f237f60e4fa9171dfe9a77c8637595c2701e971034d41bd6018944e8b2b27a6f
2019-07-31 12:13:58 +00:00
drh
9c3bb59f76 Fix the build for when -DSQLITE_SMALL_STACK is used.
FossilOrigin-Name: b9eda2249ab5cf523093e4849c317d9a4b1743f7e15d96bdd6bb6cc423302914
2019-07-30 21:00:13 +00:00
drh
2ad07d96b6 Improved fix for ticket [ced41c7c7d6b4d36] that keeps skip-scan enabled,
but avoids identifying a skip-scan as order-distinct (because it is not)
and thus forces a separate b-tree to implement the DISTINCT clause of a
query.  This undoes check-in [a871d69c6de65038] and substitutes a new fix.

FossilOrigin-Name: 89bf0399e87be76e7b264e0a35e8a6d3af0f9e71123a929c20754882b636ca70
2019-07-30 14:22:10 +00:00
drh
822bc969f6 Disable the skip-scan optimization for DISTINCT queries.
Fix for ticket [ced41c7c7d6b4d36]

FossilOrigin-Name: a871d69c6de65038360aa6142fbad22689fb347e526cca56bb83e695c1441fbe
2019-07-30 01:17:03 +00:00
drh
8fbcb04811 Convert an assert() in R-Tree into a database corruption detection case.
FossilOrigin-Name: 48b518eb6f76fb0beb161d1ebcf3b793efc36262d6d77a1ad5906b6501138e28
2019-07-29 17:18:45 +00:00
dan
8279fe8a4b Fix a crash in fts3 caused by corrupt database records.
FossilOrigin-Name: 11f7f94f1c5d761e7f381e277658b7e857cc369283996c509061de55fd6aad52
2019-07-29 16:53:30 +00:00
dan
ed9d12dbc2 When using an index for both DISTINCT and ORDER BY, do not confuse the number of columns required for distinctness with the number required to get the correct sort order. Fix for [6749cb3c].
FossilOrigin-Name: 6ac0f822450b26c7d67c33cdb2a90189cd3cf65a052af8497b795c3f71a23813
2019-07-29 15:32:01 +00:00
dan
a79a0e733f When using an index for both DISTINCT and ORDER BY, do not confuse the number of columns required for distinctness with the number required to get the correct sort order. Fix for [6749cb3c].
FossilOrigin-Name: b47169319ad88e8ffdbe8fbb91f4cced81ebd5c0ee1b018be2d0256c9a1c5159
2019-07-29 14:42:56 +00:00
drh
337cc3992a Fix the OP_Affinity operator so that when applying REAL affinity, it
only sets MEM_IntReal if the integer value will fit in 6 bytes or less.
Fix for ticket [ba2f4585cf495231]

FossilOrigin-Name: 2b221bb15fd2b9f6a426e5eb439f7dbabbe3c4cab010c49b87dae3bb1f16c081
2019-07-29 06:06:53 +00:00
drh
122c514271 Fix a minor typo in a comment.
FossilOrigin-Name: cea8a892f76bddc63b921ffc11ea8dce8f8cf649a2c77aa908c7c5c91eed7f4c
2019-07-29 05:23:01 +00:00
mistachkin
f71a243a60 Sync up warning related compiler options in the Makefiles for MSVC.
FossilOrigin-Name: e77d48d1dd140967b18106044dd45e2ba6cd77b6aa5afa8bf3f0a9c16a50eec4
2019-07-29 02:52:11 +00:00
mistachkin
ac713403fd Fix harmless compiler warning seen with MSVC for x64.
FossilOrigin-Name: 857b2ba6d05d6f5a8cfdf269bae9005b25e1903ab9dc6b70546979d8c633f03b
2019-07-29 02:49:14 +00:00
dan
b8293a5bee Update RBU so that it supports indexes on expressions.
FossilOrigin-Name: 6bfa44da226fd758a2ee924d1e8e3a742b0635b6d3f922a4a7919cb14b2418e6
2019-07-26 20:33:23 +00:00
dan
dff1d5b61b Fix RBU handling of partial indexes with comments embedded in their CREATE INDEX statements.
FossilOrigin-Name: e1ccf211aa975a6688a27f7dc4cea80784ed8dcfe1950b2fa6eb0a3cb938838a
2019-07-26 16:16:31 +00:00
dan
bfe33f80dd Fix a potential buffer overread in fts5 triggered by a corrupt database record.
FossilOrigin-Name: 16472112b6886ada18d45cfb409cca2e83dde5a8ba8a36d481e87b61100b0186
2019-07-25 19:29:24 +00:00
drh
00c12a51e3 Fix faulty asserts in the code generator.
Ticket [c52b09c7f38903b1]

FossilOrigin-Name: 01cdc590f7894ea23ee0d674747d7ebf8196efbef3c87d47e72dbc1ab6ae2883
2019-07-24 23:15:19 +00:00
dan
9443dbc493 Improve the ".recover" command so that it handles intkey pages linked into non-intkey b-trees, and vice-versa, better.
FossilOrigin-Name: 9c458acba5a100a76148a3efb78ea9f57b85751e80788e4532694bd8976608a0
2019-07-24 20:10:27 +00:00
dan
01c08bcacd Improve the ".recover" command's handling of corrupt database schemas.
FossilOrigin-Name: becaaa4d29d17ad613f2a120f0b173e53403b3de26f22beaf83f66ebf369bf60
2019-07-24 19:20:30 +00:00
dan
95063c2867 Improve the ".recover" command in the shell tool so that it is not confused by auto-vacuum databases. And so that it can recover tables for which one or more of the column names are SQL keywords.
FossilOrigin-Name: 87d76047d6a3df31bc9b7c0cffa7b758236c124f87263a520850b019cbbc4c6e
2019-07-24 08:15:09 +00:00
dan
1c70f71e12 Avoid redefining types u32 and u16 when fossildelta.c is compiled as part of the amalgamation.
FossilOrigin-Name: d8e88248e3204b5f2b95b9b8921ee7ee2f7574ae81e6abd5b4f2ddf187f7d71b
2019-07-23 13:26:43 +00:00
drh
9378818d89 Do not use the insert-overwrite optimization if the cell might overwrite the
page header.

FossilOrigin-Name: f60a83069168899dcfd706b4d0901084c7ce92d85277950317e962a8a98ec668
2019-07-22 23:24:01 +00:00
drh
e209457295 Consolidate the removal of Window objects from the Select.pWin list into
a single subroutine.

FossilOrigin-Name: e46b2afc99329c43de08d4a2e6ade4d2239d7409c5d5626bf272a3e0dd24d1b4
2019-07-22 19:01:38 +00:00
dan
e0ae3f69eb Fix a bug in the linked-list handling code added by commit [fd7316cd].
FossilOrigin-Name: 05080344dceafcfb670fbf01f7d69a1d713a54b6845f968a9cfe941fb53b13af
2019-07-22 17:28:43 +00:00
drh
cda50737f4 New test cases added to test/fuzzdata8.db
FossilOrigin-Name: 25fec62ac5a23382a54eee78d3705885eb4065826d7e8da098816d03ae9dc639
2019-07-22 16:57:13 +00:00
dan
7f6f12bdd3 Remove Window objects from the corresponding Select.pWin list when they are deleted, as they are, for example, when the ORDER BY clause is optimized out.
FossilOrigin-Name: fd7316cda0fdfe86985f41a97dff3beba188606ec9bc6fef38a686a6976a6e01
2019-07-22 16:33:02 +00:00
dan
75b0821e99 Remove Window objects from the corresponding Select.pWin list when they are deleted.
FossilOrigin-Name: d23f33168222dfa40a67dc7de58057418151989e81429e4af47617e86db04667
2019-07-22 16:20:03 +00:00
dan
1e60261cfb Fix a problem with renaming tables when the schema contains an invocation of a currently unregistered aggregate with a FILTER clause.
FossilOrigin-Name: bd37ce3fb8dee8d538f6afc0bfc13cdc3ebdd504e6461f0130c6ecc8af585f68
2019-07-22 11:38:43 +00:00
drh
fd15e18d7f Make sure any window definitions in an ORDER BY clause are removed from
the SELECT statement if the ORDER BY clause gets optimized out.

FossilOrigin-Name: 23b119671f0be3c6b72cf2dc5f7707a0626766db7aa56529ab00d33d1a0a1bee
2019-07-20 21:12:31 +00:00
drh
7fc296aa66 Early detection of a corrupt R-Tree in the R-Tree search algorithm.
FossilOrigin-Name: 2bf5a4c16457562dc942bcc6ec06d9b4e795ef3ea8e31550e18857bbebd08a76
2019-07-20 18:00:46 +00:00
drh
bcb0e64c82 Performance optimizations in the rtreeStepToLeaf() routine of RTree.
FossilOrigin-Name: 4e34e3615ff31f4a6432033797b2e1a6604007ea0e501d714ecb362632776150
2019-07-20 17:43:28 +00:00
drh
e04c1ec52a New test cases added to test/fuzzdata8.db.
FossilOrigin-Name: 39be3c61bd809cc89bdfdba90afc391ac9c2f81dfd8bb68a9b085b0ca8cd1fba
2019-07-19 15:03:54 +00:00
drh
c5cc870ef8 Refinement to check-in [348e7f193a963390] that avoids unreachable branches.
FossilOrigin-Name: bbfb2908ecd113c88e69a0984cbe2550463cdd3a67648b0e4e3578e80630136e
2019-07-19 15:00:32 +00:00
dan
9bf022d57c Fix a problem with renaming a table when the schema contains an invocation of a window function that is not currently registered.
FossilOrigin-Name: ff290feb97f689cf6ce4162d6aa36f9f9dcf1bff3096847d53a85f39f728d2de
2019-07-19 14:32:42 +00:00
dan
750c6ba5e5 Fix a problem with renaming tables when the schema contains WINDOW definitions with (illegal) non-numeric expressions as part of a PRECEDING or FOLLOWING clause.
FossilOrigin-Name: 348e7f193a963390a0595183d603541f85c5d1a911c98ed2e06599691ffe98f5
2019-07-19 11:20:42 +00:00
dan
a1ac03590b Fix a faulty assert() in walker.c that could fail when processing an ALTER TABLE statement on a schema containing invalid table references that are part of a WINDOW definition.
FossilOrigin-Name: ee076c28d8ee0f5b099cdef83ae6cea6ef5aa209ab528d7c49949dd653ce019c
2019-07-19 10:31:29 +00:00
drh
b555b0806e Fix a new problem in the BETWEEN operator when applied to a window function.
The problem was introduced yesterday by check-in [7ef7b23cbb1b9ace].

FossilOrigin-Name: 47e23064ba0205148f89e12803a62d5a4d6d2054f593f60c031e815112170b9b
2019-07-19 01:11:27 +00:00
drh
4509ffa362 Always use the stdlib.h intptr_t type for pointer-integer conversions, when
it is available.

FossilOrigin-Name: c0d932449db3deed42a99bd948aab61e56b2d8441d7de5243688695ff04e8177
2019-07-17 19:57:55 +00:00
drh
996f5ccb33 Fix an incorrect assert() in balance_nonroot().
FossilOrigin-Name: 59c9e73f86b89ee17b0bce47bcb93f5b5ace5b7985678287195002afb9d40cd8
2019-07-17 16:18:01 +00:00
drh
09ea1256ec Improvement to the hexdb interpreter built into the CLI and into the
TCL test harness: Round the "size" up to the next multiple of the "pagesize".

FossilOrigin-Name: 9ec92939cb2d2c96ae15bc496feed233ce31424c25a6bf86ace7e0ef3eedec5b
2019-07-17 15:05:16 +00:00
dan
8b65e5919d When processing a BETWEEN or CASE expression, avoid transforming a node of the original expression into a TK_REGISTER node. Instead, take a copy and use it instead. Fix for [1be72aab9].
FossilOrigin-Name: 7ef7b23cbb1b9ace9f853238d9133320c153e6c3417e6823ab6394ee1fe56358
2019-07-17 14:34:17 +00:00
drh
3db3d12cd1 Fix the WITHOUT ROWID table logic so that it generates a correct KeyInfo
object for tables that have a PRIMARY KEY containing the same column used
more than once with different collating sequences.  Enhance the index_xinfo
pragma to assist in testing the above. Fix for ticket [fd3aec0c7e3e2998].

FossilOrigin-Name: 84a51a755c18ac8253080db6eec505df894ee3b1e97cfa8e61039ac38001e270
2019-07-17 12:49:16 +00:00
drh
19d9a3ca6c New test cases for PRAGMA index_xinfo on a WITHOUT ROWID table. And new
testcases using index_xinfo to verify that WITHOUT ROWID tables are
constructed correctly.

FossilOrigin-Name: 340378c1e60da80263523776f4b6366a9d332a7ee25986637e8b157f4e8e4bd3
2019-07-17 12:42:15 +00:00
drh
7b1904e35d Enhance the "PRAGMA index_info()" and "PRAGMA index_xinfo()" statements so that
they allow a WITHOUT ROWID table as their argument, and in that case show
the structure of the underlying index used to implement the WITHOUT ROWID
table.

FossilOrigin-Name: 62274ff683ba077d8b0fa34ad653ce235a8c5cbfdb7ab8558469af7333d03698
2019-07-17 11:01:11 +00:00
dan
1ff9407198 Fix problems with duplicate fields in the PRIMARY KEYs of WITHOUT ROWID tables.
FossilOrigin-Name: bd9a47a3a2997bfbf9c8a11c5b7196e362974054e58a2fe701778b1580264de8
2019-07-17 09:18:06 +00:00
dan
4d02b5f7d0 Add casts to shell.c.in to avoid warnings on systems where size_t is 32 bits.
FossilOrigin-Name: fe014288ac03cdf0dc5410b7d45cad4768759b52746c0a22bce2fc03779c5d5a
2019-07-17 07:23:06 +00:00
drh
55f66b341a Add new assert() statements in an attempt to help static analyzers avoid
false-positives.

FossilOrigin-Name: 9e66458592d40fbd96ea5f21339573110ca1cfe328238a020c9420a87d35dd72
2019-07-16 19:44:32 +00:00
drh
2cd02a5d2a Add assert()s in os_win.c in an effort to silence false-positives from
static analyzers.

FossilOrigin-Name: 22a7c15b262376fb0ce4dd3d044373380d86c5ccd96e2f24576cf04318597c33
2019-07-16 18:27:07 +00:00
dan
993b48e2b7 Call ioctl() with the correct signature on both Android and stock Linux.
FossilOrigin-Name: 2422534908a85a4cd11784e4c23a74ad121404f73dade587bf27efde1e2b982b
2019-07-16 05:11:16 +00:00
dan
e464802d49 Fix a problem that could cause a crash if a blob handle were closed after the associated database handle was closed using sqlite3_close_v2().
FossilOrigin-Name: 52f463d29407fad691c42b13462880e7605603c9be9f480d18e953a0ef78149a
2019-07-15 13:58:28 +00:00
dan
ec9b2a132b Call ioctl() with the correct signature on both Android and stock Linux.
FossilOrigin-Name: 68e12e063fe41bcd65cf8a120f838b9b1723ed803ea85240fe0f2145b78df2d7
2019-07-15 07:58:28 +00:00