Commit Graph

7494 Commits

Author SHA1 Message Date
dan
b28c4e564a Minor tweak to patch on this branch to reclaim some cycles.
FossilOrigin-Name: 81eed055de856068109a7e332cca0c3ff1120ebe2bfa5ed6383b165c726e0a7c
2019-07-05 17:38:55 +00:00
dan
16e12c573d Add tests for the FILTER clause. And a bugfix.
FossilOrigin-Name: 28aa1702f7f0334abd1b30e7aa48ea3679539b11bfbba32bc9f0d6049cf18a7b
2019-07-03 18:31:20 +00:00
dan
6ba7ab0d25 Experimental implementation of FILTER clause for aggregate functions.
FossilOrigin-Name: 1f1ae2d6ac8dcbb62e5aa3dc17bc67d559cb565fc0d0a8c00a596075d35f8130
2019-07-02 11:56:47 +00:00
drh
00a6153faf Use the OP_Sequence opcode for generating unique rowid values for an
autoindex on a co-routine implementation of a subquery.

FossilOrigin-Name: eab4297577e4d325fed4757867fc77860de7448998d86f098c8a50272e17d35e
2019-06-28 07:08:13 +00:00
dan
855b5d144a Ensure that when an ephemeral cursor is reopened with a second invocation of to OP_OpenEphemeral, the sequence counter is reset and the cache marked as stale. Fix for [9cdc5c46].
FossilOrigin-Name: 5fd20e09a522b62a529cf4d76fbdf0a09426f67ffa30430cac6b81ebf32ba43e
2019-06-26 21:04:30 +00:00
dan
fe9a832e80 Fix a problem with handling with handling quoted path elements in extension functions json_set() and json_insert() reported on the mailing list.
FossilOrigin-Name: 45bfcb88e71451a656982e217375e257fc8e68374349c2984be1266bf86fb8cf
2019-06-17 14:50:33 +00:00
dan
069d1b1faf Avoid transforming TK_COLLATE or TK_UNLIKELY Expr nodes to TK_REFERENCE. Instead, transform the uppermost Expr node in the expression tree that is not of this type.
FossilOrigin-Name: ba7870e292919cf6c2f4b65b63fb0420ba2718eb0a797e0ba5302eec551a4238
2019-06-16 08:58:14 +00:00
dan
44c99ecf9c Add extra test case for one of the problems fixed by the previous commit.
FossilOrigin-Name: 0bbceebb126c94b5159079a341fa16e8424b7f2f6b9364561516964e871fb6e0
2019-06-15 15:27:37 +00:00
drh
bdf4cf0b90 Ensure that sqlite3RenameExprUnmap() does an unmap of the result set alias
names in subqueries when ALTER TABLE fails because of a syntax error in a
trigger.

FossilOrigin-Name: d3b6f1665f6fb5fc5cf1c0864d779d0b24746ada530f755c7b6ff34766bd2188
2019-06-15 15:21:49 +00:00
drh
821afa44c1 Fix the implementation of the built-in RTRIM collating sequence so that
it works for control characters at the end of the string.
Ticket [f1580ba1b574e9e9]

FossilOrigin-Name: 86fa0087cd1f5c79ed51b99a226ec2eef5b0fa0a23981d469bec0e02fadf2a68
2019-06-14 13:24:46 +00:00
drh
060b7fa974 Refactor the LIKE optimization decision logic so that it uses
sqlite3AtoF() on both boundary keys to determine if the optimization can be
used when the LHS is something that might not have TEXT affinity.
Ticket [ce8717f0885af975].  See also [c94369cae9b561b1],
[b043a54c3de54b28], [fd76310a5e843e07], and [158290c0abafde67].

FossilOrigin-Name: b4a9e09e60213ccff925d09f0b6e549e2a3e3862856c710f108779e2867dec76
2019-06-14 12:28:21 +00:00
drh
4245e0456d Fix a minor error in a test script, and harmless compiler warnings in the CLI code.
FossilOrigin-Name: eaa34626e497d3af132dd8f13eddbbda89365d369ed43212a5f788175b3d6198
2019-06-13 13:52:46 +00:00
drh
0ce974d122 Adjust requirements marks and add new requirements tests.
FossilOrigin-Name: ebb81dad1f43dac4636cd44d4055d1d4b198c675f73e23c5a2d8d992ae27fe1f
2019-06-12 22:46:04 +00:00
drh
13d0402077 As a special case, casting '-0.0' into numeric should yield 0.
Fix for ticket [674385aeba91c774].

FossilOrigin-Name: 491f0f9bbddb6302536d99abd1ea481fd747ddcf6c6eaaacc0338d147b119081
2019-06-12 20:51:38 +00:00
dan
6ece353f2d Handle expressions like "expr IS TRUE COLLATE xyz" in the same way as "expr IS TRUE". Fix for [4d01eda8115b10d1].
FossilOrigin-Name: 5c6146b56a75a94f4baa10e95407c54dd0b9314a57a8702a4b96b15c4d7ac48c
2019-06-12 13:49:32 +00:00
drh
a7d6db6ac0 The affinity of the unlikely() function and its cousins should be "none".
Ticket [0c620df60bffd9ef]

FossilOrigin-Name: 614ecb0af47038848e8ba2aed6b92db6f33ddc4aea6361795dbde440380f5a35
2019-06-11 21:02:15 +00:00
drh
42be2ad30b Make sure the affinity of the RHS of an IN operator does not affect the
outcome even if the RHS expression contains a COLLATE clause.
Ticket [57353f8243c637c0]

FossilOrigin-Name: 0f748fe58bbbb7ce3f30303da25ec811b2bbce249549aa9c7927979ac5b38013
2019-06-11 18:07:53 +00:00
drh
66cc2ca83a New test case in fuzzdata8.db.
FossilOrigin-Name: e96641f0be7d4454215459b0a95cf1c46ba0133e46d0bae22269741c8f4e5b44
2019-06-11 16:07:39 +00:00
dan
0b277a980a Have the ALTER TABLE code handle the case where an entire expression that includes a sub-select is excluded from a view, trigger or index.
FossilOrigin-Name: f2c8179f3c0b77f10da3f9b0771db4dec30d0bbf0b7f4751ce439bfb08da8f6f
2019-06-11 12:03:10 +00:00
drh
8e34e4061b Add the new sqlite3ExprUnmapAndDelete() function and use it in place of
separate calls to sqlite3RenameExprUnmap() and sqlite3ExprDelete().

FossilOrigin-Name: 36ea13e0a851a749c9ef292377ecd82dbd4797d38df907b362487fa234c98ca5
2019-06-11 10:43:56 +00:00
drh
b854b76733 The ALTER TABLE command should not attempt to rename objects that are
contained within an expression tree that has been optimized out because
it is the other branch of an "AND false" expression.
Ticket [533010b8cacebe82]

FossilOrigin-Name: 04bd5cb73287f926f1ecf578998fa6ce1379474e86918c692eae5778d0817cef
2019-06-11 02:43:22 +00:00
drh
a753d40039 Fix repeated test numbers in the altertab2.test file.
FossilOrigin-Name: e82f235e7201a420149847cda630ac6f2fce5e3a4577b0ea4793f430d3dc1611
2019-06-11 01:56:42 +00:00
drh
378a7d356b A string consisting of a single '.' is not a floating point literal with extra
text at the end.  Fix for ticket [412bba9b22c677da]

FossilOrigin-Name: 57050162294efec90caa5cc3c2f8c1a85215526adcf57b284ce2d2e799286b78
2019-06-10 23:45:10 +00:00
dan
e4a9e4d0e5 Have ALTER TABLE commands ignore the lhs of "expr IN ()" and "expr NOT IN ()" expressions, just as other queries do. Fix for [533010b8ca].
FossilOrigin-Name: 71643deb6bbad4b4a511bfd43b32245b50a555b508b90f33adf0656ae53292c6
2019-06-10 19:17:37 +00:00
drh
c285ded26c Make sure a CAST to "NUMERIC" results in an integer if the value can be
losslessly expressed as an integer, as the documentation requires.
Ticket [dd6bffbfb6e61db9].

FossilOrigin-Name: c0c90961b4fa1c1185772d04fe1915bc1a1af27ed8ddb8db1c524bf90d68ccbf
2019-06-10 18:33:16 +00:00
dan
e20a894a34 Handle renaming a column or table when the schema contains a (meaningless) index on the constant expression ('text' IN ()) or ('text' NOT IN()).
FossilOrigin-Name: 567b13093956185b5d5e971b81ba4788fd9d26c03688f643b380f0f1c1a94da0
2019-06-10 15:34:16 +00:00
dan
32d0f64e8d Do not attempt the LIKE optimization on a column with numeric affinity if the rhs of the operator begins with whitespace. Fix for ticket [fd76310a5e].
FossilOrigin-Name: 94b58ab059cba9771e75f16d1460f313104a8fb879f9f8805725d362aa58cbcd
2019-06-10 13:46:42 +00:00
drh
9a2782293c When casting string values into numeric and the string has a prefix that looks
like a number but total string is not a well-formed number, then take extra
care that the result is either integer or real depending on what the prefix
looks like.  Fix for tickets [e8bedb2a184001] and [4c2d7639f076aa].

FossilOrigin-Name: 67a68af5578f08d2be2e48cf4fd12a6cf35a09c47d259deda81950f7ee1f02f7
2019-06-07 22:26:08 +00:00
dan
48646e497b Add a test case for the unix SQLITE_FCNTL_CHUNK_SIZE file-control.
FossilOrigin-Name: 3a477fd0c944440be03d23c667053b346c769c6a4f6ba1ef094b7581a08d7bd4
2019-06-05 13:14:19 +00:00
drh
9b2ec0efa1 New dbsqlfuzz test cases add to test/fuzzdata8.db.
FossilOrigin-Name: 873aa46da3d0f97784cad94828fc367bb2ceb13d5ece2e105320f404b3971c85
2019-06-04 15:47:37 +00:00
dan
471e88f732 Fix a segfault in fts3 that could occur when processing corrupt fts records.
FossilOrigin-Name: dff24c6c7a4e7623984b5bb24c2ff14fe079dc49a0ad048cbfc66f84c08875b0
2019-06-04 13:11:37 +00:00
drh
7cd5e856e5 Fix the query flattener optimization so that it preserve the "SF_Compound"
bit when flattening a compound subquery into a non-compound outer query.
Failure to preserve that bit could allow subsequent flattenings which are
not valid. Fix for ticket [c41afac34f15781fe09cd].

FossilOrigin-Name: 523b42371122d9e1b3185425745f1490138bff7f7cc941ee26ee81df7ade5bf4
2019-05-29 17:22:38 +00:00
dan
efdb371a1d Fix an assert() in fts3 that could fail when processing corrupt records. Also some minor sanitizer warnings.
FossilOrigin-Name: c736c40aab071a69bd5c5347b7c116d87ea3954019e967ca8ff7bdb4b518e5bf
2019-05-28 14:42:32 +00:00
drh
ef7d5187a7 Improved rounding even on systems with an 8-byte "long double" type.
FossilOrigin-Name: 15202aee150fa8e15fb90e90e5765c5e19a1eaf4896da2996a747636b76da8e6
2019-05-27 00:29:15 +00:00
drh
4413265d4e Add new cases to speedtest1 for measuring performance of binary to/from decimal
conversions of floating point values.

FossilOrigin-Name: b84e7057c05338347b4267f7ccc1d7b9b6d4e9a941ce8b76bf2c27c26772000c
2019-05-25 13:14:19 +00:00
drh
aa81cae485 Disable the new rounding tests on systems without long double support.
FossilOrigin-Name: ed250b4e18ea042d681bbe8d7ed00895564f4525c22928a003a84585b4756ec3
2019-05-25 00:17:26 +00:00
drh
a0ed86bc37 Improvements to rounding behavior in the round() and printf() functions.
FossilOrigin-Name: 641b2d210541b4d5a1a9e57d7dcf5ce5dfd7ff4d2dc6277ba0582869f48fc946
2019-05-24 22:58:16 +00:00
dan
c542fa8573 Add test cases for the fix in the previous commit.
FossilOrigin-Name: c1057b2a60add08e5c80ef2a53932a690b096f2eb03c7de863844deaa8fc9d53
2019-05-23 16:40:45 +00:00
drh
53e8709b75 New test case for check-in [74ef97bf51dd531a] that takes the fix in the
previous check-in into account.

FossilOrigin-Name: cb1d06521de5918a2324a41e207b48c5e5149c23b927b9e3e1f3c3b38b82658e
2019-05-22 23:12:10 +00:00
drh
59145813d2 Renumber the Select.selId values in the copies of SELECT statements that
implement VIEWs when the VIEW is expanded, so that when the same VIEW is
used twice in the same join, each expansion as a distinct selId.
This fixes ticket [ce823231949d3abf42453c8].

FossilOrigin-Name: 3cacc4b940fd69776d930deec9512df47a2f22cb04fb955e354a0b25bdec287c
2019-05-22 22:49:23 +00:00
drh
90c21df233 New dbsqlfuzz find added to test/fuzzdata8.db.
FossilOrigin-Name: 42af7c819bc52ccb6953a58b1c05d3bd47cc438c5119a9555b1b796764eb9f20
2019-05-22 14:35:10 +00:00
dan
29fa6b6642 Fix a buffer overread that could in fts3 when dealing with corrupt records.
FossilOrigin-Name: 1660d7733eb443ab085ddef7666b998a1c75ac81cc54a9620960a8d3b377e28e
2019-05-22 14:22:44 +00:00
dan
7ed6c068f5 Fix a problem in [b5ca442a] causing an assert() to fail in REINDEX commands.
FossilOrigin-Name: a3e77c7776ab01dadb9d30d6067ac97e9d4b09ec54834558a5fa1ffed7b52c72
2019-05-21 16:32:41 +00:00
dan
ef14abbf8d Use a statement journal for all CREATE INDEX statements in case an indexed exprsesion throws an exception when it is evaluated. Fix for [b5ca442a].
FossilOrigin-Name: b8071d10cba8f6c19fb8d5df3877f72567dc6d6a94744a39cbc1f58b2e2f343b
2019-05-21 14:42:24 +00:00
dan
0d92571d65 Disallow string constants enclosed in double-quotes within new CREATE TABLE and CREATE INDEX statements. It is still possible to enclose column names in double-quotes, and existing database schemas that use double-quotes for strings can still be loaded. This addresses ticket [9b78184b].
FossilOrigin-Name: 1685610ef8e0dc9218b02461ceab14dc6114f4f5ef7fcda0da395094aff443e1
2019-05-20 17:14:25 +00:00
dan
8ac02a94ab Update the sqlite3ExprCompare() routine so that it does not think "? IS NOT TRUE" is the same as "? IS TRUE". Fix for [d3e7f2ba5b3].
FossilOrigin-Name: 99eba69b3a64741c69d167bf7a05dbe138c9e7faecc54a1b8d8220cb23902830
2019-05-20 10:36:15 +00:00
dan
7ac0e562a3 Fix an assert() failure that could occur in a join query if the RHS of an IN() operator is a list containing correlated expressions. This problem was introduced by checkin [e130319317e7611938] which was part of the fix for ticket [787fa716be3a7f650c] - so this commit is part of that ticket's fix too.
FossilOrigin-Name: 778b1224a318d0137c7dab8361128f593506d3677267898119b934b4d66dfe38
2019-05-18 21:22:25 +00:00
dan
4db4b5b4fe Avoid including the comment in the output of "PRAGMA table_info" in situations where there is a comment following a DEFAULT value within a CREATE TABLE statement.
FossilOrigin-Name: d91095ba7130e974f0c95334760c679a31479b07a3d458e15994a24eee474752
2019-05-18 19:49:08 +00:00
drh
6c35b3065c Disable PRAGMA journal_mode=OFF when SQLITE_DBCONFIG_DEFENSIVE is turned on.
Ticket [f4ec250930342e0c].

FossilOrigin-Name: a0f5eb5c79cc33b7224f3421d2baa02a2a19eb9d6eaa8117dda4a1878b229cb5
2019-05-17 20:37:17 +00:00
dan
be81262400 Always store a REAL value in a column with REAL affinity if the integer equivalent would require 8 bytes of storage. Fix for [3c27b97e3].
FossilOrigin-Name: 14c00b1016ba53ab2dc177c59a27b6b9209202973685f0f274112d296ba7dfcb
2019-05-17 15:59:11 +00:00