23727 Commits

Author SHA1 Message Date
dan
02ede43da2 Fix a possible user-after-free in ALTER TABLE found by asan.
FossilOrigin-Name: 9252619d410293ddefd108f5cf81b6fb4932bd3f2ceaaa92abb7542e34f66111
2022-02-12 16:02:37 +00:00
dan
8443505dc9 Update fuzz.test to account for a change in error message made in the core.
FossilOrigin-Name: c57601b51f9b59e9d8f0eb06580fa14f49525e56bd0190c02865e478bd1f48e7
2022-02-12 13:45:02 +00:00
dan
af7b8dcb58 Avoid dropping SQLITE_TOOBIG errors in the quote() function.
FossilOrigin-Name: 115c3051a1ff7567e84f14fc4c49efe61bc2850248533449b0195c305ab6516e
2022-02-12 13:37:27 +00:00
drh
f17f607556 Fix a test in without_rowid1.test so that it is disabled without
ALTER TABLE support, as it uses ALTER TABLE.

FossilOrigin-Name: ca22a64e6f05a6688974f4cff1a0ff2c873aad1947f3cf6ffaeee8bb074b2627
2022-02-11 21:20:46 +00:00
dan
7b57aa3da9 Update some OOM tests of the ALTER TABLE command to account for an error message which may be returned if opening the temp db fails.
FossilOrigin-Name: 3409fd4150df059d7308f79fa3672a330af9cefe2ad9120c3da5ef1413921e96
2022-02-11 19:41:03 +00:00
drh
eba21cd4be Load recent dbsqlfuzz finds into test/fuzzdata8.db.
FossilOrigin-Name: b275ad250d8aa286829647967ab7e75fcd2b5674caab1a34eab59d8486a34cd5
2022-02-11 17:47:58 +00:00
drh
11fc3c0fa7 Reference the wayback machine for the dead hyperlink to the MS support
page in the comments about why the extra typedef for va_arg().  No code
changes.

FossilOrigin-Name: ab1a9b5b78de7c00b38357b1df08e82ce5608a14f8c675ac20c5f2dad5212f50
2022-02-11 17:47:25 +00:00
drh
4ba1c5cc49 Fix an assert() in the pager by adding "|| CORRUPT_DB", in as much as the
assert() is not necessarily true if the database size in the header is
wrong.  dbsqlfuzz f2f996065b90988aa9b0ae425b66dbb296546a08.

FossilOrigin-Name: a51402e8c29fad2b24e32de55b10691fb0ebd6c2cebac941e43e54be211d5d39
2022-02-11 17:33:02 +00:00
dan
63a47336af Fix a problem in [c006515ae6faff65] causing an assert() to fail with some build configurations.
FossilOrigin-Name: d7ff262d6d1fd8b855bcb8f6f54ab1833663a4d8187701ddf045f6b5a62a5d1d
2022-02-11 16:10:18 +00:00
drh
85548fac8d Use the enhanced SQLITE_TESTCTRL_LOCALTIME_FAULT (2) capability to do better
testing of the 'localtime' and 'utc' modifiers to date/time functions.

FossilOrigin-Name: f38071946ac2e5bb61e6c0620507e4c94464999ac700d86c1a704b94eb1c009a
2022-02-11 14:08:05 +00:00
drh
fa3ee3b10b Fix the bind2.test test script so that it works even if
SQLITE_ENABLE_PREUPDATE_HOOK is not defined.
Fix for test-case breakage from check-in [c006515ae6faff65].

FossilOrigin-Name: 937d3a45b3fef354dbdea2085fbb7d9c752a96e8ebb62f61931deb5a64132946
2022-02-11 12:06:37 +00:00
drh
0d58ae010c Work around the MSVC bug that prevents the use of function pointer types in
the second argument of va_arg() by adding a typedef.

FossilOrigin-Name: eae3ab0a050079d050f339b2510eebd55afe4464e9b410ddacb7523f89981144
2022-02-11 11:37:12 +00:00
drh
b30af022da Fix SQLITE_TESTCTRL_LOCALTIME_FAULT so that it works even if mutexes are
enabled.

FossilOrigin-Name: 64537a0669553e8a6b610b9e9703ec084472516c86cfc22a7a6c73b6c66131ee
2022-02-10 23:12:58 +00:00
drh
d7e185ce5d Enhance SQLITE_TESTCTRL_LOCALTIME_FAULT so that is able to install an
alternative localtime() interface so that the localtime logic an be better
tested.

FossilOrigin-Name: 6e25cb0890e8cdc63c9a21e841844d066267fc32ad143527843f7c8d05612b53
2022-02-10 21:26:53 +00:00
drh
eadccaa926 Performance improve to the 'localtime' and 'utc' modifiers for date/time
functions.

FossilOrigin-Name: 85cb6014751a0572d28ebd839331d5d7a78de45c9e522adcd834a8a85746f32e
2022-02-10 15:40:40 +00:00
drh
522608d3a2 Faster implementation of the date(), time(), and datetime() functions.
FossilOrigin-Name: fa1b393bdb66b985f6552190a8242ed878f91d653a03352f65aa8d750de3cec4
2022-02-10 12:57:53 +00:00
drh
ddd3fe6fc4 Fix the test harness so that it builds without SQLITE_ENABLE_PREUPDATE_HOOK.
Has been broken since [c006515ae6faff65].

FossilOrigin-Name: 4565f711291bae5daaff6dd2b7b2991b17e139a576b1b73bb1f81f08a4c1a13f
2022-02-10 12:31:37 +00:00
drh
0d36368601 Fix a typo in documentation. No code changes.
FossilOrigin-Name: e97c6ad4c915c82c2f0b347a0cdc8f80942c345194675a88174047ce0d0a43ad
2022-02-10 01:01:31 +00:00
drh
e2adc0eea1 When process first moves a database into WAL mode and then tries to run
sqlite3_wal_checkpoint() without first performing a transaction, first
try to run a synthesized transaction to get the Pager caught up before
attemptingn the checkpoint.
[forum:/forumpost/fd0f19d229156939|forum post fd0f19d229156939].

FossilOrigin-Name: eee6de1967609f0b590ee4dbec088c3e7b03b08753267ed2909c5b03d60a0e18
2022-02-09 18:47:09 +00:00
dan
252fe67bdd Fix a problem with using sqlite3_bind_value() with sqlite3_value objects obtained from sqlite3_preupdate_new() when an integer value is written to a column with real affinity.
FossilOrigin-Name: c006515ae6faff6525d589827d99092b06004472e32b7f586845c00c4732d695
2022-02-09 18:42:15 +00:00
drh
9f4ce3b19f Writes to the subjournal should be all-or-nothing. Fix for
dbsqlfuzz fe3c397fb90029313446c4e0f4a6cd0c81dd9621.

FossilOrigin-Name: 22cc55e84f67f6f39b7dba07a4ef7ae958b2d926633faec91a278922053e50c6
2022-02-08 15:14:18 +00:00
drh
4e532958c1 Provide sqlite3_error_offset() data for some new errors.
FossilOrigin-Name: 1269206db810460e55a52e178ba3332add42a11f66c5f292f8f0d29ccd61a4b8
2022-02-08 13:41:23 +00:00
larrybr
07fc85a2bf comment-only change to sqlite3.h
FossilOrigin-Name: f815cf4a5f97778f177d373814700e8f2f6429dc467b68b799b5b349cc00b7a2
2022-02-08 12:24:43 +00:00
drh
633c798283 Do not show the error code number of CLI error messages unless the error
is something other than 1 (SQLITE_ERROR).

FossilOrigin-Name: b471601892df98c5103bb55132bbdecf3e4dfc428aaecc47bfec1e1d51e583c7
2022-02-08 12:13:16 +00:00
drh
3e46db21d4 Improved error message formatting in the shell. Distinguish between
"Parse errors" and "Runtime errors".

FossilOrigin-Name: ae3e322a029952f575e49c73fb50b46bbea55be6792cc225cb94f5e0cbd046d9
2022-02-08 11:52:45 +00:00
drh
e1c4743121 Disable the sqlite3_error_offset() when the error occurs in a trigger or
view or some other bit of text that is not part of the original statement.

FossilOrigin-Name: 0e909e34fa74e7b9b7954e4ed4c39dd293c1d413b58fda03607faab74aa382ad
2022-02-07 18:52:56 +00:00
larrybr
6e85b27cbb When create table/view fails due to name taken, say which took it.
FossilOrigin-Name: 9a206e37fb49a203a7b5fdc93c41acc39e9ceb37144c78432a235e2f0d54a210
2022-02-07 01:09:49 +00:00
drh
5d20a21814 Fix unreachable branches in the sqlite3_error_offset() logic.
FossilOrigin-Name: 031381aea371892a35737e550121846af41241711a36c1a2086af3b0c11bf7b6
2022-02-06 23:54:41 +00:00
drh
51896e6fd7 The sqlite3_vtab_in() interface should return false for a vector IN constraint.
FossilOrigin-Name: 245d0241c78870c6a41af3e02b82b13151472e2102fbd62989672f8122feca73
2022-02-06 22:13:35 +00:00
drh
89e9baa2ca With the new ALTER TABLE under PRAGMA writable_schema=ON processing, do not
ignore non-parser errors such as OOMs.

FossilOrigin-Name: 36653ccef68cf61b6001000a713b06e951cb6fddced6b6a906c3b17d70a8af87
2022-02-06 21:13:59 +00:00
drh
2ef111168f Faster computation of Expr.nHeight.
FossilOrigin-Name: a7a5af327ba8bafcd58b828e3e7a10d0008bb780d55a6c573aa15896dcc8ab89
2022-02-06 11:51:23 +00:00
drh
17a93ae1b8 Record the error offset on INTEGER tokens.
FossilOrigin-Name: 38e057a580613be176552e230e40b4434a9ed57a82d407e92a23c7b8e62c0b0e
2022-02-06 11:26:51 +00:00
drh
62fc069eb4 Further improvements to localization of errors in input SQL.
FossilOrigin-Name: fa34676042720161ca03f3926814152eb1d144ec12fd2b44e5429408ea4ad5b0
2022-02-06 00:30:04 +00:00
drh
4f77c9208a Enhance sqlite3_error_offset() to report the position of unresolved
identifiers.

FossilOrigin-Name: 5b8d2577907abda10de29884716bacc10bff0df1451228a0ac40342dbea6d589
2022-02-05 23:11:19 +00:00
drh
796588ae07 Record the position of many identifiers in the parse using the new
Expr.w.iOfst field.  This is done with the idea of providing offset
results for sqlite3_error_offset() for a more kinds of errors, though that
part is not yet implemented.

FossilOrigin-Name: 32a3a53b62ab09ac2212905e7f42fe6f1b09d891e015203e5caf4cb16262f18e
2022-02-05 21:49:47 +00:00
drh
4734b3f9b7 Update stale evidence marks on sqlite3_vtab_rhs_value() test cases.
FossilOrigin-Name: 46744b83d5e1335bcbc59f9625e8ade3f360469d17f34e8d996f077ba9afa89e
2022-02-05 13:27:52 +00:00
drh
dfce5b6dd5 When PRAGMA writable_schema=ON, allow ALTER TABLE to proceed even if there
are entries in the sqlite_schema table that do not parse.

FossilOrigin-Name: fc4c82e5694cbdae13f2cb90e5368ba9f6b826a220a81de32ead2ffe1bc5f31f
2022-02-05 12:39:17 +00:00
drh
569c10566e Fix a NULL pointer dereference that can occur after OOM. Problem
introduced by check-in [197cbabf1767d060].

FossilOrigin-Name: d4e6b9f0f7567b76760a667a701bca4d6158ade39f9a69d205b583c5a1c0c7f4
2022-02-05 12:05:43 +00:00
drh
6c758900c2 Fix documentation typo.
FossilOrigin-Name: 1a7d8bb5ea0d0e0c250312f89a701c0274cfbcaef9cd71995fb83bf939668504
2022-02-05 11:13:26 +00:00
drh
d515ea5b56 Typo fixes in documentation.
FossilOrigin-Name: 1ec747d1c34ced9877709dd306e674376e79145de08b9c316d12bc5e06efc03e
2022-02-05 01:01:07 +00:00
drh
bcd60d20a3 Test case for permissive ALTER TABLE RENAME when writable_schema=ON.
FossilOrigin-Name: 7ee44f66c896cdc7b6980811e8e4537dbd63b23060ead0104f25132d955890af
2022-02-04 20:16:00 +00:00
drh
10d29c7a94 One more case of disabling errors for ALTER TABLE RENAME when
writable_schema=ON.

FossilOrigin-Name: c52d0dd8f4f8fab4c3f33cbd26b4012569e76562282e85654018c836dca7b564
2022-02-04 20:07:24 +00:00
drh
0fab10991b Add a compile-time option to include vt02.c in fuzzcheck.
FossilOrigin-Name: c404c8c72600c11b181519d269bf949aff304eaafb90a50d1415c6fe84d2b092
2022-02-04 19:13:18 +00:00
drh
5a80050dd3 Allow ALTER TABLE RENAME COLUMN to proceed even if there are errors in
the schema, as long as PRAGMA writable_schema=ON is active.

FossilOrigin-Name: 197cbabf1767d0603928462fb75cf8100f6999f725e0db60d096c7ca20e3da28
2022-02-04 16:43:30 +00:00
drh
69b0ce33fd Fix various harmless compiler warnings.
FossilOrigin-Name: 70049342d5ad57ea3e863bba19253934b868bacdd1c26c9371bac024a829badf
2022-02-04 13:15:01 +00:00
drh
02e3e04134 For the MULTI-INDEX-OR optimization, when pushing down WHERE clause terms from
the main query into the various OR-term subqueries, do not push down slices
of a vector comparison, since the right-hand operand of the comparison might
have only been initialized in a different OR branch that was not taken.
dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1.

FossilOrigin-Name: 9f67ad00cd38b7c5ec6d14b379e1a611777bbdf6901d843a80712ba7d94d6d33
2022-02-04 13:05:29 +00:00
drh
7f1c111948 Minor typo fix in comment. No code changes.
FossilOrigin-Name: f9b763042c5c4446115c5375a8e4731e522e36ad9fc53e9ef775de9bc297ea19
2022-02-03 18:14:22 +00:00
drh
697c50b947 Do not allow the vdbe-compress.tcl script to generate structures named
"do" or "if".

FossilOrigin-Name: e35ab16dd0fd40b07a71d26e1cdb19ef664a2a628a4abcb2e130f5e555de8ca9
2022-02-03 14:37:06 +00:00
drh
3832c3c10f Prohibit schema changes within xBestIndex callbacks.
FossilOrigin-Name: bb0f056b3f2ecc3893e5e48e99c060788550ea6a8ed02b715953af051bafbad0
2022-02-03 14:19:26 +00:00
drh
19eef9af64 Improvement to the sqlite3_vtab_in_first() documentation.
FossilOrigin-Name: 403e7ac900e53407282393747b784dc0cd4303958394534e3936fce138bc1bc5
2022-02-02 21:06:40 +00:00