dan
aa42e9816b
Fix a problem by renaming a column when the schema contains an trigger program
...
featuring an UPSERT that uses an "excluded.*" reference to a different table.
FossilOrigin-Name: 83d5f5abce6be2f6d342a6fc68839289400d7bcb80eaa38194789142c93a80c3
2018-08-24 20:20:33 +00:00
dan
85a9d508df
Fix a problem with renaming a column that occurs as an "excluded.colname"
...
construction in an UPSERT that is part of a trigger program.
FossilOrigin-Name: bb2f7234968157b605522dea8e115d8772ab4234147894089d6e48fedf5d6a5d
2018-08-24 20:10:22 +00:00
mistachkin
88edc6c72a
Set SQLITE_PTRSIZE to 4 when compiling with xlc on 32-bit AIX.
...
FossilOrigin-Name: d158e5b12eec5b81d54c8f5902a972795423947a21d0212b6cceb2810aa6cc5c
2018-08-24 19:04:08 +00:00
dan
0d5fa6b979
After modifying and reparsing the schema as part of an ALTER TABLE RENAME
...
COLUMN, check that no new schema errors have been introduced (e.g. ambiguous
column names in views) before committing the operation.
FossilOrigin-Name: a0e06d2c5e3abb3f300491e7651bb177a436899efd4506de9239359096b6a9e7
2018-08-24 17:55:49 +00:00
dan
1b0c5de434
Avoid incorrectly replacing tokens that refer to a column being renamed via an
...
alias. For example, do not overwrite "xyz" when "a" is renamed in "CREATE VIEW
v1 AS SELECT a AS xyz FROM tbl WHERE xyz=1"
FossilOrigin-Name: ad072a835f97ff418f5919d94f547ce8afb4fc7c7b590deba41f1e62136a79ac
2018-08-24 16:04:26 +00:00
drh
355f2e02e9
Add the "atrc" test program to the Makefiles. Fix a typo in the instructions
...
in the header comment of the atrc program.
FossilOrigin-Name: 2130a407ddd8cdf3d29b109d773686c84906d9dc1663376e94e191086d524c9e
2018-08-23 20:09:19 +00:00
drh
79a5ee93c7
Fix harmless compiler warnings in the ALTER TABLE logic. Rephrase an
...
error message to use active voice.
FossilOrigin-Name: a7dae59a7e7b187fa2e9457bbb4b01cfe3d48bbdf59c3f8f7b4156bcde3bda98
2018-08-23 19:32:04 +00:00
drh
ba3a4072b4
Automatically detect when compiling for AArch64 on windows and set
...
SQLITE_BYTEORDER to little-endian to avoid compile-time testing.
FossilOrigin-Name: ef6729be85ed106212ed23a024d83b85b709207cf287436c0603a21c659f36ad
2018-08-23 18:56:33 +00:00
drh
d3130dab92
The Expr.iColumn field must also be initialized in tokenExpr().
...
FossilOrigin-Name: 772985f18b2ab8fa04a0c29593fc6d9b74c1361260cb59e566606dd56f326535
2018-08-23 18:50:19 +00:00
drh
4fe759b2cc
Make sure the Expr.iTable field is initialized by tokenExpr().
...
FossilOrigin-Name: 02a05a3b3c6440432fc15daa14678a6eba40759e17e43ae8d63d19a0842de56a
2018-08-23 18:22:00 +00:00
drh
a961d3a198
Merge enhancements from trunk.
...
FossilOrigin-Name: c446c8841192054c97ba5003fb6185b135a687b36c10fe0986e627282955520a
2018-08-23 14:54:45 +00:00
dan
79e9d34764
Fix a test case that was failing for SQLITE_ENABLE_STAT4 builds.
...
FossilOrigin-Name: 1e29fd430dead641c5d92943ce81cf51b3df2f45c5a011bb2eed592efd62e056
2018-08-21 17:03:25 +00:00
dan
07e9523364
Rename internal function sqlite3RenameToken() to sqlite3RenameTokenMap() and
...
sqlite3MoveRenameToken() to sqlite3RenameTokenRemap().
FossilOrigin-Name: b9ae9a0a188b82d7066f6ef7d21592889df0a61559e9a0e01819e9d5a92c3f36
2018-08-21 16:32:53 +00:00
dan
0624939818
Rationalize some duplicated code in alter.c. Also improve error messages for
...
ALTER TABLE RENAME COLUMN in some cases.
FossilOrigin-Name: 5d2163c734aea8c0e1611af1161734bf141e7bd02c08f0b5f2e7bac3c7dfd2a5
2018-08-21 15:06:59 +00:00
drh
f396ecadcd
Further attempts to reduce the number of false-positives genenerated by
...
static analysis tools.
FossilOrigin-Name: 38f9ce6503c4dd05ccdd73463b1784a6df7ed6e5018c29c5874a3681ca34ba54
2018-08-21 12:46:34 +00:00
drh
c4ceea72b7
Fix various harmless warnings generated by static analysis tools.
...
FossilOrigin-Name: a04a0ea9e30e0ef12bafa0b90b7d1b7764865768bb4a738b0c73a7a3ef9416db
2018-08-21 12:16:33 +00:00
dan
d145e5f46f
Minor changes to function tokenExpr() in order to claw back cycles lost to the
...
rename-column change.
FossilOrigin-Name: 479976955ecb27c3e77a280187eaf23722178549e072b34f3183354a27a4e5c3
2018-08-21 08:29:48 +00:00
dan
b013738b4c
Add further tests for RENAME COLUMN.
...
FossilOrigin-Name: 82c4c10a96db76f39edf5f6d027294d449d75b5a18da70da3667786da90e184d
2018-08-20 20:01:01 +00:00
dan
9d70557e80
Ensure that it is not possible to rename columns of system tables, views or
...
virtual tables.
FossilOrigin-Name: 786b5991dc0bb6ba13327a3ac9d04efbf8b591dedc736b719b206ffd865b1918
2018-08-20 16:16:05 +00:00
drh
38d9964a73
Additional fixes for harmless compiler warnings that are specific to this
...
branch.
FossilOrigin-Name: 9d8e73bf71e996b810959ffc0e60de69b5e8ca3301df52f9c35d5e9075921798
2018-08-18 18:27:18 +00:00
drh
2ee001ab39
Merge trunk fixes.
...
FossilOrigin-Name: ccad277927baa2c36d0b5a03832dc51d9a7f3071587f0da0f2c1b44885c82e8d
2018-08-18 18:14:02 +00:00
dan
c23f3cb15b
Have ALTER TABLE RENAME COLUMN also edit trigger and view definitions.
...
FossilOrigin-Name: 7908e8a4a3b9577211a5d3da9c4142c46e9d5872be4a6499ec053f2b547019b8
2018-08-18 18:01:58 +00:00
dan
24fedb94c2
Improvements to error handling in ALTER TABLE RENAME COLUMN.
...
FossilOrigin-Name: 7fa1faeaff30b74b68ee6f4b363d837f21cf313d8262361c901bda884df139a2
2018-08-18 17:35:38 +00:00
mistachkin
ed5e7722b2
Fix harmless compiler warnings only seen with STAT4 enabled.
...
FossilOrigin-Name: 6f5e84bafcaf425cb664c7db8179c9c09a13c96aaf057551c04a919ca554d057
2018-08-17 21:14:28 +00:00
dan
499b825487
Allow an ALTER TABLE RENAME COLUMN to proceed even if the schema contains a
...
virtual table for which the module is unavailable.
FossilOrigin-Name: 7b72b2360a70eb1f788b3c4d745967dfedb2c80af6b2e146ba940a3741fd51a1
2018-08-17 18:08:28 +00:00
dan
dabc268f96
Ensure that CREATE VIEW, TRIGGER or INDEX statements can be edited by ALTER
...
TABLE RENAME COLUMN even if they use collation-sequences or
user-defined-functions that are not available.
FossilOrigin-Name: 540014efd6a048373313c6cd9413de10d5d7114daf537cf5999ccf3c5c3f9358
2018-08-17 17:18:16 +00:00
dan
0cbb0b11f1
Further progress on updating trigger programs as part of ALTER TABLE RENAME
...
COLUMN.
FossilOrigin-Name: 3f47222b6e20e1c1ef41c0f7391c8b5c7648e2a2d6013303d155ad59ce27143a
2018-08-16 19:49:16 +00:00
drh
3fcef1a3f9
Fix a harmless unused-variable compiler warning that only came up in certain
...
compile-time configurations.
FossilOrigin-Name: 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61
2018-08-16 16:24:24 +00:00
drh
d8852095e0
Fix EXPLAIN QUERY PLAN so that it describes IN operators implemented using
...
a ROWID lookup.
FossilOrigin-Name: 60045fbf52162f15f2e18a4e392e80fab19bdbce242728b5e62b0894eac49dfd
2018-08-16 15:29:40 +00:00
dan
5be60c55e8
(no comment)
...
FossilOrigin-Name: e272dc2b1c0edab59a40f32c77c81a3e636937280524161eff5669cb0046ad84
2018-08-15 20:28:39 +00:00
dan
588032fe33
Allow sqlite3_snapshot_open() to be called to change the snapshot after a read
...
transaction is already open on database.
FossilOrigin-Name: 41399169954f9bef53c3fa89879f39823b80bd127f76cf60abbe24217878a571
2018-08-15 14:03:26 +00:00
dan
356afab163
Fix a problem when renaming an IPK column that is also part of a child key.
...
FossilOrigin-Name: 6e6a2bfdbbfd4ffc14be88962ff97bf3c626fef9d1a337715d2a4be1a657fb0d
2018-08-14 21:05:35 +00:00
dan
f62e8937ac
Fix a problem when renaming an IPK column that is also part of a child key.
...
FossilOrigin-Name: ad15486022209205c65fb5ffdbe30a7b99379170451e6aff4bab6e90b549d6c7
2018-08-14 21:03:38 +00:00
dan
72238130d0
Merge latest trunk and ALTER TABLE error message improvements into this
...
branch.
FossilOrigin-Name: 7a45802dafaed3c058f59d1487fe8091e1f309cc5f0a5bcf2579f0bdd8e92d89
2018-08-14 20:40:25 +00:00
drh
af4023de22
Do not allow ALTER TABLE RENAME COLUMN on a virtual table.
...
FossilOrigin-Name: f6d6b472713c21deace3fd52c0b0b6901d758af043c238f004fabe52b01f730c
2018-08-14 20:38:18 +00:00
dan
987db767d2
Have ALTER TABLE RENAME edit column references in CREATE VIEW statements.
...
FossilOrigin-Name: db829dc1a2d7afa49798a2fd32d1f070185b23e513416e65d8144fda24f23b50
2018-08-14 20:18:50 +00:00
drh
1595abcda6
Improved error messages when an ALTER TABLE RENAME COLUMN fails due to a
...
duplicate column name.
FossilOrigin-Name: 37d11b8e8224a8b241ff57b9c4b9499db39dde4ddcb56ff8b03a3d08091a4c11
2018-08-14 19:27:51 +00:00
drh
5550b5eee7
Merge fixes and enhancements from trunk.
...
FossilOrigin-Name: dff0314b7e7ef2d04375ff21fbf89039bf5f64a9cdca53d7bc7120faacd92c06
2018-08-14 18:12:33 +00:00
dan
689b9d269c
Fix ALTER TABLE RENAME COLUMN in cases where the column being renamed is an
...
IPK declared with a separate PRIMARY KEY clause - "CREATE TABLE x(y INTEGER,
PRIMARY KEY(y))".
FossilOrigin-Name: 32ca8418df8735a6c53e53153f733579e514711f091e4e09ecce83db85fe4d85
2018-08-14 16:18:19 +00:00
drh
8430450674
Fix UPSERT so that it checks the target-constraint first and fires the
...
DO UPDATE if that constraint is violated regardless of whether or not
other constraints are in violation. This aligns SQLite behavior with
what PostgreSQL does. Fix for ticket [908f001483982c43cdb476dfb590a1a].
FossilOrigin-Name: 529fb55e3d00472f13446117527b0896827b11e870b581af7fe7cbb7392ef3cd
2018-08-14 15:12:52 +00:00
drh
ef52b36a6b
Stop requiring the global VFS mutex to access the unixInodeInfo.pUnused field.
...
The unixInodeInfo mutex is sufficient.
FossilOrigin-Name: e3ea43dabf099dc2954c23d348638e7b2a8b9122d2994154bc649a2c09260c46
2018-08-13 22:50:34 +00:00
drh
095908e1c7
Take extra precautions to ensure access to unixInodeInfo.pUnused is protected
...
by all necessary mutexes.
FossilOrigin-Name: 8b1e0010b9e0b548a90087f4d25843d2b40f7e9551722ac587fa925d37b510c2
2018-08-13 20:46:18 +00:00
dan
5496d6a25a
Edit the WHEN and UPDATE OF clauses of trigger programs as part of ALTER TABLE
...
RENAME COLUMN.
FossilOrigin-Name: 5fdb6b0aafba727139e1937ef5950e4434a77f95a10fc46f8010ca2de3922326
2018-08-13 17:14:26 +00:00
drh
0a1cc223bd
Make the sqlite_rename_column() SQL function resistant to problems caused
...
by OOMs and/or malformed parameters submitted by hostile application code.
Also add additional comments to the RENAME COLUMN logic.
FossilOrigin-Name: 87743ddef11749b4017d60abc297abfd673e02a26a2ae45ffec861327578aa30
2018-08-13 17:02:26 +00:00
drh
4a2c747c4c
Fix legacy comments on Token. Begin commenting the new ALTER TABLE RENAME
...
COLUMN code. Fix a memory leak in the sqlite_rename_column() SQL function.
FossilOrigin-Name: 32edc8920376aabb84ebe1900eaa9512d23f1b44d6459e4916dc6b07db66e27c
2018-08-13 15:09:48 +00:00
drh
5fc22cdfde
Fix issues with ALTER TABLE RENAME COLUMN associated with OOM errors.
...
FossilOrigin-Name: 0b28dd5c2e4908d5e49eaedd359492e46de8af3bf84120f4683b3ea906882fbf
2018-08-13 13:43:11 +00:00
drh
3e2c842e46
Fix an incorrect comment on the unix-nolock VFS object. No functional
...
code changes.
FossilOrigin-Name: 90f7c193b42f0d8120a8e429bdea5e1cec5d3f45b901db8fc5a5c2ca3e69cba8
2018-08-13 11:32:07 +00:00
drh
3a9a76b70a
Add the "atrc" test program. "Atrc" is short for "ALTER TABLE RENAME COLUMN".
...
See the header comment on the program itself for further information.
FossilOrigin-Name: ed64a55a2242408ac0b889b330cf91d38a954399b75c6ebe71232613b864c70b
2018-08-11 20:46:54 +00:00
dan
404c3ba0d6
If the new column name in an ALTER TABLE RENAME COLUMN statement is quoted,
...
then also use quotes for the column name in the edited SQL statements.
FossilOrigin-Name: ca5184a25f9150540a3e401ef67df0606efa7a294d70e3fa5edad9854003eb36
2018-08-11 20:38:33 +00:00
dan
b0c7920d86
Avoid an assert() sometimes triggered by ALTER TABLE RENAME COLUMN in non-debug builds.
...
FossilOrigin-Name: 520c1c75dae5e3f4695fcdf0aad5fb9f492f0e528b5fbb49d5d3b5fc02762f47
2018-08-11 18:34:25 +00:00
dan
a8762ae27c
Fix a bug causing ALTER TABLE RENAME COLUMN to fail when renaming an IPK
...
column that is used in a CHECK constraint.
FossilOrigin-Name: 6595c8811f13719d0aed8041abc7e1cade41c57427bcbf3503e2e42408eaa03b
2018-08-11 17:49:23 +00:00
dan
872165f260
Fix a bug causing all ALTER TABLE RENAME COLUMN commands to fail if ANALYZE
...
had been run on the database. Also prevent the user from renaming the columns
of system tables.
FossilOrigin-Name: ca644a2877c26561f8fb3b3feb74a070cd46621acb105577f04bc936c9b72a95
2018-08-11 17:34:38 +00:00
dan
e325ffed04
Reload the entire schema after renaming a column in order to ensure that the
...
schema for any tables for which parent key definitions were changed are
reloaded.
FossilOrigin-Name: f4497b0136e9fcb1121a834c86f84eeaf8f1e7d3157d409484e086bcef3487f1
2018-08-11 13:40:20 +00:00
dan
5da06d3d7e
Ensure the schema cookie is changed when a column is renamed.
...
FossilOrigin-Name: 2dec9ea4ab1779d00bb22add0aa9a8536661d8abc9f4c2fb8628e04d4cd84326
2018-08-10 20:19:34 +00:00
drh
ad866a1e00
Fix harmless compiler warnings.
...
FossilOrigin-Name: 9564d7008c3fd804401a5da6ea342c6f4261db14e9f994d1a38883358a7c6f8c
2018-08-10 19:33:09 +00:00
dan
6fe7f23fa9
When a column is renamed, update any references to it in REFERENCES clauses
...
that belong to other tables.
FossilOrigin-Name: 191079bd4f774528a1e39b71b4a4ce7859dee0edf0ce72e4b6968ae889dc35c8
2018-08-10 19:19:33 +00:00
dan
7364fb1d04
Merge latest trunk changes with this branch.
...
FossilOrigin-Name: c355a8370782aa70f155ee956fa0faec7f45d7c483c442b169b63c5f0a988fd3
2018-08-10 15:27:55 +00:00
dan
e9a2fa3182
Fix a problem with renaming columns on tables with REFERENCES clauses that
...
specify a large number of columns.
FossilOrigin-Name: d48f7bbdf4a1686c25e634a8dec6ead88bf2866fee94ed8e5058f830363424a8
2018-08-10 14:23:41 +00:00
drh
ad9f515f52
Fix the isLikeOrGlob() routine in the WHERE clause processing logic so that
...
it avoids signed/unsigned character comparisons, as that can lead to an
incorrect answer if the ESCAPE clause is an invalid UTF8 string. Problem
found by OSSFuzz.
FossilOrigin-Name: 4195a3f8b5d2c2ec63771890c5aa7b5e2de60b9fa2273652730239b8577ae418
2018-08-09 21:45:45 +00:00
dan
cf8f289542
Experimental implementation of ALTER TABLE ... RENAME COLUMN. Still buggy.
...
FossilOrigin-Name: fa0fc01eb48a864f0a3d43f9b805d5ed2e530846ee0c34fcbc2eabd9e5696277
2018-08-09 20:47:01 +00:00
drh
d98f53249c
When a column must be a constant due to WHERE clause and the value of that
...
column is being coded as a constant, make sure the affinity is correct.
FossilOrigin-Name: 7404ea83168e6c739ebe8fc5d65bbf0265432ccb35b3418bb0381d74362f7527
2018-08-09 18:36:54 +00:00
mistachkin
6389a7b0ac
Minor style improvements.
...
FossilOrigin-Name: 60bbca2b9a591800cd8e7b374e62d75b1df0e8fd2d2f71f9b4d5fd044da78be0
2018-08-08 20:46:35 +00:00
dan
fa3d4c19a9
Allow sqlite3_snapshot_open() to be called to change the snapshot after a
...
read transaction is already open on database.
FossilOrigin-Name: 051ac0152048ef52723196c26ca5f2629dafb782aec1c66fc30531bf54335043
2018-08-06 17:12:36 +00:00
drh
f018fd5284
Enhance the edit() function so that it converts text from \r\n back into \n
...
only if the original unedited copy contained no \r\n values.
FossilOrigin-Name: 20c995d3f0f4de5410962172cb59da0f25edf0c62e199420186cc59ea874e981
2018-08-06 02:08:53 +00:00
drh
5180d683a0
Add the --info option to the fuzzcheck test utility.
...
FossilOrigin-Name: 1caaaaa70f21fe71fbe0af227eea8d1367870e2575eedf248cc2a0b515783390
2018-08-06 01:39:31 +00:00
drh
24846bc0bf
Fix an overzealous assert() statement discovered by OSSFuzz.
...
FossilOrigin-Name: d9c9fe9f5ad3fc9123ad29ebafcb7f40dcecd448fb7a928bb31bea8181d81ec1
2018-08-06 01:21:53 +00:00
drh
dda7e66d7d
Remove the column-cache from the code generator. The column-cache has been
...
a persistent source of bugs for years and with recent improvements
in the performance of OP_Column, it no longer provides a benefit. After
the column cache is removed, the binary is almost 2KB smaller and the
speed-check.sh performance test is over 3 million cycles faster.
FossilOrigin-Name: cdff3af7bedc5ebea04bd9b5e2112d3db451a475c18c9a9ebd45f6f3a89a43cb
2018-08-04 20:30:55 +00:00
drh
cfdeeeb966
Remove a testcase() that is no longer reachable without the column cache.
...
Provide an assert() to help prove that the testcase is no longer reachable.
FossilOrigin-Name: a500893b6f64aced197cd32b79d51a481629a39d45dbcf0f02d65e5451ac4706
2018-08-04 20:12:10 +00:00
drh
36a5d88dde
Fix comments that were made obsolete by the removal of the column cache.
...
FossilOrigin-Name: 2041231d56c7b02b785015ef4d1af260d61326eab1b2a304c17faa3e33f76441
2018-08-04 17:15:56 +00:00
drh
c6ed275fcb
Remove more column-cache residue: The OP_SetColTab and OP_VerifyColTab
...
opcodes and the associated SQLITE_DEBUG_COLUMNCACHE logic.
FossilOrigin-Name: 80236e81cefdf3d3cda3dbdb6de1575c38e4e248cc4b72ca9ee96d3aa0464bfd
2018-08-04 16:54:53 +00:00
drh
8c60719132
Further logic simplifications that flow out of the omission of the column cache.
...
FossilOrigin-Name: 7d9072b027cc28dd8ecf5e2686d821017997445c15124eebe2839984622af4db
2018-08-04 15:53:55 +00:00
drh
bb9c45b49a
Add test cases for the constant expression fix of the previous check-in.
...
FossilOrigin-Name: 95db5bd9fea86a10c9528dd24841e1370dfdc0bbb5c98b7cbd808a8bc59dd48f
2018-08-04 15:28:12 +00:00
drh
b8b0669065
Ensure that all expressions that are to be evaluated once at the start of
...
a prepared statement (the Parse.pConstExpr expressions) pass the
sqlite3ExprIsConstantNotJoin() test. It is not sufficient to pass just the
sqlite3ExprIsConstant() test as that would allow through column references
that are bound to constants by the WHERE clause in the constant propagation
optimization. This fixes a problem discovered by OSSFuzz.
FossilOrigin-Name: 8bc7f84c39f913b0b0f5e9f5fd9d7dd8bda8422248c069712b6992c32c759a83
2018-08-04 15:16:20 +00:00
drh
38ee2d9197
Remove additional traces of the column cache.
...
FossilOrigin-Name: db6052e9725368736abd19f14f97376582d35d07f543046d39991d767ed29851
2018-08-04 14:30:21 +00:00
drh
02ceed058a
Completely remove the column cache logic, which has been a persistent source
...
of bugs for many years. We recent enhancements to the performance of the
OP_Column opcode, the removing the column cache actually makes speed-check.sh
run faster. It also saves about 1,800 bytes of code space.
FossilOrigin-Name: 3f5f60cd7529330209027fdae8129cca420cec1050eae50a7750d0b715b56972
2018-08-03 23:04:16 +00:00
dan
a4b5fb55f3
Fix the handling of sub-queries with LIMIT clauses by the optimization
...
activated by compile-time symbol SQLITE_COUNTOFVIEW_OPTIMIZATION.
FossilOrigin-Name: 21235d9a41567897418aa12f7bd6dd8d6ee363147527e1d8fbca14fc83e0f2c9
2018-08-03 20:19:52 +00:00
drh
e4fe6d4e62
Fix the OP_SeekRowid opcode so that it has no type-change side-effects on the
...
key register in P3. This fixes an obcure problem that arises when doing
equi-joins between a table with a TEXT column against another table with
an INTEGER PRIMARY KEY. The original problem was discovered when OSSFuzz
created such a query and hit an assert() in OP_VerifyTabCol that was
specifically designed to catch these kinds of errors at run-time.
FossilOrigin-Name: fa94b49e02eb6b8fc4acc220ecc2fabef546c65845696758b25965c26b251ea9
2018-08-03 15:58:07 +00:00
drh
5eae974c48
Improve "PRAGMA vdbe_trace=ON" to always show the key values for the
...
OP_IdxGT and related opcodes.
FossilOrigin-Name: 0f881955ed173c7c35dfca2d4aeca855858e40bb951e6fb6fedd9a2fff6a5a86
2018-08-03 13:56:26 +00:00
drh
884406b42c
In the command-line shell, always exit if realloc() fails.
...
FossilOrigin-Name: e390023c8e70961661fd9e29674dedacd1b941b6b8d9cd88f8cfa8f787f030f9
2018-07-29 18:56:35 +00:00
drh
f559ed3400
Add a small cost penalty to sorting to bias the query planner in favor of
...
plans that do not require a final sorting pass.
FossilOrigin-Name: 85b9beb4605eb0cfe2ed063c2a1925186c9e37031f78c875e60a347cce891638
2018-07-28 21:01:55 +00:00
drh
07aded63f4
Do not allow a column reference that is converted into a constant by the
...
WHERE-clause constant propagation optimization to be moved to the init-time
constant expression list, as the table reference will not work there.
This fixes a problem found by OSSFuzz.
FossilOrigin-Name: d30b2a947313b146f29e2b53f0fd471409fda7938151241d3fb5863614f88999
2018-07-28 16:24:08 +00:00
drh
1fd4e7bb0c
Fix an assert() statement that was made obsolete by the constant
...
propagation enhancement. Problem discovered by OSSFuzz.
FossilOrigin-Name: e4b4737e348235e196a45e1b71876b82e0cc836e1c5c16ea5f9333b7509b59b8
2018-07-28 14:56:56 +00:00
drh
d2a4401c8a
Improved debugging output when the ".selecttrace" option is used in the shell.
...
FossilOrigin-Name: fcb88dd6b0f248f600c1158907889f6d5fa2c96eb4585221941da4673c6db6eb
2018-07-28 14:34:22 +00:00
drh
954733b386
Improvements to the parser to increase coverage. Fix the parser so that
...
at least one expresssion is required after PARTITION BY and within the
list of expressions on VALUES().
FossilOrigin-Name: 02204f8b246c868846f39bd44f2e3bc0fab0275aa09ef3a0e5a8e3d58f484ca8
2018-07-27 23:33:16 +00:00
drh
cf8e0861a2
When doing a DROP VIEW do not try to delete entries from the sqlite_stat1
...
table as there are none.
FossilOrigin-Name: 7efdba2bbc8547ee9292a1bbd1e61d38b40d7aabc0860ceba188bdec539f5114
2018-07-27 22:55:58 +00:00
drh
550a33091b
Minor grammar changes that help the parser run faster by reducing the
...
number of NUL rule reductions.
FossilOrigin-Name: cfd1b00592bd550e444dfc7b6a6a93c77c07b835729c6cc69a4b6361038964ba
2018-07-27 22:14:50 +00:00
mistachkin
1f237e3f52
Enhance Makefile for MSVC to support building the shell tool without using the amalgamation.
...
FossilOrigin-Name: 3d815d83a6805938b87e03ffabe6d71ca2ecfd05052e8e02c6cc5d3c9ea4ddf3
2018-07-27 20:45:28 +00:00
drh
2d475e80bd
The WHERE-clause constant propagation optimization attempts to use
...
transitive laws to replace column values with constants in the WHERE
clause in order to help to query planner make more aggressive optimizations.
FossilOrigin-Name: f4229707ac08d66c5b0f53483ce17a63f5ac40a21922f66c3408e1b6fda3a7c2
2018-07-27 20:37:42 +00:00
drh
9cbf4f3550
Reduce the performance cost of the constant propagation optimization to
...
less than 200,000 cycles.
FossilOrigin-Name: 865249de683e6971984a645a30d96f9fcc6f6d9d7af7e269ff68cc3e42e5fe71
2018-07-27 20:01:00 +00:00
drh
e081d73c46
Performance improvement to sqlite3ExprCollSeq(). With this change, the
...
performance of speed-check.sh is within 400,000 cycles of trunk.
FossilOrigin-Name: a5f86f49b7d9e52546f234f7c3bcbac6b0f78aa55a71c44ca69e21bc31139f3e
2018-07-27 18:19:12 +00:00
drh
bcd15938ae
Faster implementation of sqlite3IsBinary().
...
FossilOrigin-Name: be05d0db09f43cc3362c28273463d1d236af737a4f8a494cf1050da07ed0df47
2018-07-27 18:12:40 +00:00
drh
7810ab6464
Only run the constant propagation optimization on joins since that is the
...
only scenario where it is useful. This saves prepare time for the common
case of a simple query.
FossilOrigin-Name: 598d608359005b13fa1151c6c69f2fd12ef3ab7f563a035fc4a6f3c569dc6c67
2018-07-27 17:51:20 +00:00
drh
efad2e2366
Constant propagation is now restricted to just the WHERE clause. The
...
mechanism is changed to take affinity and collation into account. This
seems to give correct answers. But the search for constant propagation
costs 4 million cycles in the speed test.
FossilOrigin-Name: 82c67efb723dba387964f690cd459b420e59e3367d9589016597a76531596391
2018-07-27 16:57:11 +00:00
drh
7de7602eb7
Add a test case demonstrating the collation problem with constant propagation.
...
FossilOrigin-Name: 50add839fd95665bd67a6ae5de8346fd09e83904bbcbad26fad280dff86d9e93
2018-07-26 23:54:19 +00:00
drh
24e1116e0f
Generalize the constant propagation optimization so that it applies on every
...
WHERE close, not just those that contain a subquery. This then demonstrates
that the current implementation is inadequate since it does not take into
account collating sequences.
FossilOrigin-Name: 57eb2abd5b270d65be5e0f138f0d46899fa6091df3ba20b0ea7ef04244a15d48
2018-07-26 23:47:11 +00:00
drh
ce705305b5
In the unix VFS, give every unixInodeInfo object its own mutex, rather
...
than using the global VFS mutex, to improve concurrency in cases where there
are many threads operating on separate database files.
FossilOrigin-Name: 22f47cf430827c50634794a5a33987511bb71492c0dd1f6466a0c5b779d0521b
2018-07-26 21:48:05 +00:00
drh
660ee55663
Initial implementation of the WHERE-clause constant propagation optimization.
...
FossilOrigin-Name: 2fb82ad8ebb6434438c0d235b1239444fb08c8711cea2c5a9ed955fedd0acdec
2018-07-26 21:16:53 +00:00
dan
42b2653871
Fix a buffer overread in fts5.
...
FossilOrigin-Name: 0e3de8abbb0c7ae64e637776cb055ce79736f99a103e00e44d17a6b091b98c81
2018-07-25 15:25:55 +00:00
mistachkin
758784d1db
Keep generated opcode values grouped together when required, even when they do not correspond to a token.
...
FossilOrigin-Name: 6ee2950b272ede475e485bfaa7d413eaa81482fe9dd6452aeeaf95ff7938f7da
2018-07-25 15:12:29 +00:00
dan
caf0a2540c
Fix a typo in the documentation for sqlite3_snapshot_get().
...
FossilOrigin-Name: cd9713c9a88cd30887c67f477abbbf8ef90299051a0b9bb52a04cf4132987c9c
2018-07-25 07:29:20 +00:00
drh
ba968dbfe7
Do not abort running queries due to a CREATE INDEX statement. Allow them
...
to run to completion before being reprepared. Fix for ticket
[c694113e50321afdf9].
FossilOrigin-Name: 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c
2018-07-24 22:02:12 +00:00
mistachkin
5a193dd8e6
Add missing SQLITE_OMIT_WINDOWFUNC check to the json1 extension.
...
FossilOrigin-Name: fe19f8239dc474db0854a0a8ce5189ac4195c736b496f475a59a185e0879b40c
2018-07-24 13:57:44 +00:00
drh
6886d6dbc4
Return an SQLITE_NOMEM error if the locking mutex fails to allocate.
...
FossilOrigin-Name: 1c94834879be0601ac40ef3c4fb1b140f7737e89af7808f2f1db4ceb3daae19f
2018-07-23 22:55:10 +00:00
drh
da6dc2404a
First attempt at reducing mutex contention in the unix VFS by providing
...
a separate mutex for each unixInodeInfo object.
FossilOrigin-Name: f69afaf00a659cd768a863c5f4a1d527f01187e037240da0ada527cb52c5afe8
2018-07-23 21:10:37 +00:00
mistachkin
1489785be5
Fix typo of 'SQLITE_OMIT_WINDOWFUNC'.
...
FossilOrigin-Name: 8607b84a5c53d8c9218c90802160a3000f1138b1f188e411a3af46253e0a69cc
2018-07-23 18:53:49 +00:00
drh
eca5d3a30c
Attempt to improve the documentation for snapshots. No changes to code.
...
FossilOrigin-Name: 46dd076af5880e6e9a7de974758b26bc43d0dc074f8143234038fa9cdcc726ee
2018-07-23 18:32:42 +00:00
dan
78ccff100e
Fix the macros used to generate the output of "PRAGMA compile_options" so that
...
they handle valid values for the SQLITE_DEFAULT_LOOKASIDE macro (which
contain a "," character).
FossilOrigin-Name: 1cc72845f92198f2f6c1d34957921cd8f5bc82eaccab9f844006993f0b8d7a96
2018-07-23 10:57:53 +00:00
mistachkin
709c822f5e
Fix more harmless compiler warnings seen with MSVC.
...
FossilOrigin-Name: edab5666f8470b37e6031dfd80e615b1aab95d1d85ccbe4ece1a813f8b3d4d95
2018-07-22 21:23:19 +00:00
mistachkin
8417863fe1
Another minor revision to the 'fulltestonly' set of tests.
...
FossilOrigin-Name: 61f8e2a4c6c146ffba498c8bb40f2b5627fdc14020057eab63b7e900bf88a9ed
2018-07-22 21:08:35 +00:00
mistachkin
5db9a2b364
Fix harmless compiler warning.
...
FossilOrigin-Name: ead4762dfcd284127e60483e14f88aa4f4f034c2e1efb68a150359ba8f307776
2018-07-22 20:24:38 +00:00
mistachkin
1e8487db29
In the Win32 VFS, when truncating a file, unmap it first.
...
FossilOrigin-Name: 21510a66dce4d0843ccfe20f092a01f5a52563ef244a94f1d5d2563305cab925
2018-07-22 06:25:35 +00:00
drh
9a047bb881
Remove an unused branch in the FK logic.
...
FossilOrigin-Name: 523ff77925f1da361cf31e3fc82bcb1708ed356a2391430ab14ef620c9bf2327
2018-07-22 00:45:11 +00:00
mistachkin
9676e611b6
In 'resetdb.test', close a database prior to trying to delete it.
...
FossilOrigin-Name: 45137053a511b976f5447b0668e3f3a636785d242f44b110a1107898e847e95e
2018-07-21 23:15:55 +00:00
mistachkin
0fc2da3f79
When dropping a view, skip trying to delete from 'sqlite_stat*'.
...
FossilOrigin-Name: 2f5be3a2ddf469bd1b37b9e357545ce872b90c479a07094de2101d0a43ad70a4
2018-07-20 20:56:22 +00:00
drh
72d03a646c
Change the SQLITE_Stat34 bit of the optimization test-control so that it
...
prevents STAT4 data from being used but allows it to be loaded into the
Index objects. This permits STAT4 to be turned on and off on a per-statement
basis.
FossilOrigin-Name: 489f3caf5dcc8cace20a0da58ceb32fdea5770ba570fa3c9f712cd35e726846a
2018-07-20 19:24:02 +00:00
drh
040d77aa71
New checked in PRAGMA integrity_check to validate the autovacuum settings
...
in the header.
FossilOrigin-Name: a4663f09c91d1381a831f61a2b8e8a113eb6083932c4aea2ad0c011ece1418c5
2018-07-20 15:44:09 +00:00
drh
91d5866eb6
Enhanced detection of problems on the freelist and on overflow list in
...
PRAGMA integrity_check.
FossilOrigin-Name: 11e58f5b37d99848978007d834d187c262d904eb9d58924742e028d7cb324e64
2018-07-20 13:39:28 +00:00
drh
b0b0230082
Avoid a branch in the commit logic that is unreachable when compiled
...
without SQLITE_ENABLE_BATCH_ATOMIC_WRITE.
FossilOrigin-Name: 271b8980c3bcd0403a40aec26681ec111be1d88d2d5d35199a85a10f09ad6920
2018-07-19 15:27:35 +00:00
drh
b657f28bf6
Allow the VACUUM following SQLITE_DBCONFIG_RESET_DATABASE to proceed even
...
if the write-version in the header indicates that the database file is not
writable.
FossilOrigin-Name: 3dca8b9d5ab1f35f17fc527d8f2a20b6bac989d1406c883d5b4d6719953ef6b4
2018-07-19 14:40:41 +00:00
dan
ea933f07b0
Experimental fix for resetting databases that have been deemed read-only due
...
to a corrupt "read-version" header field.
FossilOrigin-Name: e2394002d02754bb45d56e805df9bc5a2ef0d14e5d94262c1f8ab7643bc27c8f
2018-07-19 11:44:02 +00:00
drh
ea99a31c59
Add the SQLITE_FCNTL_DATA_VERSION file control
...
FossilOrigin-Name: a5087c5c87ad65f92e3bc96bbc84afb43faf10ab6b9ed3ba16304b5c60ad069f
2018-07-18 19:09:07 +00:00
drh
378a2da91e
Fix a harmless compiler warning in the pager. Enhance the docs for
...
sqlite3_changes() and sqlite3_total_changes() to refer to the data_version
pragma.
FossilOrigin-Name: 4c70ea5b0e2a512c6a46ac1f14397720e8c8556875701e78c30b19f850c24f55
2018-07-18 17:37:51 +00:00
dan
ac306682df
If an SQLITE_IOERR error is encountered as part of an atomic commit on an F2FS file-system, retry the commit in legacy journal mode.
...
FossilOrigin-Name: 2e0357c2ed30927921cd17129e348a18a6f3fd086d1fc0a42756036b321a084d
2018-07-17 14:01:55 +00:00
dan
4522c3e8d1
Fix for builds without SQLITE_ENABLE_BATCH_ATOMIC_WRITE.
...
FossilOrigin-Name: b10ec14ef7edcc5d7b0ad298c8230d1eca5508e8cf673fbbc97a0928b76c92fb
2018-07-17 13:55:08 +00:00
dan
e79522633a
Add new file doc/F2FS.txt, containing notes on the way SQLite uses the F2FS atomic commit feature.
...
FossilOrigin-Name: 59efb1bfaba12742379aae45c8c796ca539f089af9e553a3a55d6899a9c583c8
2018-07-16 20:44:00 +00:00
drh
7f32dc94a3
Minor simplification to sqlite3RollbackAll().
...
FossilOrigin-Name: 432fdc221550b3cca4140b1ae411da22201f689c30c72c5472dfdbc79bec9d90
2018-07-16 11:32:59 +00:00
dan
140a59874b
If an SQLITE_IOERR error is encountered as part of an atomic commit on an F2FS
...
file-system, retry the commit in legacy journal mode.
FossilOrigin-Name: 1c41250f67ac5de423b0426ef2ab8fe3303278a270225920033933ca9609592a
2018-07-14 20:25:13 +00:00
dan
2f69b5c5d0
Remove an unused function declaration from fts5.
...
FossilOrigin-Name: 148d9b61471a874a16a9ec9c9603da03cadb3a40662fb550af51cb36212426b1
2018-07-13 20:28:54 +00:00
dan
b80bb6ce88
Add the "categories" option to the unicode61 tokenizer in fts5.
...
FossilOrigin-Name: 80d2b9e635e3100f90cffdcffa5b5038da6fbbfccc9f5777c59a4ae760d4cb62
2018-07-13 19:52:43 +00:00
dan
e882551935
Add a test-control to disable the skip-scan optimization.
...
FossilOrigin-Name: 650a3fe03d61068e06f3097878a777ca8ed713a769444cdb3f8be7d1e19a0b83
2018-07-12 19:14:39 +00:00
dan
7490128240
Add a test case to check that SQLITE_DBCONFIG_RESET_DATABASE can be used with
...
wal mode databases even if there are active readers.
FossilOrigin-Name: 6145f5b3bacdee8f377892ac8b885941336c4cc543052f6373e21c1f99e1eca8
2018-07-12 11:28:42 +00:00
drh
222a384a06
On an UPSERT when the order of constraint checks is rearranged, make sure
...
that the affinity transformations on the inserted content occur before
any of the constraint checks. Fix for ticket [79cad5e4b2e219dd197242e9e5f4e].
FossilOrigin-Name: d120c45f3dc79f67afed0e44e5133569f784bc6792b15f5d79529deac2d13072
2018-07-11 13:34:24 +00:00
drh
9341916ed5
Adjustments to VdbeCoverage macros to deal with byte-code branches that
...
can never be taken in some directions.
FossilOrigin-Name: b170c0092b1d0c47dd700843f0c870e51181939607a897fbcae55a58042160f9
2018-07-11 03:27:52 +00:00
drh
5d6374fa39
Remove incorrect ALWAYS() macros from the window function logic.
...
FossilOrigin-Name: 94ac51cc4e7fdf484214e1936fc96104b96134632a8eb99558b3af743ac8bb8b
2018-07-10 23:31:17 +00:00
drh
c3649417fe
Add VdbeModuleComment()s on the three main code generators for window
...
functions.
FossilOrigin-Name: f7c239e959004cb90dc8537ab2e1fca5f26ef21f4f6f3dfd743a05a55e705090
2018-07-10 22:24:14 +00:00
drh
b0225bc52d
Minor comment changes. Add ALWAYS() macros on some unreachable branches
...
in the xStep() methods of built-in window functions.
FossilOrigin-Name: f2057542cf6860badb4ae6b1a0df94a78d5b2661dabf16f5705b3f8236521bea
2018-07-10 20:50:27 +00:00
drh
fef37760da
Identify Select objects within a single statement using small sequential
...
integers rather than "0x%p". This is more readable and yields the same result
on successive runs.
FossilOrigin-Name: a7cdc5bc85e0edfcc38f920c2ce91599bcbfdb49522d88b08c64596546d13881
2018-07-10 19:48:35 +00:00
dan
fd908888d3
Modify tests in window3.test to be tolerant of rounding errors when comparing
...
floating point values.
FossilOrigin-Name: 7c26c443e7f6455ca7f11f640e42285b42d95c9ae5f2e19e9c066d6d9cdcceb2
2018-07-10 18:50:01 +00:00
dan
b556f26145
Fix a problem with using scalar sub-selects in window function queries.
...
FossilOrigin-Name: 687fe532c274265ca77451f97829743fcb8a714d0f6b1ceb9a147ab9babdc5b5
2018-07-10 17:26:12 +00:00
drh
6ccbd2787b
Further improvements to bytecode branch testing. Fix cases where the
...
macros said a branch could not be taken when in fact it could be. Alter
some window function branch coverage macros to indicate that comparison
operands cannot be NULL.
FossilOrigin-Name: 76e42b7071a71137c0da4f10db4e653ae94a89b56e95cd3f036bff08c9500d08
2018-07-10 17:10:44 +00:00
drh
7083a487ad
Enhancements and improved documentation to the byte-code branch coverage
...
testing logic. Provide new macros that allow the code to specify that
some branch instructions can never take the NULL path and that the OP_Jump
opcode is only interested in equal/not-equal. The
SQLITE_TESTCTRL_VDBE_COVERAGE file control callback now works slightly
differently (it provides the callback with a bitmask of the branch action,
rather than an integer).
FossilOrigin-Name: cd2da7e1ba4e78e68ccf65d4969df963c1e3085930e74419450bda2799381e05
2018-07-10 16:04:04 +00:00
drh
eee0861155
Fix a harmless warning about comment formatting in the previous
...
check-in. Simplify the ORDER BY dereferencing logic so that it avoids
unreachable branches.
FossilOrigin-Name: 0f6ec605e131ab3d53b9df32af0a3207146a9abbd22dcabd6ef050b92f96735d
2018-07-10 07:39:23 +00:00
drh
38630ae1de
Assert that if two functions compare equal in every other way, then they
...
must both have OVER clauses, or neither has an OVER clause. Use this fact
to simplify expression comparison.
FossilOrigin-Name: 52559ad58ce412af40f1f34e80bfe9fadc6a93f3ca0cfaf69f94d615bbb99831
2018-07-10 07:25:42 +00:00
drh
6cbb4c936c
Enhance the sqlite3ExprCompare() routine so that it knows to compare the
...
OVER clause of window functions.
FossilOrigin-Name: 0a7649afebc9349bf44a0e3588e81ab595ea85be1c70de08859ea76a7b271f62
2018-07-10 06:47:07 +00:00
drh
a1fd4b520b
Enhance the TreeView mechanism so that it shows the window function
...
data structures as part of the abstract syntax tree.
FossilOrigin-Name: a2c0e1bec0d8a6f982572c4c5a8166319b8db0fe586057f7900f0ab72af6554e
2018-07-10 06:32:53 +00:00
drh
0b3b0dd1b1
New VDBE comments and coverage macros.
...
FossilOrigin-Name: a9a307265b0626b3e9df69534c8eacf18413ea31784c9d931eadcff515d3dd84
2018-07-10 05:11:03 +00:00
drh
c7bf57168a
Fixes for various harmless compiler warnings.
...
FossilOrigin-Name: 5023b1b85b883a716a5da673740b6effe214ee0490f4ca45f161bb8b04784366
2018-07-09 22:49:01 +00:00
drh
142066d4b0
Add a comment to restriction (6) of the push-down optimization. No changes
...
to code.
FossilOrigin-Name: 0c8a2f257fb71b2b053c4a2028db063e92dd9ff585a17fa22a70f9223fb11e75
2018-07-09 20:58:43 +00:00
drh
f710345303
Add an ALWAYS() around a branch in sqlite3BtreeSkipNext() that we believe
...
must always be true.
FossilOrigin-Name: 12be361a532df0c22a7e4d97658b82a69b1a205d4cca8d092b9e6b7790c1ee40
2018-07-09 20:41:39 +00:00
dan
77f3f40292
Avoid leaving view-definitions with an incomplete set of column names/types in
...
the in-memory schema if an OOM strikes while allocating the same.
FossilOrigin-Name: 1ddbb5372e7ea8407369b88698b3fb922b62dcac72be633a17bd0e41baa369f4
2018-07-09 18:55:44 +00:00
dan
e6fcd1d5de
Add a couple of OOM tests.
...
FossilOrigin-Name: 50de2a0d2d96b6b5b8de7ac6277d60859a8d9a56f6a792950734386bb9f10b79
2018-07-09 18:11:52 +00:00
drh
7999cc434e
Remove redundant branches in window function processing.
...
FossilOrigin-Name: 8fdaf3f37e5ddac9b7337a50f32f5d2bcdd64780797f08cfd3fccfa95819edfe
2018-07-09 17:33:24 +00:00
drh
a57aac262f
Simplification to the grammar rules for window functions. Fix a memory
...
leak that can follow an OOM while parsing a comma-separated list of
window definitions.
FossilOrigin-Name: a568f9c9db594f3b194c6e870305c9d6f2392ce6bc8ac00e9688883e97560fff
2018-07-09 16:24:00 +00:00
dan
a1a7e112fe
Throw an error if the second argument passed to nth_value() is not a positive
...
integer.
FossilOrigin-Name: 1a06e57a0b4279fa580c7ff4f152645f005794aaf86eeabf694637b7da11f763
2018-07-09 13:31:18 +00:00
dan
f5e8e31399
Fix a bad assert() in window.c.
...
FossilOrigin-Name: fe8aaf0c806413965f50a03e34b5fdfaaa8b09dc0af73f41e830f7b664bd1ced
2018-07-09 06:51:36 +00:00
drh
1e80ace47a
Simplification to the logic that detects misuse of the application-defined
...
function creation interfaces.
FossilOrigin-Name: 8f21d778450e1e5d2bc7f109d614fe018eb3d228b0bfc91cd3c6a5204415998f
2018-07-09 02:37:12 +00:00
drh
8ff21f47f0
During WITHOUT ROWID table creation, if the sqlite3CreateTable() call fails
...
due to an authorizer denying the INSERT into the sqlite_master table, then
detect this fact and abort the CREATE TABLE early, to avoid an assertion
fault.
FossilOrigin-Name: 164b1641e346994f0b9f91261c3cbc86b68e1c96cc401b78e48e186e26916abe
2018-07-09 02:02:09 +00:00
drh
19dc4d40e7
Identify specific FuncDef objects for window functions using the pointer to
...
the function name (FuncDef.zName) rather than the pointer to the xStep method.
This allows xStep method pointer to be replaced with a single noopStepFunc()
procedure, and thus save having lots of different no-op step functions.
FossilOrigin-Name: 410e13b0e0fb6e040808f076014d55ecf2b541c5439b4fd53c5bdcb8d800098e
2018-07-08 01:02:26 +00:00
drh
a546ef219e
Simplifications to the implementation of the sum() SQL function.
...
FossilOrigin-Name: a8b13002378fc4ef0b41c367b44b67bf2b28b6624303c087a3c6d657b5bfe32e
2018-07-07 20:55:16 +00:00
dan
51a6b19337
Fix another problem with reusing LSM cursors for range scans.
...
FossilOrigin-Name: ae3fc7652f27ba0a86f4c26f64c2e148d9496a5edb7f54dc9980edd91c326e4f
2018-07-07 20:26:30 +00:00
drh
491d4c89f5
Fix the JSON extension so that it can be compiled separately from the
...
amalgamation.
FossilOrigin-Name: 4b8cfe7bfe5f049eb4607fd480429fcd2060e691891d8bffc9917f13fa373988
2018-07-07 20:23:46 +00:00
dan
8f0c712a1f
Fix an LSM problem caused by using the same cursor for equality and range
...
scans.
FossilOrigin-Name: f05bead371d41ca5beef1f82e4c920c90e2eb9cd9fd537a5c91973bf9bd4eedb
2018-07-07 20:13:32 +00:00
drh
fd4b72853a
Add ALWAYS() macros on results of sqlite3_aggregate_context() calls in
...
xInverse() implements, since they can never fail.
FossilOrigin-Name: fdef2a921d451c66ca535021d08af3ec1ab53283da2d2979378a799fd8731ef9
2018-07-07 19:47:21 +00:00
drh
2c885d0575
Add an assert() to help verify that OP_AggInverse is never called on an
...
accumulator that has not previously been processed by OP_AggStep.
FossilOrigin-Name: 4213889103fa37f3f11802aea81989522048a0752820603dd556f612128ddfee
2018-07-07 19:36:04 +00:00
dan
a5ef149c4e
Add missing VdbeCoverage() macro to window.c.
...
FossilOrigin-Name: 63f4d306ba19f6ba900a7d7480ccaa3d1e4a204e7c82bf5eb2e4bd849ef3a22f
2018-07-07 17:38:49 +00:00
dan
d4fc49f735
Fix a problem with the handling of NULL values in the min() window function.
...
FossilOrigin-Name: b76f35b09235d44dc3d176377bbb9c18b7cdc9392800103ff53c54730a427a5c
2018-07-07 17:30:44 +00:00
drh
e4984a2bf4
Try to improve the error messages for misformed frame specifications in
...
window definitions.
FossilOrigin-Name: 927b95a0812787bcb3c28d1a0ea94717dc2cc60f6d480623f0c7cbce0c546fc9
2018-07-06 17:19:20 +00:00
dan
bfead59b3b
Also disallow non-constant expressions in "<expr> PRECEDING" or "<expr>
...
FOLLOWING" clauses.
FossilOrigin-Name: a6dffecc6b35c618cc5e5a06892765bdbec587dcd0ae8686c231a21516e38eab
2018-07-06 14:31:26 +00:00
dan
5d764ac9e6
Ensure an error is returned if the user specifies an unsupported frame type.
...
FossilOrigin-Name: 0f3f8fcde1a535bcf93e23a68d2411c21785d8c0cac1f9481a06e7225755cdbc
2018-07-06 14:15:49 +00:00
dan
287fa17b78
Prevent "UNBOUNDED FOLLOWING" from being used as the starting boundary of a
...
window-frame. And "UNBOUNDED PRECEDING" from being used as the ending
boundary.
FossilOrigin-Name: e51fdf66a24c27ba6491391fffcc88fc5ca2ae79cfc4ab769a149b19c394e308
2018-07-06 13:48:09 +00:00
dan
cf0343b699
Remove some bad assert() statements from the implementations of window
...
functions percent_rank() and cume_dist().
FossilOrigin-Name: 443f0c286f1659937fd61b4ef2de17d0d015369e5ff5249a9e0c3d0ee4925158
2018-07-06 13:25:02 +00:00
dan
e33f6e7c91
Return an error if DISTINCT is used with a window-function (.i.e.
...
"count(DISTINCT <expr>) OVER (...)".
FossilOrigin-Name: d59bcc8eea4fcf0ee3c2263d31ee42f9f26c28434d2f0045f2d3329f18791d1c
2018-07-06 07:42:42 +00:00
drh
8f26da6c5b
Use separate opcodes, OP_AggValue and OP_AggInverse, for the new callbacks
...
associated with Window Functions, for improved readability of EXPLAIN
output.
FossilOrigin-Name: fa6538050938ffeb042fbee31512514d6d3ace514b2a3dfd8365bbeb13f35a78
2018-07-05 21:22:57 +00:00
dan
6ea9a7282a
Update the recipe for resetting a database using
...
SQLITE_DBCONFIG_RESET_DATABASE.
FossilOrigin-Name: c43dd23fb00f7e0b6274de435d8e31f6a4cb74c3e86e8313a5098ff089e27574
2018-07-05 20:33:06 +00:00
drh
8be47a7e86
Get the json_group_array() and json_group_object() SQL functions working
...
as window functions.
FossilOrigin-Name: 916cdc83f5a45e0b6f61c52ff5fde70d54bcd0dfaa4a32f9ac709fe0ddbb480b
2018-07-05 20:05:29 +00:00
dan
7a606e1ab2
Return an error if a "RANGE" window-frame uses "<expr> PRECEDING" or "<expr>
...
FOLLOWING".
FossilOrigin-Name: 786c87ba4150509e141baab32c51e64bbd3ce323735e0f47d65ed54d14215bc4
2018-07-05 18:34:53 +00:00
dan
683b0fffee
Fix a problem in the xInverse method of window-function group_concat(1).
...
FossilOrigin-Name: 73391283101288251fe5d030ba12bcdabe8a781d41086afe3564c58c05d0fd5c
2018-07-05 18:19:29 +00:00
drh
f213b33c37
Fix the .dump command in the command-line shell so that it does not show
...
extraneous SELECT statements when ".echo on" is enabled.
FossilOrigin-Name: 11763cac33fa809bcf0294d1a381394fcf860b020b51fff81217ee709ba99272
2018-07-05 17:35:46 +00:00
dan
8bf6d705f3
In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that
...
upgrades from no transaction directly to a write transaction) hits an
SQLITE_BUSY_SNAPSHOT error, change the error code to SQLITE_BUSY to indicate
to the caller that the condition may be transient.
FossilOrigin-Name: e6108047cb136119d8ed19af010a669ed9750b4e7f991ccabc9e3d15774eda31
2018-07-05 17:16:55 +00:00
dan
b775104357
Fix a typo inside an assert() statement introduced by the previous commit.
...
FossilOrigin-Name: e3357728472d5e57db6d7eef0ce008bdee071b5b07b60e242f383440eebe85bd
2018-07-05 17:03:43 +00:00
dan
b07db116e7
In wal mode, if a "BEGIN EXCLUSIVE" command (or any other command that
...
upgrades from no transaction directly to a write transaction) hits an
SQLITE_BUSY_SNAPSHOT error, change the error code to SQLITE_BUSY to indicate
to the caller that the condition may be transient.
FossilOrigin-Name: 221ff63e7902226ebf728bb7442727420636831163708f360724506ce9487ab6
2018-07-05 15:46:55 +00:00
dan
7fee0bfad2
Test that a race condition can cause a "BEGIN EXCLUSIVE" to return
...
SQLITE_BUSY_SNAPSHOT in wal mode.
FossilOrigin-Name: 5a12db75d1da65daa92413a6b5892309e9d9479bb3610764e1015abe5bf28dbe
2018-07-03 20:17:27 +00:00
dan
d736829e8b
Fix a problem in the xInverse callback for the built-in sum() window function.
...
FossilOrigin-Name: b6563647382634588ebe5c6a3c35c65a321dc1b3732c809d48ce46759b9dd80f
2018-07-02 17:45:59 +00:00
dan
f607bec749
Fix a segfault caused by having identical window functions in the select-list
...
and ORDER BY clause of a SELECT statement.
FossilOrigin-Name: 693b4350d741391226a33ab6a05eaad61e8ef1590176f01e8aed2a212e2d6419
2018-07-02 17:14:37 +00:00
dan
6b4b88208e
Fix a crash caused by a LIKE pattern that consists of a single escape
...
character.
FossilOrigin-Name: bb9bfc3a12dfb89b1c58f5551cdc89ab7b0fbe03f285f2ed86611786ed02ffd9
2018-07-02 15:03:50 +00:00
dan
7262ca94cb
Fix a segfault caused by invoking a regular aggregate as a window-function.
...
And some problems with count(*) when used as a window-function.
FossilOrigin-Name: 4f3c8a82fd1c5b14d84f2301e34cfc8d52fe4b3a60840c39e895c11f2da529d9
2018-07-02 12:07:32 +00:00
drh
9f607e9c23
Quick patch to the Lemon parser template to avoid an array overread reported
...
by OSSFuzz. A proper fix involves enhancements to the table generators in
Lemon to make the overread impossible. That fix will take longer to
implement. The current check-in is a stop-gap.
FossilOrigin-Name: 3f6730be4cb712a28401be6d96e56ccb3f2e98dd8961b477befec3f363715178
2018-07-01 16:05:40 +00:00
dan
d2ac43ea38
Avoid a warning in fts5.c due to not using generated routine
...
sqlite3Fts5ParserFallback().
FossilOrigin-Name: 65ff5144a55f1ba2b2ef812a0c988fa2522441177038b8d686eb1d0c558c75d5
2018-06-30 20:26:52 +00:00
dan
9592320b91
Merge implementation of SQL window functions from the exp-window-functions
...
into trunk.
FossilOrigin-Name: 17198a1206e2fbc9e555881468e8c6980b00e25b5b78a6798a6264ca7384f1ca
2018-06-30 20:15:58 +00:00
dan
2b5f152601
Fix a minor problem in the code for determining whether or not an SQL
...
statement is SQLITE_TOOBIG.
FossilOrigin-Name: 763e6c9e2bbc0a6ef8d8361069bf7160790c9064f24f0e336b7ed85668735da9
2018-06-30 20:00:35 +00:00
dan
5001b3314d
Merge all changes from the weak-fallback branch except those related to the
...
weak-fallback feature itself.
FossilOrigin-Name: aad718fb1afacf1c921966796ab1e149207c31b16409c5672f0371f4fb9d6565
2018-06-30 19:12:36 +00:00
dan
6e2210e0a1
Have the tokenizer handle fallback for tokens "OVER" and "FILTER" in the same
...
way as it does for "WINDOW".
FossilOrigin-Name: 12d819e1c17d8036900352b0989c4bfcbc34193c3735bb9af7ab051f0f129d3d
2018-06-30 18:54:56 +00:00
dan
34a7d790ba
Further performance related tweaks for sqlite3RunParser().
...
FossilOrigin-Name: 5eb4776598f5bba7ef21a2c58c03105544da73d642d7ffc146f84eff1993d71e
2018-06-29 20:43:33 +00:00
dan
d437ac0c58
Further tweaks to sqlite3RunParser().
...
FossilOrigin-Name: eef61ffab7fa36b126f57bf7028dd35c67ed4617c47145be059f91e58023b0a4
2018-06-29 20:21:24 +00:00
dan
769309fcf3
Improve on the previous checkin. Still a bit slow.
...
FossilOrigin-Name: c1fb41aa7b7207b81ee1d5d32da3380b36d694033b87a2873981e0c6437ba956
2018-06-29 19:54:51 +00:00
dan
59ff42516c
Instead of using a lemon %fallback directive, have the tokenizer try to figure
...
out whether an instance of "WINDOW" should be TK_WINDOW or TK_ID.
FossilOrigin-Name: 022079cb0d67be5ac0a50dd9a4d41ee55ce8df681ecd0a544170d75fc8649978
2018-06-29 17:44:52 +00:00
dan
04a8e0cd54
Modifications to parse.y to better support backwards compatibility for the
...
"window" keyword.
FossilOrigin-Name: 7c4b879bdb10f30260f0fb28fcb559ab0949865d10f4ff2cf13834a326198998
2018-06-28 20:05:04 +00:00
drh
3773c25f16
Introduce the concept of "weak fallback" in the parser. A weak fallback
...
only occurs if a syntax error would result otherwise.
FossilOrigin-Name: c41d7079fb63831bd2f009b64cbf5a423e8119e6b841bfd9bd5a2d85fba3b142
2018-06-28 03:38:49 +00:00
dan
01e1229063
Add missing VdbeCoverage() and VdbeCoverageNeverTaken() macros to window.c.
...
FossilOrigin-Name: 4383cb68a1241768ddb3f180f8cbb9ea1638f8806210b10aac1384b8a7ecdca2
2018-06-27 20:24:59 +00:00
dan
f02cdd379a
Avoid redundant ORDER BY operations when rewriting SELECT statements that
...
contain window functions.
FossilOrigin-Name: 336de43a47e206fe7629072e5b8c80d4ede17ead8ef4dcf5d8da6833ff22d2f9
2018-06-27 19:48:50 +00:00