19703 Commits

Author SHA1 Message Date
drh
09d00b2f4f Ensure that the OP_VColumn opcode does set sqlite3_vtab_nochange() unless
the OPFLAG_NOCHNG bit is set in P5.  Fix for ticket
[69d642332d25aa3b7315a6d385]

FossilOrigin-Name: 322ab1fc613f616e9f07dc94ef74a29572a21cc476d88e97b4ce865500a47b62
2018-09-27 20:20:01 +00:00
dan
0efb6f5135 Another minor tweak to memstat.c so that it may be built against older versions
of SQLite.

FossilOrigin-Name: 4c1fed60b9b35ac2f5d2f2533b54db429d72bdbc0aad0dd5af52ff851789d4ae
2018-09-27 17:33:06 +00:00
drh
6dd5f07d3d Modify the memstat virtual table so that it works with SQLite version 3.9.2.
FossilOrigin-Name: 7171d8ae6b1e7c97b0cf06bcca2262674c9ce557c85666b4b77c16cbac508502
2018-09-27 17:15:21 +00:00
drh
982c1fac2b Add the sqlite_memstat extension - an eponymous virtual table that shows
memory usages statistics for SQLite.

FossilOrigin-Name: 954ef61f6a02532e72c815208ec839310f1e00d69e0003cc6f5426f0559229d1
2018-09-27 17:03:03 +00:00
drh
d7134fe0c1 Enhancements to sqlite_memstat:
(1) Add an extra "schema" column to show the schema name for ZIPVFS stats.
(2) Only show ZIPVFS stats to schema that use ZIPVFS
(3) Put a NULL in unused columns of the output.

FossilOrigin-Name: 9351135b4331107be2f2bda7b6adbd5436381f4f9a68340e8a172b6517ec3f12
2018-09-27 16:57:42 +00:00
drh
7c5577acdc Add initial ZIPVFS support for the "main" database to the sqlite_memstat
virtual table.

FossilOrigin-Name: 9cd27350b0f62debfe3238c57c3ab51079699142e82c05a7ec8460a8429f55f2
2018-09-27 15:45:03 +00:00
drh
d7fda6cfc5 Initial prototype of a eponymous virtual table that accesses sqlite3_status64()
and sqlite3_db_status().

FossilOrigin-Name: 0b44e1f68e0c8349367e3f929d4734c3df96338ec8d6fb652565bf894e8b8343
2018-09-27 15:21:13 +00:00
dan
6afa35c985 Disallow the use of window functions in the recursive part of a recursive CTE.
FossilOrigin-Name: 7fc2994434c7d9ed29c96a69c07e8eb4e97be776473c170c63f9a1bbaa09fa68
2018-09-27 12:14:15 +00:00
mistachkin
1c06b47864 Minor simplification: In OP_ParseSchema, read the p1 register once.
FossilOrigin-Name: bd250533a06e4a11c1f548c3de66b8562fc627383848570d7d030cf132fd336f
2018-09-27 00:04:31 +00:00
drh
eb7f2a0fc5 Further improvements to the ".help" command in the CLI.
FossilOrigin-Name: edc3d18ecbda32d6a55de76ee7335342425c57d917e9b48814a7301a012263b2
2018-09-26 18:02:32 +00:00
drh
98aa2abc45 Begin revamping the ".help" command in the command-line shell so that it
can accept an argument and will do a search for commands that match that
argument.

FossilOrigin-Name: 209afb8d06466536863b89a8acb9a1a18477a06331d8cce95fc6380e1666b6f5
2018-09-26 16:53:51 +00:00
dan
2e5e0e10f2 Tweak spellfix.c so that if SQLITE_SPELLFIX_5BYTE_MAPPINGS is defined at
compile time the Transliteration structure has space for 5 byte (instead of 4
byte) mappings.

FossilOrigin-Name: cbaf5b6c1b07b29b2c83fa01618de856d81cc1174769cb9770cb5c894cc87ace
2018-09-26 16:05:07 +00:00
drh
6b26a7b950 Fix typos in the header comment for the sha1 and sha3 hash extensions
in the ext/misc folder.

FossilOrigin-Name: 4ed9d83a0b14a22b3ecf25785b03b5a824d260e01a608aea85231df9b816421d
2018-09-26 03:43:42 +00:00
dan
6705584a5b Fix a problem in releasetest.tcl causing configuration "Fast-One" to fail.
FossilOrigin-Name: 42e04fefbc241dd33f12abd66344a87720ae4cda6d82f2882217b3cb71be8733
2018-09-25 13:51:31 +00:00
drh
5398806889 Slightly smaller and faster alternative to [507d892c3a40a0bacbd47] that
fixes a problem with views that use window function as part of complex
expressions.

FossilOrigin-Name: d7c816ae15f05f21b9b213161e1044aaefc56f17e7bc4b7b551a9e04efc05855
2018-09-24 15:39:30 +00:00
dan
2fae150402 Fix a problem with views that use window functions as part of complex expressions.
FossilOrigin-Name: 507d892c3a40a0bacbd47ed3c4fe2d8925a82716ae08da8401750a42782ba454
2018-09-24 14:51:59 +00:00
drh
6314eeaeb3 Allow a writable virtual table to have a schema with an INTEGER PRIMARY KEY
and WITHOUT ROWID.  This fixes ticket
[f25d5ceebe1d710ff61a571e395356869d8272ef].

FossilOrigin-Name: 5a38d9281b4ad63b853efa5cdd5ad4a64b19dfaf8250ef8e0e186684df1211ea
2018-09-24 14:10:55 +00:00
drh
6fb5d358a8 Use compile-time options SQLITE_QUERY_PLANNER_LIMIT and
SQLITE_QUERY_PLANNER_LIMIT_INCR to control the value for
WhereLoopBuilder.iPlanLimit, rather than embedding magic numbers in the
code.

FossilOrigin-Name: 903e501894b2a5dd7055b5154d74d4a47a619f76e66485a4d62b6259f10723d6
2018-09-24 12:37:01 +00:00
drh
7ebb605c0a Increase the initial value of WhereLoopBuilder.iPlanLimit to 20K. Issue
a warning if the iPlanLimit reaches zero.

FossilOrigin-Name: 3dd35f51187574f47f860405309877cdbf9dc5710703dfd98cf98073b771140c
2018-09-24 10:47:33 +00:00
drh
f8937f9034 Fix a faulty assert() in the validation logic for the LEFT JOIN strength
reduction optimization.  Problem found by OSSFuzz.

FossilOrigin-Name: 2fd62fccd13e326dbd7dd730112542c6faa56e466bf4f7b8e22ced543031280c
2018-09-23 02:01:42 +00:00
drh
2c3ba94969 Enhance WhereLoopBuilder.iPlanLimit to handle a case involving the OR
optimization discovered overnight by OSSFuzz.

FossilOrigin-Name: 7b59930a1d7b664b54d5a2bc9fa385925b5f4c8f34bf401c798307e3e2dae2c6
2018-09-22 15:05:32 +00:00
mistachkin
7cc5595a01 Fix harmless compiler warning when compiled with SQLITE_OMIT_AUTHORIZATION.
FossilOrigin-Name: 50f2fa19532e0f849d61d9e2a97427cfbf64cfb787ca481ef8c860d0f24f6cfe
2018-09-21 23:41:18 +00:00
drh
5eaebf3a63 Comment typo fixed. No code changes.
FossilOrigin-Name: 7e68cdab20f50cf776b92b2138bb4aba7cb070f2bd855dd4cbbf46d447f2dc88
2018-09-21 19:06:09 +00:00
drh
fc9098a45e Put a limit counter on the query planner that restricts the number of
index+constraint options that can be considered for each table in a join.
This prevents certain pathological queries from taking up too much time
in the query planner.

FossilOrigin-Name: 8690b5a0cc08eeb175230de45d4ca9b9f7b9b22aeebea70b8b7151f10b130969
2018-09-21 18:43:51 +00:00
drh
0d7f0ccd96 Optimization to the OP_MakeRecord opcode makes speed-check.sh run about
1.1 million cycles faster, and results in a slightly smaller library.

FossilOrigin-Name: d10e63629183f6daf0c263cd4dae052a3786c8c1480b3b6a73124b3315e41951
2018-09-21 13:07:14 +00:00
drh
5db90714aa Minor code simplification.
FossilOrigin-Name: 22ae8a52dd2fb744f467c7dccf1d7fe7c7cef0e1dcc897dd492f897e84c9facb
2018-09-20 20:43:28 +00:00
drh
42eb070729 Add the "PRAGMA legacy_alter_table=ON" command to enable the pre-3.25.0
behavior of ALTER TABLE that does not modify the bodies of triggers or
views or the WHERE clause of a partial index.  Enable the legacy behavior
by default when running the xRename method of virtual tables.

FossilOrigin-Name: 7edd26ed27ed1e7eab603058f7d55f2eac45e7bd1908bfa5f32293611883b157
2018-09-20 20:15:02 +00:00
drh
eda079cd2c Combine the Expr.pTab and Expr.pWin fields into a union named "y". Add a new
EP_WinFunc property that is only true if Expr.y.pWin is a valid pointer.
This reduces the size of the Expr object by 8 bytes, reduces the overall
amount of code, and shaves over 1 million cycles off of the speed test.

FossilOrigin-Name: ad130bb86e74e6ce165fdbdce3a19699510f0e62071c1c7923b5a4538d888c7c
2018-09-20 19:02:15 +00:00
dan
34566c4434 By default, make all "ALTER TABLE RENAME" statements executed within a virtual
table xRename() method exhibit the legacy behaviour.

FossilOrigin-Name: 71947337e98b90debb13b390119bc2a6b39dd41535151b836071ee327a31e45d
2018-09-20 17:21:21 +00:00
dan
674b894269 Add a PRAGMA that restores the legacy ALTER TABLE RENAME TO behaviour.
FossilOrigin-Name: 5acad2e92c11c209bedc6ac8a709595e8070eed028ffc82af61499e5ceaa5e2b
2018-09-20 08:28:01 +00:00
drh
504eba5f46 A minor code simplification, saved in a branch for future reference.
FossilOrigin-Name: 5e458f4a92743effb9a3d3249767424fed8b444a05ca136c4a55d60c4d70c2cc
2018-09-19 18:17:46 +00:00
dan
85c6892aa4 Fix a compilation issue in the "userauth" extension. Also fix a few test
script errors that occur with SQLITE_USER_AUTHENTICATION=1 builds.

FossilOrigin-Name: 221f3f572ed49d7af69a2e7c88741fa5206ea33ca59ee791eac7698bdd11ca4d
2018-09-19 17:09:09 +00:00
drh
c6727c8342 Fix the "sqlite3" command in the TCL interface so that it correctly returns
an error if invoked with no arguments.

FossilOrigin-Name: 2034fa8089676132b5e2f71bdebf1af9ca141da2e173920c6e84fb974ab0f022
2018-09-19 15:08:21 +00:00
dan
16f39b6e5d Fix a problem building on Android with SQLITE_ENABLE_BATCH_ATOMIC_WRITE set.
FossilOrigin-Name: e41e50fe7430cb79f67369fe81ac9938665bfc5db59c4faaf429ceb8ca03f584
2018-09-18 19:40:18 +00:00
dan
c4b1e5e758 Avoid incrementing the SQLITE_LOOKASIDE_MISS_SIZE stat before sqlite3_open()
returns. Fix test script problem in lookaside.test.

FossilOrigin-Name: e461cb281959d8517296e3e4e934eba8206770b1a592cd7655b6567268da1634
2018-09-18 17:50:34 +00:00
dan
253c6ee1bf Enhance tester.tcl so that when "--malloctrace=1" is specified, the test
generates self-contained Tcl scripts that present GUIs instead of *.sql files
that require a separate program to interpret.

FossilOrigin-Name: de2e3cbd08c00d235106c040fa472ec267ef8f1ec13c34ed7d16deac8d50b6cc
2018-09-18 17:00:06 +00:00
dan
b1e1a0fd2d Minor improvements to the permutations.test script. Most notably, a command
like "permutations.test alter%" now runs all test scripts with names that
match the LIKE pattern "alter%". Or, say, "permutations wal alter%" to run all
alter% tests in wal mode.

FossilOrigin-Name: 3e1a2f6614eacb65e1dffe64c6292c809fc5808be2d9d7d103cfc57d7b32fcd9
2018-09-18 16:06:42 +00:00
drh
40b4e7a692 Further optimizations to the UPDATE logic to avoid making changes to partial
indexes if none of the columns mentioned in the WHERE clause are modified by
the UPDATE.

FossilOrigin-Name: d1365a5bf0ee2f145427b81d2a593f539c3ad4705d579478703c1f65ae5f80bf
2018-09-17 20:47:38 +00:00
drh
d4cb09e3d2 Disable the ORDER BY LIMIT optimization in queries using window functions.
This fixes a problem that was introduced by check-in [206720129ed2fa8875a286]
which attempted to fix ticket [9936b2fa443fec03ff25f9].  This changes is
a fix for the follow-in tocket [510cde277783b5fb5de628].

FossilOrigin-Name: c6c9585f294710829ca24b64d70a36fd9f409261dd0661367c6c4198cdbc4c81
2018-09-17 15:19:13 +00:00
drh
051a1022ff Fix a false-positive in the post-ALTER-TABLE schema verification logic that
prevents ALTER TABLE from working if the table being altered has a trigger
that references any column of a virtual table. Ticket [b41031ea2b537237].

FossilOrigin-Name: 84105ea4af98bd8bddbdf9dc6674bdf73c110c0685afe868ce9681da110144d7
2018-09-17 14:13:48 +00:00
drh
e597c47545 Restore an assert() that was present on trunk.
FossilOrigin-Name: a7b572ca7867a95f49888dc95c0dc6d726afa9fea26283be147ba422639d1307
2018-09-17 13:55:18 +00:00
dan
de79e094bc Minor modification to the fix on this branch to avoid adding extra conditional
compilation macros.

FossilOrigin-Name: 4d8be404dab265b51e5a6a95e83be85c22512e19a437191690c7d845c87ff259
2018-09-17 13:38:45 +00:00
mistachkin
746127e734 Fix missing space in 'configure.ac' reported on the mailing list.
FossilOrigin-Name: 96b00a3cd2273dd3baa8e5b7a441458b142d4d2daabc679e4fcb5ab706674e76
2018-09-17 12:49:21 +00:00
dan
0208337c16 Add extra test for the fix on this branch. Also fix a
pointer-compare-after-free problem that occurs in similar cases.

FossilOrigin-Name: 1856ea63b3186c2c8fa716ffe01c731397bdbbc3fbb56dc72ad0686cb7f152ca
2018-09-17 08:27:23 +00:00
drh
e68fe9665a Add assert()s to the new code in the previous check-in.
FossilOrigin-Name: b12f23a5c484cab3654721299ea0f05230eef6b14012b557f3bf2592fac0f00e
2018-09-17 00:15:21 +00:00
drh
95f78d98b9 First proposed fix for the ALTER TABLE problem described by ticket
[b41031ea2b5372378cb3d2d]

FossilOrigin-Name: 05a9d129254e01a5f6b5e4033c105190eae386575a94b020ef3e0cbd30bbf056
2018-09-16 23:27:37 +00:00
drh
86f3492650 Remove an unreachable branch from the index-on-expression optimization.
FossilOrigin-Name: 2df2cf4f179dd88fb2530dfd338f344ac48dd052ef954dc95a136884523f7aee
2018-09-16 18:23:48 +00:00
drh
6557a07ca8 Fix a memory leak in the explain extension.
FossilOrigin-Name: d0c92b047a5355726aea87f38038e5bda3adf6137492919be94bd29bb847eddb
2018-09-16 16:34:31 +00:00
drh
9b84f03556 Add the new "explain" virtual table in ext/misc. Use this virtual table
for additional test cases for the optimization that avoids updating indexes
on expressions when none of the columns changed by the UPDATE are in the
expression.

FossilOrigin-Name: 2404304cc15eaeee2744cf3c8f9cac0a544631c4f1060c5a17a78b43ca86edf0
2018-09-16 16:18:01 +00:00
drh
2b7cdf6f6b Improved presentation on the new code that prevents unnecessary writes to
expressions on indexes during an UPDATE when the expression does not reference
any of the columns that are changing.

FossilOrigin-Name: c9f045295c4577752b0847ff2027b44661e6cb15bb08b942ccb3a0ef396f3dec
2018-09-16 15:01:25 +00:00