Commit Graph

23332 Commits

Author SHA1 Message Date
dan
f159323c42 Add test cases to rtreedoc.test.
FossilOrigin-Name: afe0ec4d589d87a07c0daf3fc4de884b82a8bceed593ba4e44caa1cf033a6715
2021-09-14 20:07:58 +00:00
drh
c0bd26a23a Update requirements marks to reflect recent documentation changes.
FossilOrigin-Name: 08cab8921e670a0d1758b505fe8c7455f6194cec69d1b7b77de91688be1028a6
2021-09-14 18:57:30 +00:00
dan
a2fef2f031 Add test cases to rtreedoc.test.
FossilOrigin-Name: b62de1269f17fcc944ff404a20c4f705ffe99c44d6c54f42c29e69753aac8092
2021-09-14 14:16:36 +00:00
dan
6962d78c4d Minor updates to rtreedoc.test.
FossilOrigin-Name: b22c75e41ded29afd026b32b73b87f6427340a9ac1d46147db8edac20eb7beb5
2021-09-14 11:27:20 +00:00
larrybr
d000785d40 Shell to .read any named character source file/device (again.)
FossilOrigin-Name: c6fe4f8d639db25f0a339f4071f0ae34b90dcfec8dcc2c571f969e2614a38e05
2021-09-13 23:11:46 +00:00
dan
db45212a35 Add test cases to rtreedoc.test.
FossilOrigin-Name: 4ee99d315487a3aa09911191a74c6a12693784c5359243eb1396d8868566e80a
2021-09-13 18:32:02 +00:00
drh
82456a661d Add assert() statements to refute
[forum:/forumpost/9f4e7f58fbb66ddd|forum post 9f4e7f58fbb66ddd].

FossilOrigin-Name: 83a83475c5064ea62016a03e9173ecd2a1fec7f6296f1ee99896fa0a38b4196a
2021-09-13 18:16:15 +00:00
dan
30918bfb0b Add new test file rtreedoc.test.
FossilOrigin-Name: 8c4b1482eeb31856bce20eda1ce74959e19da11962f74d406a608747a92fe429
2021-09-13 16:36:20 +00:00
drh
57dd7e6ad8 Fix an incorrect comment and possible integer overflow in pager
resulting from check-in [23ca23894af352ea].  Problem reported by
[forum:/forumpost/e2ea1a3f61|forum post e2ea1a3f61].  Also change
the datatype of Pager.pageSize to i64 even though page size never
exceeds 65536, in order to help prevent future problems of this kind.

FossilOrigin-Name: f4a552ed9f4ab35520b634954c39748cc7bda535f426280b79da1b99f70599ac
2021-09-13 13:53:13 +00:00
larrybr
8d463ce135 CLI prescanner made to match SQLite's rules for delimited identifiers. Tests begun.
FossilOrigin-Name: 15b105c520968855ad960d8929f80af9e9bedc155237af9af1956f7b546947f2
2021-09-11 02:42:04 +00:00
larrybr
31aa366293 Make replace.tcl useful with TCL 8.4
FossilOrigin-Name: 2dd61dd97b0326b59b0bc3c83b4d4b9acf811c5acae4d1003e7525ba7a26daf5
2021-09-10 22:00:43 +00:00
larrybr
a96bbe9af6 Make CLI prescan handle goofy identifier delimiters too. Streamline code.
FossilOrigin-Name: 968aed690ba7240f8a256f5ba679cc971f432ff9af0ff99744824af79b952545
2021-09-10 19:45:22 +00:00
larrybr
3a9793e40f Fix (luckily harmless) typo in memdb.c per https://sqlite.org/forum/forumpost/15af8872d5999df1
FossilOrigin-Name: d577030cdad165474b082afbe64782e2eb3290331b0e3045b1e85ee6fe011504
2021-09-10 18:35:59 +00:00
larrybr
ae509121d0 When showHeader set at CLI invocation, do not auto-set it later.
FossilOrigin-Name: 733b7d4f95a4e2f0df323974f323c40c2486b188d442e74306a4b580fd8a8bd8
2021-09-10 01:45:20 +00:00
drh
7f58117921 Back out changes [00286ca5d998d802] and [6844ede29e1dac93] (replacing the
associated branches with NEVER()) and add a single new test to
btreeOverwriteCell() that detects when an overflow pages is also mapped
into a b-tree page and raises and immediate SQLITE_CORRUPT error before
making any changes.
dbsqlfuzz 81791bd980fe6935ff2c7334ec8bef11c1c12b82 and others.

FossilOrigin-Name: 32210fa4ac4f06e1705ef808731c7be040a23f9a8630986440100c5d4e76dc07
2021-09-10 01:02:42 +00:00
larrybr
8bc4cbce6b Speed-up CLI's processing for huge block comments, for any content
FossilOrigin-Name: c4568f9f458bad16bd4481f1f6f5e7b6f39f5ccf23f2b05890078577ce2ab9a2
2021-09-10 00:58:46 +00:00
drh
3acb3b7845 Remove a NEVER() in btree that is sometimes reachable.
dbsqlfuzz b9140023005430654c8fe544cf0a082ef8d561c1.

FossilOrigin-Name: 6844ede29e1dac93a392dfb1e7e676bb9d0a2e7bbec0a4a5804ffc2025a99b66
2021-09-09 19:19:02 +00:00
drh
4c5b7b922c Avoid masking off an OOM fault in rtreecheck().
FossilOrigin-Name: 3ebfe7128a20b270de65ebf4620f62e34ea6cc46b472cc52aed96af504eb9637
2021-09-09 18:06:07 +00:00
drh
30ad4a6932 Improved database corruption detection in the editPage() subroutine
of the btree rebalancer.
dbsqlfuzz f035b1b5a100a5f0cffb95c958b6c67d7c5eaf1f.

FossilOrigin-Name: 00286ca5d998d80214d5e8d501a3b305f432cda1c0ef67ca530e1219565909b7
2021-09-09 14:03:55 +00:00
larrybr
31bffb44fa Speedup CLI's gulping of many huge block SQL comments.
FossilOrigin-Name: 729620c5c0c642243be2fdda98f18d04efaf78ce365092e655cf60c9fee0874f
2021-09-08 21:49:03 +00:00
drh
94b70d8343 Fix PRAGMA integrity_check so that it does not try to enforce types on
ANY columns in a STRICT table.

FossilOrigin-Name: 57384fda8db43964871be5e48ae1c72c67533046b523f161d60a41fdc8e96b9e
2021-09-08 19:25:21 +00:00
larrybr
2c09a8ad6f For sqldiff, sqlite_schema comparisons must use compound (synthesized) PK.
FossilOrigin-Name: 5bdd8466129b8e477c8349847f19f2a5adea3f650cca6dbafa3b835e5a538d09
2021-09-07 20:58:49 +00:00
drh
59bccb2637 New test cases added to fuzzdata8.db. No code changes.
FossilOrigin-Name: 51e5aadafe1a4ba6a0be7fc1732d1ec940cbc5e23723b76267c2abf887d713ac
2021-09-07 19:23:32 +00:00
larrybr
a933ec4c25 Make sqldiff able to compare sqlite_schema tables (for detailed schema differences.)
FossilOrigin-Name: 7ff92da9f183bc24a0d93996df771df7a712df1122ad897cb9143cde7d57ef7d
2021-09-07 19:04:42 +00:00
dan
eb84c6ef35 Fix a memory leak in fts5 that could occur when writing to an fts5 table that is being scanned by an fts5vocab cursor.
FossilOrigin-Name: 1183552de10b64a776874a23be8962c0693e5e0cd1a191ea8fa5d6a02b691e4a
2021-09-07 16:05:48 +00:00
drh
eb61630b40 Fix a potential NULL pointer deference in the LIKE optimization. The
problem was introduced by the addition of generated columns
in check-in [b855acf1831943b3] (SQLite version 3.31.0, 2020-01-22).
Reported by Wang Ke in
[forum/forumpost/699b44b3ee|forum post 699b44b3ee].

FossilOrigin-Name: b9417d400f4585004f434837022709f818044d5844fe208fe01595a6b226ef7d
2021-09-07 15:41:25 +00:00
dan
fb8ca7de0c Fix a use-after-free error that could occur if an fts5 table is written while scanning it using an fts5vocab cursor.
FossilOrigin-Name: e751c2ec786b5c1a1c9640fdc3fde036879a2c32db2bd67fe7c72604780f67b8
2021-09-06 16:15:23 +00:00
drh
905b82d5f5 Fix an issue in the "shrink.test" test script reported by
[forum:/forumpost/90a74bd61861f58f|forum post 90a74bd618].

FossilOrigin-Name: 6c3734edb2ecabd85a715c853ef58da39381af26d3dd32e53c068b4fcf6fb98f
2021-09-06 15:59:32 +00:00
drh
e534c7b97f Restore the use of system isnan() that was removed by
check-in [ea748edecb261f2b].  See
[forum:/forumpost/d7c530ac587f59e6|forum thread d7c530ac587f59e6].

FossilOrigin-Name: b3cfe23bec0b95ca673802526704200e2396df715fdded72aa71addd7f47e0e1
2021-09-06 11:44:19 +00:00
drh
e7e9539d99 Fix an assertion fault in pcache introduced by [4bc93658aa563f2f] and
detected by OSSFuzz.  Test case in TH3.

FossilOrigin-Name: 2262a49467fa56c386080dac3e99a66e16c1700e138dba74db66e7b93ae76bf5
2021-09-03 18:11:12 +00:00
dan
748d8b9cdd Have the planner ensure that if one scan uses a subset of the WHERE clause of another, that scan is estimated to cost less and return fewer rows.
FossilOrigin-Name: c7b34930e27597e7f634ad76be55fc436dcb84ea48d5b41b5d7f3596285dd672
2021-08-31 15:53:58 +00:00
dan
beed24d57e Do not disable a rowid=? term used to drive an IPK index if it is a transitive constraint.
FossilOrigin-Name: 46e28cbcf6044b36aa4ddcda09adb49a46c6c6a8d41d558467ede3091304aa8c
2021-08-30 17:02:48 +00:00
drh
6d77a2948e Patch lemon to fix "error" token handling, according ot
[forum:/forumpost/e680f42f53090061|forum post e680f42f53090061].

FossilOrigin-Name: 106b5e5355a3836a9756333e6dcbb13f0878a5352dab00973b8f0900879bd724
2021-08-27 11:26:37 +00:00
drh
b97e2ad10a Add the --safe to the CLI. Also the --nonce option and the .nonce command.
FossilOrigin-Name: c76870cb1a8e2e1389ad864c51b9f596dff21df8bb58f438f0a2cacfa63b22a4
2021-08-26 18:31:39 +00:00
drh
5ced0a914e Correctly preserve the collating sequence for a column when changing
its datatype.  Fix for the problem reported by
[forum:/forumpost/e5c76b738e|forum post e5c76b738e].  Test cases
in TH3.

FossilOrigin-Name: c7f0813cabf9d8ab367bead5ba8cf20132b8bb9274d8e47b76ad66a10517dd2a
2021-08-24 17:07:44 +00:00
drh
0ccda5294f Fix a typo in a comment. No changes to code.
FossilOrigin-Name: d953646a63bf96a8e6e57fefaa60ae1487e5e4eb776fb38cd9c4ce002e74d016
2021-08-23 15:56:01 +00:00
drh
b9fd0101bd Back out the change that allows typeless columns in strict tables. Replace
that capability with an ANY type for strict tables that will accept any
datatype with BLOB affinity.

FossilOrigin-Name: d8fd1a2bfd51848ea612142d23475b268b3f5269e558f2e09713d1ac18b18274
2021-08-23 10:28:02 +00:00
drh
2a0eefd665 Allow typeless columns in STRICT tables that are able to accept any
data type.

FossilOrigin-Name: 1e2dcc2d4ee88c0aed40d1472b1c7d43fd43822891729ad6a2c55d5b912e7ad7
2021-08-21 20:54:19 +00:00
drh
ce68b6bfeb Defer deleting subqueries in the compound-SELECT code generator until the
end of code generation, in order to avoid deleting expressions out from under
the aggregation function sanity checking assert()s that occur near the
end of SELECT code generation.  This fixes the assertion fault described by
[forum:/forumpost/cfcb4b461d|forum post cfcb4b461d].

FossilOrigin-Name: 600f1991e5c0a5d89cd8776a157b6fd72c7489791085876925e8dd7ab146fe1f
2021-08-21 16:42:58 +00:00
drh
8eaf6c620e Improvement to error handling in Lemon. No impact on SQLite.
[forum:/forumpost/2f468f43cbc48d7f|Forum post 2f468f43cbc48d7f]

FossilOrigin-Name: 18cc2f85744a18b6810d30baebe07a7a1bd332348e13b1a50d779edc616fb0c1
2021-08-20 19:51:22 +00:00
drh
9135c8206e Support for STRICT tables. A table with the STRICT option only allows a few
core datatypes on columns and enforces those types rigidly.  Also, PRIMARY KEY
columns must be NOT NULL.

FossilOrigin-Name: f9c1d3441b87ee296542faa724410d16a348143cba24fe74292eefc48e038a55
2021-08-20 15:44:48 +00:00
drh
faf9c77b4b Improved error messages for the SQLITE_CONSTRAINT_DATATYPE error.
FossilOrigin-Name: 39abca01479c0f4f747b7b21fa05181896b00ed7559f0ab74aa575c23097ac21
2021-08-20 08:05:42 +00:00
drh
7b4b74acc7 Do not allow the xfer-optimization to move the content of an ordinary
table into a strict table.

FossilOrigin-Name: 1ed1b594d3c03ced68eb2b1285dfd8b9641cda20db1b1b7ae1afee217a3a9fe2
2021-08-20 01:12:39 +00:00
drh
71c770fbda Improved comments. Fewer opcodes for integrity_check on strict tables.
FossilOrigin-Name: 4ee57fb588b41ab76649c605f57c7bcf5b7b638435af458d69f69a8ccbb121e8
2021-08-19 16:29:33 +00:00
drh
9e1209d111 Enhance PRAGMA integrity_check so that it verifies the datatype of
all columns in STRICT tables.

FossilOrigin-Name: 97c9248b3b81facce569bfa3fb405d44a1d1041e87132e8f649458c95620ccb2
2021-08-19 02:58:15 +00:00
drh
ab16578b72 STRICT tables require all fields of the PRIMARY KEY to be NOT NULL.
FossilOrigin-Name: 5efdf9acad9d54783f5134b7e9338f44336862d87dc324d315b8d55e44df1923
2021-08-19 00:24:43 +00:00
drh
3b7a0ccd5c Merge the WITHOUT ROWID, NOT NULL ON CONFLICT bug fix into the strict-tables
branch.

FossilOrigin-Name: 7ee01ee47da247a80bcf16f88eb187b8c0928024536435ed20797a1a90495511
2021-08-18 23:00:43 +00:00
drh
fd46ec6476 Fix ON CONFLICT clause processing for NOT NULL constraints of PRIMARY KEY
columns on WITHOUT ROWID tables.
Ticket [f2be158c57aaa8c6]

FossilOrigin-Name: 13abba0941a724eb62455650976b03678e4455b6b3090c84a2ab2f4a7656b4d8
2021-08-18 22:26:51 +00:00
drh
72532f52bc Trying to insert an incorrect datatype into a STRICT table raises an
SQLITE_CONSTRAINT_DATATYPE error.  Seems to work, though lots more testing
is needed.

FossilOrigin-Name: a19305e5cfedf5c472200d6e05c1396443e348f052a40a0979f860f2ff06851d
2021-08-18 19:22:27 +00:00
drh
44183f83d0 What would it be like if you could add the keyword "STRICT" after a CREATE
TABLE statement to cause the table to (1) allow only a few well-defined
datatypes, (2) rigidly enforce those types, (3) require NOT NULL on PK
columns, (4) always enforce foreign key constraint, and so forth?  This
branch seeks to explore that question.

FossilOrigin-Name: 78732b9f98936693ae29c85a692c35a84c7d065aec79903af34b08d18f10a5e6
2021-08-18 13:13:58 +00:00
drh
b70f2eabb4 Rename the Column.eType field to Column.eCType - with an extra "C".
FossilOrigin-Name: b9b0dcd5af072c22f2ce71cf9584b5b572fbcfbce6410a7d703b586adb8938ba
2021-08-18 12:05:22 +00:00
drh
d519bbdf5c Fix an off-by-one error in the error-handling logic of the Lemon
parser-generator.  This does not affect SQLite.
[forum:/forumpost/cff80737bf|Forum cff80737bf].

FossilOrigin-Name: 7cca80808cef192fe0479477056a028e230a164fd368e72100def065d424ca2c
2021-08-17 19:59:09 +00:00
dan
0546027cd7 By default, do not use memory mapping to access the temporary files used for external sorts. The old behaviour (to use memory mapping by default) may be restored by building with SQLITE_ENABLE_SORTER_MMAP defined.
FossilOrigin-Name: 306694dfb462f9d1f128461e7a8f15a0bb9b21fbc696caa1832f4b20749490d1
2021-08-12 14:22:30 +00:00
drh
a76b151dab During DELETE, if an index entry is missing, do not raise the
SQLITE_CORRUPT_INDEX error (added by [f339f31f9e9a856b]) if in
"PRAGMA writable_schema=ON" mode.

FossilOrigin-Name: 19e56291a7344c7aa69e2845f11cb865ee10a6b89a00bbe74b3babbeebe0357b
2021-08-11 18:43:54 +00:00
drh
df67ec08ff Do not apply the push-down optimization to CTE subqueries that will be
reused in other contexts in where the same optimization is unlikely to
be valid.  Fix for the bug reported by
[forum:/forumpost/d496c3d29bc93736|forum post d496c3d29bc93736].

FossilOrigin-Name: a7ce29a6ef2e0362bbc9b23719d936dce07209b2651153c774682f599bbd888e
2021-08-11 13:48:56 +00:00
drh
834c688171 Improved comment on the OP_OpenDup used to get a new cursor for a
reused materialized CTE.

FossilOrigin-Name: b1926cc0ab2b81c7df30c4baa6014efcfddb9631f6e46a55c1cec0113ee1afdc
2021-08-11 13:19:13 +00:00
drh
f9d349a80d Fix a compiler warning in pcache1. Reduce the maximum size of a pcache1
cache to 2147418112 pages.

FossilOrigin-Name: 4bc93658aa563f2fa84f7f85f7f9f336dc80425640140c0fc2aec4a3606fad48
2021-08-09 19:54:27 +00:00
mistachkin
bdf15bbd62 Further improvements to the eOpenState bit values.
FossilOrigin-Name: d44f74f14a387960ce105913526b572f4a3d1935351c6aab10cee85946488a9e
2021-08-09 18:13:38 +00:00
drh
8a72882425 Ensure that the pcache1 cache size does not get so big that it overflows
the integer that is keeping track of the cache size.

FossilOrigin-Name: bf9d70fc2fde06a3f132270a26d4abe321687169066aff26ad9e92757c7f9ee4
2021-08-09 18:07:06 +00:00
drh
9d16fb1c09 Fix harmless compiler warnings and improve the presentation for the new
--threadsafe option to the CLI.

FossilOrigin-Name: 7929dc2f6f304b077c174d41711b49a24120adeb0b29cb6acb4d6a40852d7e00
2021-08-09 17:45:00 +00:00
drh
af6d1afd24 Undocumented "--threadsafe N" option added to the CLI for testing purposes.
One of SQLITE_CONFIG_SINGLETHREAD, _MULTITHREAD, or _SERIALIZED is called
depending on the value of the N integer.

FossilOrigin-Name: 2d8f297c115f378854c1f2198e47ac5af5f222a5de8cc7575c42154094e71b53
2021-08-09 17:37:58 +00:00
drh
c806917441 Improved Hamming bit-distance between the SQLITE_STATE constants.
FossilOrigin-Name: 5100b0456bc91f11e4a0bcf0d426ae4d8328cd9341ee2f9c83d0fa9f73047a83
2021-08-09 17:36:22 +00:00
drh
687d74dfcc Fix comments associated with sqlite3.eOpenState. No logic changes.
FossilOrigin-Name: fd8f498f5d5f7fcb78dd8f6f9323d20b9e2904b249ec735477a0f03cb47b8561
2021-08-09 13:06:59 +00:00
drh
5f9de6ecf4 Refactor sqlite3.magic into sqlite3.eOpenState.
FossilOrigin-Name: e5d6512aa1fa0016a679c6e0cb665a0c67ad16f1daa0c18a96b2ebae1beefd15
2021-08-07 23:16:52 +00:00
dan
b419452c7e Fix an RBU problem with restarting an update after the *-oal file is already larger than 4GiB.
FossilOrigin-Name: 087b8b41c6ed76b55c11315e7e95679d67590be20ae21108b593d00bb7d1c57a
2021-08-06 20:17:39 +00:00
drh
d519c03669 Attempt to fix the showwal.c utility program so that it works on WAL files
larger than 4GiB.

FossilOrigin-Name: 5c0f9ea98a2b944857fe05d53a0143cb827b7d8215c37f33f1bce47ec1189952
2021-08-06 19:38:23 +00:00
drh
15482bc3f3 Fix harmless compiler warnings. Omit redundant copies of os_common.h and
hwtime.h from the amalgamation.

FossilOrigin-Name: 091427007818537bb2f860c42dad867cb19050899186d4d180d195a1c6a98798
2021-08-06 15:26:01 +00:00
drh
65b400931d Store the collating sequence name for each column of a table as an
extension to the column name, for an additional savings in the heap space
needed to hold the schema.

FossilOrigin-Name: 832ac4c1ee384be0de72a4bdd55ed87e0f8294e7df5eefcf6b4942db3d85a69e
2021-08-05 15:27:19 +00:00
drh
324f91a591 Add NEVER() macros on recently introduced unreachable branches.
FossilOrigin-Name: 806939eb5947f9187dc9c4814b26e9f94ec0186596c7be97981dbea7c2169c26
2021-08-04 14:50:23 +00:00
drh
3edc927ecd Always prefer built-in SQL functions over app-defined SQL functions within
sqlite3NestedParse().  Formerly this was the case for a few calls to
sqlite3NestedParse(), but not for all of them.

FossilOrigin-Name: 164662ef01ad45ca570c44631a1117cccce6e34b00dbba7f422c089e8ffaa932
2021-08-04 13:42:12 +00:00
dan
fd779e2fa1 Avoid using LIKE with the target db in RBU. It is possible the user may issue "PRAGMA case_sensitive_like = 1" or override the like() user function, causing RBU to malfunction.
FossilOrigin-Name: 7cbd8cd5aa768a0b72f769fa390fae1158d1dcfac5273b9d0238ecf2f52e273d
2021-08-04 11:29:18 +00:00
drh
7061aa8977 Fix the build for SQLITE_ENABLE_UPDATE_DELETE_LIMIT.
FossilOrigin-Name: 5150d2da06ab3c7e3bea1865413cd21c64d5cefb91d3d874e9dd0bf51aea754b
2021-08-03 23:23:23 +00:00
drh
76f2477531 Improved harmony with the reuse-schema branch.
FossilOrigin-Name: cbc703f70d16de0e93b276528fc761290f30af770ceb4b4d11d6a6e6506ac67c
2021-08-03 18:45:41 +00:00
drh
cf9d36d1b3 Refactor field names in the Column object, zCnName and zCnColl, to make them
unique and thus easier to find amid all the other code.

FossilOrigin-Name: 8b781dcaf68e0cf12a844708c82eee00193e340195cbca915d077e4846983bf3
2021-08-02 18:03:43 +00:00
drh
f38524d20d Refactor the Table object to reduce its memory footprint.
FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f
2021-08-02 16:41:57 +00:00
drh
79cf2b7120 Refactor the way that DEFAULT expressions are stored on columns, in order
to save memory in the common case where the column has no DEFAULT clause.

FossilOrigin-Name: 8646547e54211d44c415663c33775c4268550f8332949c4731a4bb6ec9cc663a
2021-07-31 20:30:41 +00:00
drh
c2df4d6adb Recognize certain standard datatypes ("INT", "INTEGER", "REAL", "TEXT", and
"BLOB") and if a column has one of those datatypes, store the type part of
the bit-field information in the Column structure to save space.

FossilOrigin-Name: d2da62a9df63036b02dadca3798de9e623c2680b3ef0c37d2b18bb88693afd7f
2021-07-30 23:30:30 +00:00
drh
e48f261ebf If a generated column uses the optional keywords GENERATE ALWAYS, try to avoid
putting those keywords in the typename of the column.
[forum:/forumpost/ff3ffe09251c105b|Forum post ff3ffe09251c105b]

FossilOrigin-Name: 3c954863f45271a3518acf51fd685a641878811fb5cfcbdbad85154aeccdc902
2021-07-30 20:09:08 +00:00
drh
77441faff5 Avoid clownfeet in the names columns when the column names are quoted
in the original CREATE TABLE statement.

FossilOrigin-Name: 980f7292afd45a8e73272e2139b55b99ab86167febec9fd0bf0356e8167b2ee9
2021-07-30 18:39:59 +00:00
drh
7b3c514b53 Reduce clownfooting in the allocation of the Table.aCol array. This reduces
the amount of heap space required to hold large schemas by about 11%.

FossilOrigin-Name: 2941ded0acbdcf914567bf7451cfd9b770269545c20d3fa7107c40492689afad
2021-07-30 12:47:35 +00:00
drh
f873392dde Enhance the wal.c source file with an ASCII-art schematic of the -shm file
header.

FossilOrigin-Name: a6c160e08a61d105f8aab959440ac5ec4f1aaca8f0d393e08e7c2c67815b5bb2
2021-07-29 18:34:35 +00:00
drh
b71959cb4e Improvements to asserts to enforce magic numbers in the wal-index format.
Also improve automatic configure and make builds on legacy PPC iBooks.

FossilOrigin-Name: 87b8d47889f1990442aa90398614656658207085d064381074f72bda9bdcbfa5
2021-07-29 17:31:40 +00:00
drh
5025cb581f Complete warning-free build on old PPC iBook.
FossilOrigin-Name: ef2a0850394b1c6c1fc84b26694a3712ae1e50d52bb78fea2ec40148a7d833de
2021-07-29 17:23:23 +00:00
drh
944d85dfe2 Fix an error in one of the assert() statements added by [23b08fe9db24a953].
FossilOrigin-Name: ad24334bc06dc9ae52825a1873a1eab6c258d77fcc00dec55884ddddecd9932e
2021-07-29 17:01:44 +00:00
drh
20de9f6cb1 Minor tweaks to various TCL build scripts so that they work even for TCL 8.4,
which is obsolete, but is also all that is available for some legacy platforms.

FossilOrigin-Name: 2269ce64f707c4a198fcb9a72933648ea61a80b4251024b8058ff28ad81b4917
2021-07-29 16:49:28 +00:00
drh
fd4c7862ee Improve comments and add new assert() statements in WAL to help document
how everything works.

FossilOrigin-Name: 23b08fe9db24a953cc231b093cf74d140c9965d22964d0401ff8ab3d4ecba443
2021-07-29 16:48:21 +00:00
drh
02a9996e40 Remove ALWAYS() macros that can be true if the internal test function
implies_nonnull_row() is used in the result set of a query and contains
comparison operator against a computed column.
dbsqlfuzz 4c34db5bff6247f33ee49e341a1f3018e72be0a0.

FossilOrigin-Name: 4d1dbfa35c7dc0f09321b2e274a00e506f4ca65322454652d5891d815a6966d3
2021-07-29 00:33:20 +00:00
dan
779e990629 Add test case to ensure that sessions works with DELETE statements that use the truncate optimization (i.e. a DELETE without a WHERE clause).
FossilOrigin-Name: a2fc531177c3a061f2881198bb711d502db7cd831351b6a5dd415936845b6625
2021-07-28 18:13:28 +00:00
drh
c6da6dba69 Fix a harmless uninitialized variable read that occurs after an error
associated with a subquery that uses DISTINCT.  Found by a fuzzer.

FossilOrigin-Name: e9719f975f61c4c9f40ea077b049eed97d0957b925a4b6149d9ee21ce827b6a1
2021-07-28 02:04:58 +00:00
drh
9045e7d696 Reduce the scope of a variable in order to fix a harmless compiler warning
that occurs under -DSQLITE_OMIT_AUTOMATIC_INDEX.

FossilOrigin-Name: 36d5dbbe13562f4ea6435e620d102f8515bd0e6b8e66fd1841062a4e4621e330
2021-07-28 01:22:23 +00:00
larrybr
1ae057d873 Remove sqldiff --visible-controls option, make it always happen. Add test cases for controls made visible
FossilOrigin-Name: ff74c0cc4cefa5271b12ecfff3f2fd4749852d9d1d01f4ae64a07a26decc001b
2021-07-26 19:49:01 +00:00
larrybr
e40875d211 Give sqldiff --visible-controls option to deal with non-graphic text content robustly across platforms
FossilOrigin-Name: 68d2373f5d578cf3aff9d1ac4b1ab3ac00b466e94e1eb516523fc7660dfc0549
2021-07-26 18:28:24 +00:00
drh
3740712677 Enhance the CLI with the ".connection" command that can switch between
up to five different database connections.  Used for manual testing of multiple
database connections in the same process.

FossilOrigin-Name: 54eaf076c05887157179459ab39c2556953f6fef9c1b14f17a8aa74087da3023
2021-07-23 18:43:58 +00:00
drh
c0495e8c9c Set the checkSchema flag if a CREATE TABLE parse fails because the table
already exists, to ensure that the table was not previously deleted by
some other connection.

FossilOrigin-Name: 91bcb9621529b58d28e91a2763eb9eef3951400d5eaef105073258f3dd331872
2021-07-22 21:11:06 +00:00
drh
55b8b73e74 Fix ALTER TABLE DROP COLUMN so that it generates valid bytecode even when
operating on a corrupt database and using PRAGMA writable_schema=ON.
dbsqlfuzz 5f09e7bcc78b4954d06bf9f2400d7715f48d1fef

FossilOrigin-Name: b65f4f763979ee9e0b943c787609ea22d6f7e01d41dfc1e084ec50a085a3550c
2021-07-22 18:22:51 +00:00
drh
348e002ec9 One of the optimizations of check-in [de9c86c9e4cdb34f] does not work for
terms originating in the ON/USING clause, as demonstrated by
[forum:/forumpost/6cf3bb457c3f4685|forum post 6cf3bb457c3f4685].  This
check-in disables that optimization for ON/USING terms.  Also improve the
TreeView display for the resulting "true"/"false" nodes to show that they
originate from the ON/USING clause.  Add a testcase() to the other optimization
to show that it can still be used for ON/USING terms.

FossilOrigin-Name: 1f6796044008e6f3a61bcf390c0c7eb31947e971f0edada74e7a3a211f8ae76a
2021-07-22 16:07:01 +00:00
drh
c8d214711f Improved robustness of cursor renumbering in the UNION ALL flattener
when operating on vector assignments of an UPDATE FROM.
dbsqlfuzz 417d2b053b9b3c9edaf22dd515564f06999e029c

FossilOrigin-Name: 60695359dc5d3bcba68a68e1842c40f4a01650eb5af408e02fb856fd8245e16d
2021-07-21 15:42:05 +00:00
drh
74e5a5a703 Run a "PRAGMA quick_check", if necessary, on the modified table after
an ALTER TABLE ADD COLUMN to verify that added NOT NULL or CHECK constraints
are satisfied by existing rows.  Abort the ADD COLUMN if not.
[forum:/forumpost/c04814903d6ec4f7|Forum post c04814903d6ec4f7].

FossilOrigin-Name: e3794997c34f03db2a4ac0ca5b76727d0e031778d92b08eaaf9631689ec3e56d
2021-07-20 16:07:15 +00:00
dan
d59f983501 Avoid a malfunction that could occur if the same correlated column reference appears in both the GROUP BY and the HAVING clause of a sub-select. dbsqlfuzz a779227f721a834df95f4f42d0c31550a1f8b8a2.
FossilOrigin-Name: 1e35cc6d5c2f563c6bb163bb150d7bc6ede4c993efa828af1face3261bf65a2c
2021-07-20 14:57:49 +00:00
drh
0f91a5352b Fix issues in the new ADD COLUMN constraint checking. Add preliminary
test cases.

FossilOrigin-Name: 48434ad3fa9504c063d812d119bc8f622548fd02b3d478ff247b11474c4ce5db
2021-07-20 08:23:54 +00:00
drh
b4d9b2b537 Demonstration code to show how NOT NULL and CHECK constraints can be
verified after an ALTER TABLE ADD COLUMN.

FossilOrigin-Name: 039f540373b03af9e0c87499e5e0423eb093d1d343829282a5ac1de2d600b881
2021-07-20 07:35:07 +00:00
drh
53fa02507b It does not work to deserialized into TEMP, so do not allow it. The
sqlite3_deserialize() routine now returns SQLITE_ERROR if you try.

FossilOrigin-Name: 18068cc60698d4944a9d682cdf34b14b4d4b32f043f8d584dbf41c2bb5ac6220
2021-07-20 02:02:24 +00:00
mistachkin
f5b70d06ea Fix compilation of 'threadtest3' for some older versions of MSVC.
FossilOrigin-Name: b5ede6a68891820bd5b6d051b1b641bc1cd49104cad2466db184134d14f58f5b
2021-07-20 00:18:22 +00:00
drh
de3246176b More precision in comparing integers and floating point values while
processing the integer primary key for OP_SeekGE and similar.
[forum:/forumpost/2bdb86a068|Forum post 2bdb86a068].

FossilOrigin-Name: f9c6426de3b413ff8fcf04a00931ca5f123f996c572b35181af114afa8d811d7
2021-07-19 20:52:31 +00:00
dan
bb2d2a50f9 Updates so that "threadtest3[.exe]" can be built for windows with MSVC.
FossilOrigin-Name: 4ce585fb07274284e3add6adcb66ed06e4b109584704d1ec7152bf43ca8d5d85
2021-07-19 16:49:13 +00:00
dan
73983658c9 In defensive mode, allow statements that write to shadow tables to be prepared from with virtual-table xSync() calls.
FossilOrigin-Name: c8601d83fbecf84ca7991d339449b380deb5a7620dc84756a91c2880f030b423
2021-07-19 14:00:29 +00:00
mistachkin
05de5048b4 Fix minor spacing issues in the MSVC makefile.
FossilOrigin-Name: d78c272b3966cc1b12bc7e83fbe909a3c517d553a942d7f1c07bddf69f2e2164
2021-07-19 03:38:13 +00:00
drh
ef8344c6a5 Try to omit the ORDER BY clause in subqueries if doing so does not change
the result in any way. See
[forum:/forumpost/2d76f2bcf65d256a|Forum post 2d76f2bcf65d256a] for
details and history.

FossilOrigin-Name: 85ddaf1b59a19cbd9efe7724a163b30c14bafabfaf2cfced07b463e76f73e494
2021-07-16 22:43:00 +00:00
drh
ee612e2a5d Minor comment improvements.
FossilOrigin-Name: 6854b5919beefa43da21ba739e82d583183c8cdfe5dd63e27a810ac1ffe2330b
2021-07-16 20:16:19 +00:00
larrybr
d51a2d8b8f De-typo sqlite3_expanded_sql() doc
FossilOrigin-Name: 56b0f5418dad34d1e83d53741916e2a38a5448369031d959b8a44867774be657
2021-07-16 17:11:21 +00:00
drh
e46ec734c7 Modify the generate_series() table-valued functions so that its first
argument (the START value) is required.  Throw an error if that argument
is not supplied.  In this was the series.c loadable extension can be used
as a demonstration of how to code an xBestIndex function to require certain
parameters.  Compile with -DZERO_ARGUMENT_GENERATE_SERIES to obtain the
legacy behavior.

FossilOrigin-Name: 459d85a2898d6a53f43b4ad48d2f39edd1bbe37a4f97426a5d666c39c52576a4
2021-07-16 17:04:17 +00:00
drh
111c3cc9fb Fix the "main.mk" makefile so that "series.c" is a dependency of "shell.c".
FossilOrigin-Name: ff959917918495ef352ce48c240b1de6da162f2a5e76e37dcc53fa50bce27642
2021-07-16 15:30:19 +00:00
drh
0fb78f0cca Get the "omit ORDER BY in FROM-clause subqueries" optimization working for the
core test cases.

FossilOrigin-Name: e31c5888659ffd4c6d8b68627123df3bbb84bb010b7766b0a74877bf3ba1e52b
2021-07-16 01:19:19 +00:00
mistachkin
e13dfe4b19 By default, do not emit #line directives in the amalgamation.
FossilOrigin-Name: bacfa93677fbe014737fab7dbdb4e7a168a310bc5b914b17896ae2a48435c7b1
2021-07-15 23:34:14 +00:00
drh
bb30123178 Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
clauses do not affect the output.  See
[forum:/forumpost/2d76f2bcf65d256a|forum thread 2d76f2bcf65d256a] for
discussion.  This can help the query flattener in
some cases, resulting in faster query plans.  The current implemention does
not always work.

FossilOrigin-Name: ef97c3e7c3ea2cf1a4db6591328fe7ce3f1d189afc2d578159135824ec89e620
2021-07-15 19:29:43 +00:00
drh
480f5e3e6e Change references to the schema table in sqlite3_analyzer to the new
SQLITE_SCHEMA name.

FossilOrigin-Name: 3beb77d6a792d07ca605ec8e5402b8a305860cba4044fcafeed00b9fa862fa16
2021-07-15 16:39:42 +00:00
dan
20235e56f7 Fix a use-after-free error in ioerr.test caused by an error in test code.
FossilOrigin-Name: 1594056aab068b9fae82f6b885828c7127d9bedcc37c4340486e32791bc87c7a
2021-07-14 21:18:31 +00:00
mistachkin
acae2b485e Enhance comments pertaining to the interface linkage / calling convention macros.
FossilOrigin-Name: c378e99250fe06fae8ca40c62185b607f004d6806e07dbb9f964dd849b4e55f8
2021-07-13 22:49:02 +00:00
mistachkin
696555d7b5 Further revisions to #line handling for amalgamation builds.
FossilOrigin-Name: 9a84321229ad499ee0f7c85732c2728afb4476c72073a510401a559dda9be38f
2021-07-13 21:59:22 +00:00
larrybr
06a0ea9a68 Get correct #line tags into amalgamation for other builds too.
FossilOrigin-Name: 999eb80018f1bb8a8ad73483610400faf5fb37b1be446ce30edbf7028340f50b
2021-07-13 20:55:26 +00:00
larrybr
09b2196d97 Get #line tags into amalgamation, subject to configure.
FossilOrigin-Name: 5d81b598a7cd2cea2553fdf6ca38d2f65f0f1b2d5a8eea8a01c1800f68aa2422
2021-07-13 11:59:17 +00:00
larrybr
4902235796 Merge from trunk, rename tool option for its effect
FossilOrigin-Name: 9327f73c1b87fb9ca78e261d16b092763f497bb9c6f9784a33eabdc961b06343
2021-07-13 11:55:07 +00:00
dan
f1cacb76b7 Do not attempt to run Tcl sessions tests unless both SQLITE_ENABLE_PREUPDATE_HOOK and SQLITE_ENABLE_SESSIONS are defined.
FossilOrigin-Name: 385db794477e046b5dde726489375786d7565b113084f6e730efb050b08f9a6e
2021-07-13 11:30:46 +00:00
larrybr
4b1c3eb5f9 Amalgamation has #line directives by default. Minor mksqlite3c.tcl changes
FossilOrigin-Name: ba3eff71973064cbc0ddf51aa822a246c162bbb65387e9523692c60e5340acda
2021-07-13 01:45:04 +00:00
larrybr
a73c306065 Clarify comment on sqlite3.h's interface decaration macros.
FossilOrigin-Name: 7cb09aef49c0b98c0c5e332d953a2eeb71ae9e243b1e37ab1c8ed4af15d46f50
2021-07-09 23:12:42 +00:00
dan
8eed584786 Fix an assert() that might fail if sqlite3_create_function_v2() is invoked with NULL xStep and xFinal callbacks and a non-NULL xDestroy.
FossilOrigin-Name: ab1550a608684b6b9104b555a975482cfabca5053b7d7dcc60d63a0e3a8d707d
2021-07-09 14:59:12 +00:00
drh
62f560f805 Enhance the sqlite3_create_function() interfaces to assume a value of
SQLITE_UTF8 is presented with a nonsense value for the preferred encoding.
This is undocumented behavior added for robustness.

FossilOrigin-Name: c1bb5cff527af6a97b025d646581c68ac9b56924ae199f86964026a7bc9724fd
2021-07-09 13:52:01 +00:00
dan
f33e7795b3 Add the usual "#ifdef __cplusplus" magic to header file ext/misc/carray.h. Also update carray.h/carray.c to use SQLITE_API in the usual way.
FossilOrigin-Name: 0f97c2a459bfadc2fe19e710e8845039b4434010656d311074b9594b02d0826a
2021-07-09 11:52:53 +00:00
larrybr
a13c0c73c5 Allow CLI shell build to #include same user-specified header as library build.
FossilOrigin-Name: eb8af9a494fb68c0a1c600b3ac71467645b51b296fc6e2116d7d855319d59a59
2021-07-09 00:12:05 +00:00
mistachkin
b523159f40 Rename optional SQLITE_CUSTOM_INC define to SQLITE_CUSTOM_INCLUDE.
FossilOrigin-Name: 060aec37accae858ced5b081a2ff76dccdd8f8bcefc63d1fe2e7478257c69e76
2021-07-08 23:35:20 +00:00
larrybr
f382e1dc59 Allow library build to #include a user-specified header.
FossilOrigin-Name: 71e6490bbe59939cd15f0094e507dd8a2e167fdd8de675c3ebfeaf528a01f87a
2021-07-08 22:12:27 +00:00
dan
bd24e8faa3 Preserve and return to the user any error message returned by a failed xConnect() call on an eponymous virtual table that prevents a query from being compiled.
FossilOrigin-Name: bbbbeb59a6a14b94dcbaf218cbcfbd39feba4a1df5b37c0e1a955391393eeec4
2021-07-08 18:29:25 +00:00
drh
77ea22300b Fix an issue with the SQLite Expert extension when a column has no
collating sequence.
[forum:/forumpost/78165fa250|Forum post 78165fa250].

FossilOrigin-Name: b1e0c22ec981cf5f8a6597abc6711b1a25019dd51de31129fbc504d3dc743bb4
2021-07-08 12:12:39 +00:00
drh
9d41caf361 Fix a harmless compiler warning in the "fuzzcheck" test program.
FossilOrigin-Name: 8c432642572c8c4b7251f413def0725b3b8e9e7fe10230aa0aabe86b58e5902d
2021-07-07 19:44:32 +00:00
drh
7098859031 Fix a harmless compiler warning - duplicate local variable named "pRHS".
FossilOrigin-Name: 5bc05faf279e0c98be83cb6d56f669a60ff515c8244fca6280991ed0dc5e7ae7
2021-07-07 19:40:18 +00:00
drh
4f16ff9d06 Follow-up to [68db1ff9c44fa9c3]: The number of registers needed by
PRAGMA foreign_key_check was increased too late for an assert() deep
down inside of sqlite3ExprCode().  So move the size increase a little
earlier.
[forum:/forumpost/79c9e4797d|Forum post 79c9e4797d].

FossilOrigin-Name: 7072404ad0267b8ee774b2804ea59ea28e29316521d76d76a701595e51d1be97
2021-07-07 16:48:24 +00:00
dan
2931a66ece Fix a recently introduced segfault that might occur if a sub-select were used as a term on the RHS of an IN(...) operator for which the LHS is a row-value.
FossilOrigin-Name: f586c06a5d03943db32add4d3d058a5aa09c819870b29cd8b54cf69433a8cdb1
2021-07-07 15:52:44 +00:00
dan
74777f994d Improve the error message in cases where there is a row-value on the LHS of an IN() operator, the RHS is a list (not a sub-select) and at least one element of the list is not a row-value with the correct number of elements.
FossilOrigin-Name: 6b22f4e71dbc14c887ebbda67095b5faaa8079cac87cd4ab5a2ae90c71cd9633
2021-07-07 13:53:55 +00:00
dan
cc516af4cc Instead of disallowing writes to fts5 tables if there are fts5vocab cursors open on them (commit [c49a6ed7]), abort any fts5vocab queries if the on-disk structure of the fts5 table changes.
FossilOrigin-Name: 9dbdc9001e3258e71ca995fbcdebf66ab95890ded87fa7125c6cb4bd43010aaf
2021-07-07 11:51:03 +00:00
dan
9289f5103d Handle "<vector> IN (<vector>, <vector> ...)" in the same way as "<vector> IN (VALUES(<vector>, <vector>, ...)".
FossilOrigin-Name: 981d230ece98ce89502dab02aa44f73699a9d0e4fce3e9e9dfd47444a5a9990f
2021-07-06 20:44:32 +00:00
dan
b9324fea07 Do not allow writes to an fts5 table if there are any open fts5vocab cursors.
FossilOrigin-Name: c49a6ed78a917d4972e048e2a9bbe4d400691f97ce7e022f0e4436ceaed7fb73
2021-07-05 19:01:09 +00:00
drh
a612c1c9bc Add the ATOMIC_INTRINSICS compile-time output output. Move sqlite3Int.h
in front of ctime.c so that default values that are not overridden are
shown in PRAGMA compile-time option output.

FossilOrigin-Name: e306952690bfb140e2c404a74b05ff2d070c487f7e52c62d62a004505fba0e15
2021-07-05 18:37:37 +00:00
dan
0f56f891dd Revert [5204c2c4a7b73a64], restoring the old pre-processor logic for determining the availability of the __atomic_store_n()/__atomic_load_n() primitives.
FossilOrigin-Name: e690abb9e4e189c41182ac813115d55d811135013f5ce94ec0c45a547597f8ad
2021-07-05 17:15:38 +00:00
dan
5daf69e5f4 Allow sub-queries in the FROM clause of an UPDATE...FROM statement to access the object being updated without using an alias, as is required in the parent query.
FossilOrigin-Name: 740cb43025449b7d7b47a97ad00885e54b7701cbcb14f4a50c7523022e3936d5
2021-07-05 11:27:13 +00:00
drh
e46292a920 Improved rebustness in sqlite3ExprListDup() when it contains a vector assignment
from an UPDATE where the initial term is omitted.  This can happen during a
UNION ALL query flattening while processing a virtual table update in which
the first term of the vector is repeated.
[forum:/forumpost/16ca0e9f32|Forum post 16ca0e9f32].

FossilOrigin-Name: 2547cfe38f8fb35109b3fc5bdfada387fe4b2b8a304156b704ab7f03f1f71198
2021-07-05 02:40:29 +00:00
drh
10f08270e1 Ensure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
to the number of columns in the vector. This is not strictly necessary. It
just simplifies the state description and make the code easier to reason about.

FossilOrigin-Name: 026f08d4cff19a95e0f38f2ef431cacd65c7c77ed92e30d7f2ded84651f47150
2021-07-05 01:11:26 +00:00
drh
105c4b5ced Fix an incorrect comment on testcase misc1-27.0. No changes to code.
FossilOrigin-Name: 49829ae3229b7c7c7adeaa970a84aebd5157bc93b38fd6d80d86cc03f5fdde6f
2021-07-05 00:07:39 +00:00
drh
4a4e02bc52 Enhance the treeview debugging mechanism so that it correctly deals with
TK_ROW expression nodes.

FossilOrigin-Name: e87fdb6514b6f6775a5a36ca0ec5c920eeaba9e3b842dffa327e970b27cd036d
2021-07-04 22:33:08 +00:00
drh
24384d88d6 Fix a (harmless) typo in a comment. No code changes.
FossilOrigin-Name: d2b9b8daa3b87c3dba1329e2f2f44b60d6b5bb9a49d741045aa20cc7813446b2
2021-07-03 18:57:40 +00:00
drh
5c46a7e555 In the PRAGMA foreign_key_check, ensure that sufficient registers are
allocated for the virtual machine, even if one or more foreign keys reuses
the same column multiple times and has more columns than the table it is part
of.  [forum:/forumpost/a6b0c05277|Forum post a6b0c05277].

FossilOrigin-Name: 68db1ff9c44fa9c37690ce55ad304d4263ba6fac490063d9e08470de6c17cfe6
2021-07-03 02:55:47 +00:00
drh
dd51365408 Put ALWAYS() on a branch that is always true due to [d4097364c511709b].
Fix a testcase precondition associated with the same check-in.

FossilOrigin-Name: 55e2fbebb0a2c9991feef46f31e79b82a24de272aae836bf4d3c06ee06ef1a70
2021-07-02 12:25:30 +00:00
drh
4d466698a2 Fix a harmless assertion fault discovered by
[https://oss-fuzz.com/testcase-detail/5517690440646656|OSSFuzz].  The
assertion fault is harmless because the assert() checks a condition that
that is harmless if false and the assert() is disabled in production
builds.

FossilOrigin-Name: 79443aabe1db8cc2ff9537fde0dac0e858eae3f3848ee9cc1b8fba47b824bf08
2021-07-02 12:08:12 +00:00
dan
b9248ef5c7 Allow unqualified "rowid" references to be used in join queries, provided that only one of the source objects has a rowid.
FossilOrigin-Name: d4097364c511709b1874881a0c036640777d1f724165416adf6f53a41f8c6e40
2021-07-01 18:19:17 +00:00
drh
3832ac9f51 Import the updated nmakehlp.c file used by the TCL Extension Architecture (TEA)
builds in the amalgamation tarballs.
[forum:/forumpost/5a5001f20a|Forum post 5a5001f20a].

FossilOrigin-Name: 595bf95bf8884c545e85e3feee6f43503b59d3c6d69073f0aaba4473c7c61cac
2021-07-01 16:57:48 +00:00
dan
90d3b24a16 Fix a memory leak in fts5 that could occur when processing a query containing multiple classes of error.
FossilOrigin-Name: 7c279670f544a5bb9733a88862d9e490062b07415cd790e0d6d1e2cb584d2007
2021-06-30 14:04:25 +00:00
dan
c629e21786 Fix an assert() in fts5 that might fail when dealing with corrupt records.
FossilOrigin-Name: 9e760e256089c0ebbf816a8de8b186f62e1ffcd6b8b0e76dab8387798cd4d0e1
2021-06-30 12:11:19 +00:00
drh
14a1b1c132 Do not enforce the SQLITE_LIMIT_FUNCTION_ARG limit for internally generated
SQL.  This prevents problems with statements like ALTER TABLE if the
function argument limit is set too low.
[forum:/forumpost/17735aa21f3ddab2|Forum post 17735aa21f3ddab2].

FossilOrigin-Name: 763fdec5b3151eeab001c50e78f654cd9b4b4c10e81e50a663046a70e64d5339
2021-06-30 11:53:21 +00:00
dan
cf1e25566b When generating data for a RETURNING clause, avoid assuming cursor number 0 is available for use.
FossilOrigin-Name: 4b2c59acce6ff1bb6c9c04c45c80945ae23a26588718cc20635d60f7497adabb
2021-06-28 15:25:17 +00:00
drh
4422b3a646 The OP_ReopenIdx opcode should clear the cursor if the cursor is being
reused.  This prevents leaving the cursor in an initialized state which
could cause problems for a subsequent OP_SeekScan opcode.
Fix for ticket [6dcbfd11cf666e21] and the OP_SeekScan optimization
of check-in [4a43430fd23f8835].

FossilOrigin-Name: d4bf5243f2bf0a2bc77ad12f3e1e4797cb62f2745f9d54eee5f675c3b5f80880
2021-06-25 14:48:24 +00:00
drh
81640a226e Remove a redundant "ANALYZE" line from the ".fullschema" output.
FossilOrigin-Name: 7b47f420954000ce46d05adde6e91a2fbdab8dd528ebd8089cca4fcf9d8a3605
2021-06-25 11:21:21 +00:00
drh
69935c0935 Fix a bug in the ".fullschema" dot-command of the CLI brought to light by
check-in [a2ddb89b206c1387] - raising an error on at attempt to access the
rowid of a subquery or view.

FossilOrigin-Name: 36875827a416067e1b8ffba0ff0ff88313177f8d84dd8e5bc9c23ea3f2d587ba
2021-06-25 11:14:10 +00:00
larrybr
83cb9eb48e Document sqlite3_wal_hook() return.
FossilOrigin-Name: 8acaf7964551b4524fcdbb8d01fae7b0911508ecf6dcf23c3e0f8d8c790b78d8
2021-06-25 00:25:38 +00:00
drh
dff34ab96f Allow the SQLITE_OPEN_EXCLUSIVE flag in sqlite3_open(). Return the
SQLITE_CANTOPEN_EXISTS extended code to indicate that the open failed because
the database already exists.

FossilOrigin-Name: d091150ff80709a1e50e0431aa33021f036979e4a88e9769eeec431dfad6d5f5
2021-06-24 18:23:54 +00:00
larrybr
c06836c3b1 Make conditional nature of sqlite3_normalized_sql() better known.
FossilOrigin-Name: 0e0ece7111945d61278e60385f883303b593ed0d64beeb951b9c49f243531628
2021-06-23 17:41:38 +00:00
larrybr
10496f7657 Fully incorporate *_changes64() API improvement.
FossilOrigin-Name: 6699a2f6bec9dfcdc456ff1cd8e652588b144ec28b7eac6e403a63eab61b416e
2021-06-23 16:07:20 +00:00
drh
9b9f235165 Show CROSS JOINs in the TreeView debuggingn output.
FossilOrigin-Name: 72e09b6c9b74c8226b231fec021228af6bc191fc1b5798d0ff2e893f4ba203bf
2021-06-23 11:39:00 +00:00
dan
a261c02d44 Fix a problem handling ORDER BY terms of the form "ORDER BY likely(<integer>)" within window frames.
FossilOrigin-Name: 710f75b98bb4ac5bfdfa745c1de832dd1e4d9fb387da52b2f0d1353613f5cdc3
2021-06-23 11:12:48 +00:00
drh
415ac68ae8 When an index is used by all branches of the WHERE_MULTI_OR optimization and
becomes a covering index, make sure the index has been created prior to
NULLing it in the OP_NullRow opcode of a LEFT JOIN.  See
[forum:/forumpost/0575376e07|forum post 0575376e07]. The covering-index for
WHERE_MULTI_OR optimization was added by [62678be3df35cdcb].  Test cases are
in the orindex01.test module of TH3.

FossilOrigin-Name: 787c76a865dc51dbca4f30432d64783199c2efb1df4619e4bbaf32182977321e
2021-06-22 23:24:58 +00:00
dan
2c7188732d Add the sqlite3_changes64() and sqlite3_total_changes64() API functions.
FossilOrigin-Name: 48fdec22c966003f5577e0bf52906ef90df11e4e395723a646304e67ed976f37
2021-06-22 18:32:05 +00:00
dan
020c4f3830 Fix a problem causing sqlite3_changes() to return an incorrect value following a "DELETE FROM tbl" command on an intkey table (because internal b+tree cells were being included in the count).
FossilOrigin-Name: f662ff4746aaa43e63e20710b8cbfeeceab3183e953ac1685c41846d2e9d124c
2021-06-22 18:06:23 +00:00
dan
b9f8a187de Ensure that the cell array used in balance_nonroot() is always large enough, even if the pages being balanced are corrupt.
FossilOrigin-Name: 53f64e83b39cb56ac7211ffc80d06da13318e1da9dbca7b9123954f5be229a0d
2021-06-22 14:59:34 +00:00
drh
4d2c20331a Load recent dbsqlfuzz cases into test/fuzzdata8.db.
FossilOrigin-Name: a766bba0eead47e9ff24b6afd152a7fbd331261e04dd76feb9510585a08c5786
2021-06-20 22:52:51 +00:00
drh
b915418134 Remove a NEVER() that is reachable by a corrupt database.
dbsqlfuzz 8456a0f88e39a49fb675d8f77394979ebb2a03c1.  Test case in TH3.

FossilOrigin-Name: 1c41e86fa102ec2b73fb7a55357ba6328fda37af316215e8808be88e2d1fd75f
2021-06-20 22:49:26 +00:00
drh
41d26396bb Do not allow an SQLITE_CORRUPT error to mask a prior SQLITE_IOERR in
balance_nonroot().  dbsqlfuzz 5e1c86e7f18023f2b9abe3429977d7ea726f50d8

FossilOrigin-Name: 50e818767e423991b99b3155cb15a0d1c1b744ab6139a8273f9348aab9a53d9c
2021-06-20 22:17:49 +00:00
drh
5d8ade1f67 Remove unnecessary (redundant) variable initialization from
sqlite3BtreeInsert() for a small size reduction and performance increase.

FossilOrigin-Name: 70d1836474207fa045ff7aa513839c9df26ea6e180eb898b30d89bd5b3833f58
2021-06-19 20:20:23 +00:00
drh
f51bad45f0 The previous check-in is a significant change to btree, so go ahead and
increment the version number for the next development cycle.

FossilOrigin-Name: 2eb6697051c13bf0cc3772fd6c16bfdea0be3b01c0d985e05004c04eaf7a4a48
2021-06-19 18:35:20 +00:00
drh
42a410dcad Split the sqlite3BtreeMovetoUnpacked() routine into two separate routines
sqlite3BtreeTableMoveto() and sqlite3BtreeIndexMoveto(), since we usually
know the type of btree in advance.  This results in less branching and
better performance.

FossilOrigin-Name: 3b0d34e5e5f9a16c3397e4551f3b534729b1b375770f05f6ed5847818b1f4c0b
2021-06-19 18:32:20 +00:00
drh
6d72858e79 Version 3.36.0
FossilOrigin-Name: 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5
2021-06-18 18:36:39 +00:00
drh
9c32c914b8 Add an ALWAYS on a branch in STAT4-only logic that is now always
true due to check-in [c21bc5a2353e660f].

FossilOrigin-Name: 7bd55eee1ac63cf6d5699ce85bc5a29bf51afdf7a80bce44937fa833947a40f4
2021-06-16 19:23:24 +00:00
dan
755708538d Omit a handful of tests from pager1.test when testing SQLITE_ENABLE_ZIPVFS builds.
FossilOrigin-Name: c3036c28259c1375cd2c480c9ca0ce7f9aa1e952be4f110dde49b2b7d72a43b7
2021-06-16 18:58:01 +00:00
dan
7379b455a5 Do not run test file sessionbig.test on 32-bit platforms. It uses too much memory.
FossilOrigin-Name: 75e53215fe436999cdc70434c6ae96d3ce6642c71528cce9f5715fe1b1b81876
2021-06-16 16:56:56 +00:00
drh
a4df1bd5ff Adjust the mkshellc.tcl script so that the generated code always uses
unix-style line endings.

FossilOrigin-Name: 9f69af4dbcb273519fa87b7868f3792560fb71b192f4ffe53b8b465334da5ae4
2021-06-16 15:56:09 +00:00
larrybr
d95a652025 Avoid ominous warning in showdb.c
FossilOrigin-Name: f8d7ac0104b76555142ce0d32714594f42d19b311dce2f77f42f92756b5e0c93
2021-06-16 13:26:40 +00:00
drh
cbe83495ee Adjustments to requirement markings in comments. No changes to code.
FossilOrigin-Name: be00e45b723adf64bc78927dc12de3116fd04912a52e5c105a52f235c57698f5
2021-06-16 12:26:01 +00:00
drh
236bcdf3e4 Enhanced defense against integer overflow in ALTER TABLE.
FossilOrigin-Name: fb7f094e4e0f03622c2e7fa02483c17671a8899c7ad8aba8659177180f406704
2021-06-16 11:32:54 +00:00
drh
82f62e8324 Fix some #ifdefs so that builds work for all supported compile-time options.
FossilOrigin-Name: ca7d78f7818b4754fd04ea2b618dee1f01e11c6a5acb54951217c0d03df8e187
2021-06-15 20:10:25 +00:00
drh
9d82a2ccfe Fix an incorrect ifdef in the previous check-in.
FossilOrigin-Name: 4b2bb46730393292364b2be7db4e73fc8f93cd5a141aaf04f20fe0119deb5ab3
2021-06-15 20:07:16 +00:00
drh
f54e79405e Fix some minor #ifdef issues so that all of the supported compile-time
options continue to build.

FossilOrigin-Name: d8cf407046f20b0398f19acd0dab6acb6c742911e21e1003cb5b194dd668d98e
2021-06-15 18:46:06 +00:00
drh
17adf4e5a1 Update the "nmakehlp.c" utility program sources associated with the TCL
Extension Architecture, obtained from
[https://core.tcl-lang.org/sampleextension/file].  Perhaps this new
version will sit better with salmonx's static analyzer
[forum:/forumpost/7f0beca9797ee23a|(ref1)],
[forum:/forumpost/7d5c8b19231ad57f|(ref2)].

FossilOrigin-Name: 603b851d7d923d71543760b09a55d72dbbc185ac9c353c954c331c0454992c80
2021-06-15 15:36:05 +00:00
drh
a959bf5311 Add NULL checks on all sqlite3_vfs_find(0) calls. This is not strictly
necessary.  There are no vulnerabilities here.  However, adding these
checks avoids unnecessary static analyzer complaints.
[forum:/forumpost/ce1193be15|Forum post ce1193be15].

FossilOrigin-Name: 272a15b9f418fb0b31a9808f7c42c20cf52318035ff98935d8e8519634357e8d
2021-06-15 15:15:40 +00:00
drh
972da42749 Prevent an infinite loop in the trim() SQL function if the second argument
is a carefully malformed UTF8 string.

FossilOrigin-Name: 829343c26ed7b87fafc70de3369625209bad91e79bb7ca2946d5c8d61cc1c3c4
2021-06-15 14:34:21 +00:00
drh
11e489d6cb Fix typos in testcase() macros from check-in [c09d90eec2a49b94].
FossilOrigin-Name: d4d9869c30710914b7ba51221b2c2223a9cf16b913bd6f3866ae747494a116af
2021-06-14 20:49:33 +00:00
drh
93fd5420d0 In the authorizer, use SQLITE_DROP_INDEX, not SQLITE_DROP_TEMP_INDEX
when dropping an index in an attached database.

FossilOrigin-Name: e5a5acd6006133c5da4a7dd79726dbaa41c0d60ebeda890f848a6aafe5f9ef70
2021-06-14 20:41:20 +00:00
dan
ac67f56726 Fix an ALTER TABLE problem with handling infinite loops of CTEs in the database schema.
FossilOrigin-Name: c09d90eec2a49b948c60971294d146db5c82438855cd3fa48ddc3d2e6b44c26c
2021-06-14 20:08:48 +00:00
dan
09612a5bb8 Fix a test script problem in corruptN.test.
FossilOrigin-Name: 3ddfe9ae55e6d0d922fbc209768b2ac4a4792f0f63af9a8fb53d66a4b8f1d94b
2021-06-14 14:52:27 +00:00
drh
21571a94c1 An index on the expression "likely(X)" should store the true value of X,
even if X is a real number with no fractional part.  The optimization of
storing some REAL indexed values as INT (see [10d851353c2abead]) should
be omitted for index columns that are expressions.
[forum:/forumpost/3b940c437a|Forum post 3b940c437a].

FossilOrigin-Name: 791473bc6677c2ae76f558082a4b43ca1eaf9895b76624d5b55d58f2af898ff3
2021-06-14 14:00:09 +00:00
drh
de5f21d0a8 Avoid allocating oversized column names in the sqllimit1.test module.
FossilOrigin-Name: 7068f1f69b4feef49260e80902e6bdae47c21a0daa16c96ed1a0984dd1f14cdc
2021-06-14 11:20:30 +00:00
drh
0d08402f34 The opcode that preceeds OP_SeekScan is usually OP_IdxGT but can sometimes
be OP_IdxGE.  Adjust asserts accordingly.  Follow-up to
[9a2ab6092d644fc3].  dbsqlfuzz e41762333a4d6e90a49e628f488d0873b2dba4c5

FossilOrigin-Name: d6803ed8dc4b1eb4d4dc100728acb4a4aa1479732f0fcb94eb23b7f7702ef65c
2021-06-13 19:14:14 +00:00
drh
7a7cefa0b8 Improved defense against OOM errors in sqliteInitOne().
dbsqlfuzz 429db39cd5777c46479641e8637c48c62890042d

FossilOrigin-Name: b6c57e0e2a9658417a0a5548e73007faa59c837b9ad87293bc216feef980717a
2021-06-13 17:55:58 +00:00
larrybr
bd0d62c35b Correct link in .ar help.
FossilOrigin-Name: de9d0f9548106f5a59c57dbf947fc63c0411b1e975033a4c4097cefbbe86ee5f
2021-06-13 08:23:28 +00:00