Commit Graph

26476 Commits

Author SHA1 Message Date
drh
3748b7329f Use "volatile" isntead of "#pragma" to get floating point calculations
working correctly when compiling with GCC for x86 machines.

FossilOrigin-Name: 9427f42687ed6d97c474bf42d0c3e82d6f4b0075e74206adcb5699d72e32140e
2023-07-06 00:55:06 +00:00
drh
efd0cf87df This is alternative work-around for the x86 float-point problem that uses
"volatile" rather than compile-specific #pragmas.

FossilOrigin-Name: 1d972a690fdc70ab40862bd38427d68b48e8802ddf8e5c301f2d58ce2178b6ec
2023-07-05 22:05:18 +00:00
drh
728650ecb3 Improved comments on the work-around to the GCC x86 floating point wonkiness.
FossilOrigin-Name: 7b4c16731e7bf6f03f5adf4fcb2008c0b19be473fb1b90b405c217c08916586a
2023-07-05 19:56:14 +00:00
drh
e68899f1e4 Work around for an apparent GCC bug. See
[forum:/info/ee7278611394034c|forum post ee7278611394034c] for details.

FossilOrigin-Name: 5d9e9364808793d65925d4efbfde0f4246df258758f15e8ce1105070d1018fe6
2023-07-05 18:59:52 +00:00
drh
85ca6d7ace Make the order of operations explicit for the error term of Dekker
double-precision multiply.

FossilOrigin-Name: 28f57b34e6b11184a36e363a985e7531bddd7be48a5e039a670e5acf748eedda
2023-07-05 15:34:30 +00:00
drh
1790ccb98b Simplification of the dekkerMul2() subroutine.
FossilOrigin-Name: bfe6432a46fd41bfadf4516a73b4e2523d9b453c3e4486fe6df7e1d25275dfb3
2023-07-05 14:42:50 +00:00
drh
6aa5a42beb Add the ieee754_inc(r,N) function to the ieee754.c extension.
FossilOrigin-Name: 9a36f269451d8832f68e223ac3995493704364e7fd0cc772989c96e863a08d29
2023-07-05 12:00:32 +00:00
drh
7623795018 Enhance the sqlite3AtoF() function so that it can operate with or without
long double and provides accurate results in both cases.

FossilOrigin-Name: fd987508d5589d42b46625c97cfb2feeac70fdb1cb11224610554b07a60644e6
2023-07-03 18:32:29 +00:00
drh
aa4356da68 Enhance sqlite3AtoF() so that it honors the USELONGDOUBLE test-control.
Enable the test/atof1.test module on non-intel platforms.

FossilOrigin-Name: b7850fd480535980d66f107c2746e7f7fc0a5379ec8244d84f7785533c83f276
2023-07-03 18:18:35 +00:00
drh
930e4167bd Store the fp-speed-1.c test program used to measure relative performance of
SQLite versus the standard library, in the test/ directory.  A header comment
explains how to use it.

FossilOrigin-Name: eaff376277edceb043e9aac9d2df3e1157f576605508733be8a0a0aa4d720e1d
2023-07-03 15:30:50 +00:00
drh
521f20e3d3 Add the --nolongdouble option to speedtest1.c.
FossilOrigin-Name: 6bf6018a00d61c5f0e53b37b00befaf5ad1d85323f41cf0cea25d8c6c1017096
2023-07-03 15:11:28 +00:00
drh
c9f240cea4 Improved precision of binary-to-decimal conversion of floating-point values
on all systems but especially non-x86 systems that lake extended precision
hardward floating point.

FossilOrigin-Name: 32befb224b254639e756fd493f300507ff60c5222e00a7338dbcd39140133964
2023-07-03 15:03:59 +00:00
drh
1b3c6e727e Whether or not to use the long-double floating point conversion technique
is now a test-control setting.

FossilOrigin-Name: 02ae6caff1f7925c696ad263fe78b1036364d24b6373e1baec10d53aafb14a12
2023-07-03 14:56:49 +00:00
drh
0478d1d88a New test cases for floating-point conversions.
FossilOrigin-Name: 9435ed76cd9bb1be02768b3853a2323834f67bda75d3e3f76f6aa7bd0bade3d7
2023-07-03 12:58:18 +00:00
drh
b884158434 Use Dekker double-precision floating point to do the value normalization
step in sqlite3FpDecode() for systems on which "long double" is 8 bytes or
less.

FossilOrigin-Name: 51f492b440728151ce64168d5436ba87ca60d84b89408e47c593fa731355afe4
2023-07-03 11:44:15 +00:00
drh
841e596ad0 Final clean-up of the idea of using Dekker double-precision floating
computations to improve accuracy.

FossilOrigin-Name: 40285d631072b79aba39cc20d4b217bdf0069f29ac9902cb97dec28d3e4cde11
2023-07-03 11:39:38 +00:00
drh
bc2b65832e Squeeze as many bits as we can out of normalization.
FossilOrigin-Name: 25d1ad6df1ed460c2cc9f32e8a5106e121ae502044f83abf431c1d5b3879eb56
2023-07-03 10:35:29 +00:00
drh
5270d7424d Faster Dekker multiplication that removes the restriction on input magnitude.
FossilOrigin-Name: 2994caf5884be07c889519c78fbac4ddcf267fcfe6a3265ecb6390bcd574532e
2023-07-03 10:18:02 +00:00
drh
37b188fbca Fix one constant in the normalization logic. Improved error output
from atof1.test.

FossilOrigin-Name: d3c48807100a358a70fdd799c8935eba1b765ace2e1ddea4475fd673006cb6da
2023-07-03 10:00:38 +00:00
drh
c8885d42fe Replace the dodgy error estimating logic in the previous check-in with
full-up Dekker double-double multiplication, and this idea works much better.
There are still a few inaccuracies, but it is much closer.

FossilOrigin-Name: 4fa6938dac2d3d813a37664053db31451a2a065f78dd212488f5f7f8d583ddc5
2023-07-03 09:07:23 +00:00
drh
c27bda0b79 An idea for improving accuracy of fp-to-decimal conversion for systems that
do not have "long double".  Does not quite work.  Retained only for
documentation purposes.

FossilOrigin-Name: 702243333843219f8904ee0fd12283080d6c6b3fc1ffb36c534cdefb3563c00d
2023-07-03 00:40:37 +00:00
drh
fecdff4354 This check-in adds the use of "long double" to sqlite3FpDecode() which when
run on x86 using a compiler that translates "long double" into binary80,
causes all legacy tests to pass.  But on a system where "long double" is just
an alias for "double", some of the tests are still failing.

FossilOrigin-Name: ce06982f880339cf46704e95c907249827c3e44af2b9420005200ca8abd3f371
2023-07-01 20:21:27 +00:00
drh
453be55b85 Reinstate the fpdecode() SQL function for testing, but only when compiled
with SQLITE_DEBUG.

FossilOrigin-Name: 07eab52e0801bb0e4743b304a06ad16e18cdf8eaa18c0faf8d47a1f5d8576ea0
2023-07-01 18:33:26 +00:00
drh
17c20bb15e Improved rounding policy.
FossilOrigin-Name: 6f1122e942b8269552daaf13d647d200d8546ec25f36310d67037c6b58d09976
2023-07-01 17:56:00 +00:00
drh
9ee9444a0a Improved response to Infinity and NaN. Remove the termporary fpdecode()
function.

FossilOrigin-Name: 76ab8ae809a47a66688e2d50c20dc87ce946d82e9ffebb3adda55c451fad07fc
2023-07-01 15:23:24 +00:00
drh
42d042e602 Progress towards fixing corner-case floating-point formatting issues.
FossilOrigin-Name: 1138b8d16edef16d2943d407e289d07d546a14e64c3efa3c94127631e06fafeb
2023-07-01 14:03:50 +00:00
drh
3f073f9ef8 Fix an issue with the "+" attribute in printf().
FossilOrigin-Name: bdfd1eb1d7b4c570a53d58789dac0bf55fdaf8eba515d5a0caf2e57e25b51952
2023-06-30 23:42:46 +00:00
drh
aebeabacff Begin cutting over sqlite3FpDecode() into printf(). The code in this
check-in gets a lot right, but there are still some formatting
discrepencies.

FossilOrigin-Name: c134d423e79ba5d3343d7480229822a0c83210f67f12129e0237181f892f97a5
2023-06-30 23:18:44 +00:00
drh
002330dc48 Add decimal rounding to the sqlite3FpDecode() routine.
FossilOrigin-Name: 27871140caa833f0bc0962e44356993938e93dcf81c1074382b1560a3e1aeb61
2023-06-30 19:41:57 +00:00
dan
f8be243fef Add experimental ".scanstats vm" command to the shell tool.
FossilOrigin-Name: e727640fb5c17d23b8e27972065b4acbf169c9240298d3ff7aed092b727d052d
2023-06-30 19:14:35 +00:00
dan
e6d7ae24e3 Fix an error in the previous commit on this branch.
FossilOrigin-Name: 47c11ca90f98ffc4d91f07e2ab35826a604a2c903008eeddf8b814bb984971f2
2023-06-30 19:13:27 +00:00
dan
aec0aa83a9 Add the "nexec" and "ncycle" columns to the bytecode virtual table. For accessing counters collected when SQLITE_DBCONFIG_STMT_SCANSTATUS is enabled.
FossilOrigin-Name: f7b163a319bee9e935a4abf0bd87e16c9974cba5ae75b0cbba63c9da168f2006
2023-06-30 18:59:10 +00:00
drh
a1b0ff1735 Experiments with a new algorithm for converting ieee-754 binary64 numbers
into decimal.

FossilOrigin-Name: e923405e448385085224f9289991b303d86b02763535ea77d6fcee98ba6fc1f2
2023-06-30 18:35:43 +00:00
dan
24b368da8d Add support for sqlite3_stmt_scanstatus_v2() profiling of GROUP BY clauses that use a temp b-tree, and for sub-queries implemented as co-routines.
FossilOrigin-Name: 7afad1f759f7ceda873c6d869422fd56fe4399c2d24d47ad9bc3b84b06d830d1
2023-06-30 18:31:37 +00:00
dan
4cd3a59a79 Improve support for sqlite3_stmt_scanstatus_v2() profiling of sub-queries implemented as co-routines.
FossilOrigin-Name: 4e8718dc35dbbaf75f17265a88d14acd9750dc75efbadf41377f9c97e732009c
2023-06-30 18:23:53 +00:00
dan
07d76f7b95 Add support for sqlite3_stmt_scanstatus_v2() profiling of GROUP BY clauses that use a temp b-tree.
FossilOrigin-Name: 796eadcc50e7ea9ec348b1f7e2d6a5a3de78c675a07f665078309e6d81479e7d
2023-06-30 17:14:36 +00:00
dan
1bfe92a691 Add extra debugging code for sqlite3_stmt_scanstatus_v2() to test1.c.
FossilOrigin-Name: f936f101406069b29218c89a36581b4497226fb61906782ea368f12d943c901c
2023-06-30 16:16:51 +00:00
drh
48114d08cf Completely unwind the enhanced precision sum() from [a915f15a916af698] so
as not to offend UBSAN and OSS-Fuzz.

FossilOrigin-Name: 85be05b66ef975f02a3e7b2984bcab97d9280c7f3b6ee1e16718de549f240d46
2023-06-30 14:01:09 +00:00
drh
dd8b12a6c5 Omit the doubleToReal() function in vdbemem.c. Use the
equivalent sqlite3RealToI64() function in its place.

FossilOrigin-Name: 625820e8ebfdcf513c81b1b632bbe2aa882a8fbba52001113dc6f56270fa5ceb
2023-06-30 12:59:06 +00:00
drh
60f41362cf Make the sum() function less precise and slower in order to avoid
harmless signed integer overflow UBSAN warnings from OSS-Fuzz.

FossilOrigin-Name: 1be0646a2c352dbf03d2af87fd48b6f9edfd68666790ac6863144ac95f3e0621
2023-06-30 11:51:36 +00:00
drh
2ddfa6a360 Cleanup and commenting of the new DECIMAL extension code. No functional
changes.

FossilOrigin-Name: 5124481663eb8e74a9f861be98adb7075ea911fcff0216d98c658e955acadf14
2023-06-29 23:03:30 +00:00
drh
ec3e57fa92 Enhancements to the DECIMAL extension:
(1) If the argument to decimal(X) is a floating point value (or an 8-byte blob),
the floating point value is expanded into its exact decimal representation.
(2) Function decimal_sci(X) works the same except it returns the result in
scientific notation.
(3) New function decimal_pow2(N) returns the full decimal expansion of the N-th
integer power of 2.

FossilOrigin-Name: 8baf8c10aecb261751f2b154356ab224b79d07230929ec9f123791278e601bba
2023-06-29 20:28:03 +00:00
drh
500ca334bd Fix harmless compiler warnings about unused function arguments.
FossilOrigin-Name: 24927c1377314a10177da4a57191593440aa97fd0c5949fdf25a22df1d947600
2023-06-29 17:48:32 +00:00
drh
0b1a1e8c37 Improve the range of floating-point numbers that can be handled as integers
for numeric-to-text conversion.

FossilOrigin-Name: 41580ba452fdbc3f73da60d8030289d38614c4cab8d24140d7cc44a54b2da8d2
2023-06-29 17:36:18 +00:00
drh
a75011a891 Further refine the dtostr() testing function in the CLI so that it takes an
optional second parameter which is the number of significant digits to display.

FossilOrigin-Name: 2f9d4444aa503102a00d6e6769dadc57d4b26a2c07f145f23f2f28e0c161246d
2023-06-29 17:26:21 +00:00
drh
cd88a74115 Change the (undocumented) dtostr() SQL function in the CLI so that it only
shows the first 26 significant digits - 10 more digits than are available
in a 64-bit double.

FossilOrigin-Name: d758859f6ab94ddb9b3ee6f6f5f24b16e2b7a7712761080cfc6540d68b5a0c97
2023-06-29 16:48:25 +00:00
drh
9ea7632cca Add the decimal_sci(X) function to the Decimal extension for showing a decimal
value in scientific notation:  +D.DDDDDe+DD

FossilOrigin-Name: 61d4923913e88b980ce93db4f3f9f9d7ba3baaac724995c36c9b887c034accdc
2023-06-29 14:49:23 +00:00
drh
7f5fe1faf3 CLI enhancements to facilitate SQLite core testing:
(1) Add built-in functions strtod() and dtostr() that convert text to
floating point and back using C-library routines.
(2) Do not disable all of ".testctrl" without --unsafe-testing, but only
those subcommands of .testctrl that are actually dangerous.

FossilOrigin-Name: 669996a8ddcbf35f3de66cf466508fc1e6dd09ab269aba395ac86a11b2ec238c
2023-06-29 12:14:10 +00:00
drh
8fbb335d9f Enhance the SUM() aggregate (and related AVG() and TOTAL()) so that the running
sum is accurate to about 100 bits.

FossilOrigin-Name: a915f15a916af698e0cef46c8b3e7ed11bda19349179d2d414073cd39c4cce24
2023-06-28 12:02:48 +00:00
drh
60783f47b2 Improved accuracy of floating-point conversion constants as suggested by
[forum:/info/598d32f6135c41c1|forum post 598d32f6135c41c1].

FossilOrigin-Name: 4943e8a1819e189747eefc414d02c0485e1620deff9cf92664295b21a8a9a83c
2023-06-28 11:46:28 +00:00
drh
d847c73153 Simple test cases for the enhanced SUM() function.
FossilOrigin-Name: c66ef2440e4e6c7aa17b50e5a29e543713ccab69aa0a415bac29b35b6116504a
2023-06-26 19:57:23 +00:00
drh
12b198f1a2 Use ideas from T. J. Dekker in "A Floating-Point Technique for Extending the
Available Precision" (1971-07-26) to enhance the accuracy of the SUM()
aggregate function in cases where input magnitudes vary wildly.

FossilOrigin-Name: 439fc00fee62b4db3751860485e21a99cae4fd1f5d911b2c08651a1466245ecc
2023-06-26 19:35:20 +00:00
larrybr
502c618f01 Fix CLI .sha3sum error message for keyword identifiers, reported in [forum:/forumpost/7cbe081746dd|forum post 7cbe081746dd].
FossilOrigin-Name: 9d7813ddcf67f1256e7331c5f390cb122b3f7e35cf46e0b33b610216a5396a00
2023-06-26 17:08:08 +00:00
stephan
b9561384d0 Replace some JS 'self' references with 'globalThis', as reported via the npm subproject.
FossilOrigin-Name: d4e66dfc2e87112fa73a9c64db358429d88fb2ab3a08908b0eb655f6ed42f94b
2023-06-26 07:05:05 +00:00
drh
d2b9cdd592 Fix typo in the README.md file.
FossilOrigin-Name: 6d435d1dace1be52bdb920168e629412b9adf55dbe59cf3db8f169c26f6e6b81
2023-06-25 20:23:51 +00:00
drh
cc19bed8b1 Add support for the octet_length() SQL function, with low-level optimizations
that avoid loading large string content from disk when the argument to
octet_length() is a table column.

FossilOrigin-Name: fa5f77862c0fe0189aa4246a1e55bb7c537c28c436ec10b75f5fa141e5e4aff0
2023-06-23 11:10:13 +00:00
drh
077efc2730 Optimize the argument to the octet_length() function so that it does not
attempt to read content from disk.

FossilOrigin-Name: 8b8ea4e3f52d96cc217bd1fb27ca4a83489ef1f250756ed2f790d1b0ee529a3a
2023-06-22 21:19:37 +00:00
drh
7f9dcd664d basic test cases for octet_length().
FossilOrigin-Name: 034a5fe2a0cfe085271385da1d281515b04b311e08962519d03ad8ad156fb4bd
2023-06-22 15:26:52 +00:00
drh
d6c671e626 Merge recent trunk enhancements into the octet_length branch.
FossilOrigin-Name: d35c214811aac7dec0000ca2aa77231f74a7963dd0c53cf25a65ade5ef0f8dc0
2023-06-22 13:01:02 +00:00
drh
d4170ac0eb Simplification to the getAndInitPage() routine that results in improved
performance.

FossilOrigin-Name: 2e9734c2335d8c06fedc9f4cca02baaf326f7fa276bd464f3214f383715a48d6
2023-06-22 01:03:39 +00:00
drh
71aac8763f Improved comment on the getAndInitPage() in btree.c. No code changes.
FossilOrigin-Name: dc468cfdb825083b3a4b6cb95c913961e9312e22103c5a0cd923b75c83c65e13
2023-06-21 21:47:09 +00:00
drh
3a202be6f1 Add the --pcachetrace option to the CLI.
FossilOrigin-Name: 61dfa92b44ad38a7aac76a09e167819ce5d0acace3e06ba9ed17b3264cc043c1
2023-06-21 14:11:25 +00:00
drh
40ee72947e Omit unnecessary calls to table locking routines in the common case when
there is no shared cache.

FossilOrigin-Name: f94f3021cde1d46373ee8fc8e5028d7507a937240c59cf0d0d19ab22acbd3c41
2023-06-20 17:45:19 +00:00
drh
c439b9e0c6 Avoid unnecessary calls to sqlite3DeleteTable() with NULL pointers.
FossilOrigin-Name: 4a35f391995a88757d7b46f52bf241f523ee2a6a7b6726df00cddaec8cee7080
2023-06-20 16:26:52 +00:00
drh
f6e04b6e29 Avoid unnecessary calls to sqlite3CodeRowTrigger().
FossilOrigin-Name: 27c174dbd0e7ba029d13fb005fc950ac99eb6aee31903ee3acfc88c262d13f6a
2023-06-20 15:48:24 +00:00
drh
bcc76bd419 Performance optimization in sqlite3VdbeAddOp4Int().
FossilOrigin-Name: 456a24324bd42e1e3384ffa8474b7d0760b27df95be0e92ddce5eb87339f6272
2023-06-20 11:46:32 +00:00
drh
f82c8cb0d5 Avoid unnecessary NULL pointer checks on calls to sqlite3WalkExpr().
FossilOrigin-Name: 73d86a12fb068456a884c030fddd87020d6ec9d56376de541cf082b2104174d3
2023-06-19 23:27:22 +00:00
drh
1e24dc987a Small performance improvement and size reduction by recognizing that no
SQL keywords have less than 2 characters.

FossilOrigin-Name: 6b3d25b7982623ab4b25161aff9ab44778e136069043ab425543597c42c98ae5
2023-06-19 20:54:49 +00:00
drh
1be61ad278 Fix large integer constants so that they work on older C compilers.
FossilOrigin-Name: 3c94f87806a8b408d8204fc7deec16d01c085ee199ff21a1f20b6346ce816cfe
2023-06-19 13:09:16 +00:00
drh
8e5cef7bca Fix harmless compiler warnings that show up on 32-bit RaspberryPI builds.
FossilOrigin-Name: bc4d20f362925e4ce5c79f0d7a27a8e9bbac92525bd4cea2ae983798e3f8c37d
2023-06-17 15:42:44 +00:00
drh
0587a1a8bb In date/time functions, fix the rendering of "subsecond" and the
computeHMS() routine to better deal with floating point
rounding errors that arise on some 32-bit systems.

FossilOrigin-Name: e46a00ae880dd12df090105498a85017d1367f88bf27d86f0b0200cf0536a906
2023-06-17 15:22:00 +00:00
drh
56a410741b Address various harmless compiler warnings from
[forum:/forumpost/d526da8ee4|forum post d526da8ee4].

FossilOrigin-Name: 365caf2f97e8f15842f52536e8d05d359e9d6e863182e020ce14a9a9f27ee057
2023-06-16 14:39:21 +00:00
drh
2e4d526996 Fix the pager such that if the xOpen() message sends back the SQLITE_OPEN_MEMORY
flag, the pager is opened in journal-mode MEMORY, even if compiled with
SQLITE_OMIT_DESERIALIZE.  No changes to the logic as long as that OMIT flag
is omitted.  We need to better document the behavior of xOpen to describe this.

FossilOrigin-Name: da1252b29852191eccbea98e0314408c75bb83a51f9d68d589705d4971a23850
2023-06-16 11:05:49 +00:00
drh
f025fc164d Updates to the README.md file.
FossilOrigin-Name: fa5cb6dab52dcf853854ad12922a125b9a5f898362e883bb31b2f789c632288b
2023-06-15 16:02:19 +00:00
drh
733ef7e8e6 Fix harmless typo in a comment.
FossilOrigin-Name: 6937986a687e4afea39168702f3a29aef0d60cebff024edab30d1aecfe159065
2023-06-15 15:43:08 +00:00
drh
0c04f2e576 Work around what appears to be a GCC 32-bit optimization problem in the
computeHMS() routine of the date/time logic.

FossilOrigin-Name: aebdbcbebff1319dd00551c9fb9ad4b08859f10e87f097295d564ae1ba188c02
2023-06-14 12:19:07 +00:00
drh
e30ecbfb84 Improved sqlite3_error_offset() values for bare column errors on '*' and
'table.*' expressions in SELECT statements.

FossilOrigin-Name: 118fe600876686273f85d0a080a21267e83c11826365f3220336b1bd39562518
2023-06-13 18:10:52 +00:00
drh
d34ce81867 Extended the time-diff format so that it can have a 5-digit year. This enables
time differences to span the full range of dates supported by SQLite.  Also
fix some inaccuracies in the computation of time differences and add new
test cases.

FossilOrigin-Name: d57ddbf4eeeb3ccfe31871f098045b9e58634153a3c3030f597cb58c1177218a
2023-06-13 16:55:24 +00:00
drh
d97e0d0e38 Initialize a local variable in FTS3 to avoid a GCC compiler warning.
FossilOrigin-Name: 7ec4ab327decd6a5ee5e6a53f1489e17e0cdbb297945f9acc532b47d052eb7a9
2023-06-12 18:22:34 +00:00
dan
16702ec69d Fix a problem causing bloom filters to be used less efficiently than they might be. Problem reported by forum post [forum:/info/06c3f01da6 | 06c3f01da6].
FossilOrigin-Name: 56d9bb7aa63043f5db4a1e5e8eefe46762dba433145807c6e27a8316f1d03d7a
2023-06-12 13:49:37 +00:00
drh
997670f997 Check-in [70e12efd1b189560] left a path through lockBtree() that failed to
set the BTS_PAGESIZE_FIXED flag.  That omission is fixed by this check-in.
dbsqlfuzz 02c9ab74eb0619c9ae3b894ce157fae1d7f94645

FossilOrigin-Name: 30dcc872eb1c9549708009c86357826c4f15ffa17e379dab5cd4aec596643728
2023-06-12 13:31:20 +00:00
dan
d679f9e5d1 Fix a buffer over-read that could occur as part of an fts5 secure-delete operation on a database containing corrupt fts5 records.
FossilOrigin-Name: a35c50eca907d0cf373b7962c359aebfce8ac7c34ce81edeb99122d4fb5804f7
2023-06-12 11:06:57 +00:00
drh
26d71f03fc Make sure temporary sqlite3_value objects used by STAT4 are reset to NULL prior
to being reused, to prevent a memory leak associated with
the custom xDel string value destructor.
dbsqlfuzz 65209ab5d5730e4fd14fff9d024325a77239036e.

FossilOrigin-Name: 88be7075cdc7000d3a1e84e49064cf8c28fc7caca9c464f44a83265223961b51
2023-06-11 21:58:20 +00:00
drh
b102d62749 Defer setting the BTS_PAGESIZE_FIXED flag until after we are certain there
are no errors and the page size has been set.

FossilOrigin-Name: 70e12efd1b189560e07f59db03a20b8c1ab19224aae4fc3d7c0bdfd2568064ea
2023-06-10 19:33:02 +00:00
drh
26e136bb9a Fix an assert that can go bad if STAT4 content is corrupt. This is a
follow-up to the previous check-in.

FossilOrigin-Name: ac1d3860af4eb30e4a7444b01d7b5afc91a4b1f5e3fe5414a491c6edc7ff1631
2023-06-10 18:40:20 +00:00
drh
04b92471f7 Extra space to prevent a buffer overread on corrupt STAT4 records.
dbsqlfuzz 7128d1b41ce9df2c007f9c24c1e89e2f1b2590ca.

FossilOrigin-Name: b99135288b157044e2319833e8632c89483778f876aa45ee66e46ffb6ae42ab2
2023-06-10 17:05:05 +00:00
drh
6bbc5b3730 Enhance fuzzcheck so that it understand the sqlite3_db_config() and
optimization settings from unused bits in the database header, which
dbsqlfuzz is now using.

FossilOrigin-Name: 918708c6dea5bffab4bb1c15d655ac7356bae97b84def905479dfcf491db6c5f
2023-06-10 10:37:49 +00:00
drh
7520116441 Simplify a memcpy() in defragmentPage(). It now might copy more content than
is strictly necessary, but runs faster and uses less code space.  Possible
reasons for the improved performance:
(1) the copy is now always 8-byte aligned,
(2) fewer intermediate results are required which means less register
pressure which helps the compiler to optimize the subroutine.

FossilOrigin-Name: 6e5607ae4d872954483a8d7a5c866aa41e4af70fae9652fb7eb211b316ab724d
2023-06-09 15:54:18 +00:00
dan
6e4ff8707e Remove SQLITE_EXTENSION_INIT macros from dbdata.c.
FossilOrigin-Name: 106ec745766ac59131f975d5ab5487c8a24b9c3be1766411c018b42c6ae4672a
2023-06-08 20:49:25 +00:00
drh
2f764eb4f4 Improvements to the src-verify.c utility program so that it continues to
muddle through a corrupt manifest file, making the most sense of it that it
can and reporting "manifest" has having changed at the end.

FossilOrigin-Name: 157b5d25e0c99eabfa3c32cb867fe7e3c05031c12354f734d2cd8a4062b9439c
2023-06-08 16:19:21 +00:00
drh
8efe749ab3 Fix the amagamation generator so that it works one a clean source tree.
FossilOrigin-Name: f502610d03a1362eea936129abd03390835b7e47ba25e6799b2e7880de540640
2023-06-08 15:30:10 +00:00
drh
fd5d18045a Include source provenance in the header comment of the amalgamation.
FossilOrigin-Name: e3eb5af9050aae1db6887d17a560a24e4ca58f232ad7ac7c283c861ea4944f0b
2023-06-08 15:27:35 +00:00
drh
4fa5952090 Enhance Lemon so that it remembers which -D command-line options are actually
used in the grammar and includes a list of all such options in the header
of the generated output file.

FossilOrigin-Name: c47a4dbd24b8277c57b7a83a8c0aeac2bc8f6ab75d1b65ba5e1fa83d1868d95f
2023-06-08 12:52:28 +00:00
larrybr
4eda84a456 Add spell-checking for all comments in main sources. (./src/ .c .h .in) make target "misspell" tells of misspelled words for which no exceptions have been put into tool/custom.txt .
FossilOrigin-Name: 5332abf0ad8ef42c44e9dd7045d017bb8fc9a0262a89ababa3e2c41788a6cdb8
2023-06-07 23:10:40 +00:00
larrybr
55be21647e Fix straggler misspellings and tidy the custom dictionary. Also include pickups from [forum:/info/c61fb09afd|forum post c61fb09afd].
FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
2023-06-07 17:03:22 +00:00
drh
c5a5a54c51 Remove additional traces of FTS1 and FTS2 that were missed by [2bb50d5aedef0fd2]
FossilOrigin-Name: 9a12bac5d24c7a8364d2127fd12c3409a53ef83e408d10f344ddd311cdba98af
2023-06-07 15:00:54 +00:00
drh
1d7c88bf98 Remove unused, legacy shell script "mkso.sh" from the root of the repo.
FossilOrigin-Name: 57f75e48690bdeb9b6bb3f46eee39021e3eb8cc0c488d2584177baa11ac984e5
2023-06-07 14:47:29 +00:00
larrybr
bc91738e66 Add a C-source spell-checking facility. make misspell (on Nix)
FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
2023-06-07 08:40:31 +00:00
drh
25e87ed1ba Fix compiler warning in src-verify.c.
FossilOrigin-Name: 2d58c77448cfaaf12887b60bcfea039d3410a750ac8955a817c45be85c00eb9e
2023-06-05 17:12:33 +00:00
drh
4246a4bf14 Update the README.md file to talk about the verify-source makefile target.
FossilOrigin-Name: aa8e79e16abf028d50370ae13b6c952a7b7f42985125bc8e7f51b20a10bfc336
2023-06-05 13:57:37 +00:00
stephan
dc608d8a5f Remove extraneous console trace output from previous check-in.
FossilOrigin-Name: c9f6e36d59fc8bf2bcef6fc14ff2e9ad3dfd972de94d4a71ff3f56134810a8ef
2023-06-05 11:30:50 +00:00
stephan
c81dcaabe8 Add a JS test confirming that binding of statement parameters in a subquery works.
FossilOrigin-Name: 5dfaf0bce83c3e15ad605e3f07291ce219f1a2726ce77be27779897088ee13d5
2023-06-05 11:26:59 +00:00
drh
706047470e Generalize the src-verify.c utility program and provide additional documentation
in the header comment.

FossilOrigin-Name: 7ed84046ef0c2c64031cac3a3a6b43aac3ac40aeb36838d8d046493f2d5ed122
2023-06-05 01:05:46 +00:00
mistachkin
59714faa68 Minor cosmetic normalizations for the MSVC makefile.
FossilOrigin-Name: c9fda8d6dba36841415d0f445b4081b051bfaa70428b605ac0b9ca4ae98f7d49
2023-06-05 00:57:38 +00:00
drh
979715bb45 Fix harmless compiler warnings in tool/src-verify.c
FossilOrigin-Name: 0e79ee97b18792dba9213bd9961f53e2bae765ac92df7963703d08857da74fd1
2023-06-04 22:59:20 +00:00
drh
10ca116b3e Enhancement to tool/src-verify.c to also check the manifest.uuid file.
FossilOrigin-Name: a39a569482a35610fdaa2fdfc88491d8b456dfedb4786c817e0502eb3e3a5563
2023-06-04 22:56:31 +00:00
drh
63329ce6c7 Add a prototype implementation for the "verify-source" Makefile target.
FossilOrigin-Name: ed876ff6a1a6a2d555f32b96eb78d95eaf8428ee189f968c43f0829a3065bfa7
2023-06-04 22:41:52 +00:00
drh
b3d7f1c2db Prototype implementation of the octet_length() SQL function.
FossilOrigin-Name: 2db989c8635f7e89b3ea58d1fde94787fced039ac1a118d9b6362811eda73f87
2023-06-03 11:22:30 +00:00
larrybr
f1967a7018 Clarify sqlite3_is_interrupted() return. No code change.
FossilOrigin-Name: b6c2d3d203100a34335aeba23a8fb82a13297b65eed494d5044ade3bed683bc3
2023-06-02 21:31:15 +00:00
drh
038158e94a Restore the LEFT JOIN strength reduction that was partially lost in
[d747afda5683ca5f] when strength reduction was generalized to all OUTER JOINs.

FossilOrigin-Name: 2d962b84dd8ac2d0968f0283f8f082c1c2a7a1f99b59053b2ad8f58745396447
2023-06-02 18:05:54 +00:00
larrybr
a3f943942c Do that last CLI fix more simply, using established means.
FossilOrigin-Name: a1823b297616bc2bd64eda9df4850fb460d8da8959ae3728195db896d1f89e7b
2023-06-02 13:31:12 +00:00
larrybr
4e8a0eb4e7 Fix CLI fault on missing -nonce reported by [forum:/info/f8c14a1134|forum post f8c14a1134].
FossilOrigin-Name: cd24178bbaad4a1dafc3848e7d74240f90030160b5c43c93e1e0e11b073c2df5
2023-06-02 12:56:32 +00:00
drh
4ffcce88ad Fix the OUTER JOIN strength reduction theorem prover's handling of the CASE
operator.

FossilOrigin-Name: 73d7b14b1713d93c4ae07995e9aa6485cbad90bd6125584dbaeccb0cc9410ea3
2023-06-02 00:03:28 +00:00
drh
179c32cb57 Generalize the LEFT JOIN strength reduction optimization so that it works for
RIGHT and FULL JOIN as well.  Rename it to the "OUTER JOIN strength reduction"
optimization.

FossilOrigin-Name: d747afda5683ca5feb92866a14ccc4c5127d3378ece5cad2c3da819f2477b457
2023-06-01 20:38:22 +00:00
drh
39a7a1a9be If the filename argument to sqlite3_load_extension() is an empty string, then
raise an error.  It turns out that if dlopen() is called with an empty
filename, it tries to load the current executable.  And then if the caller
requests some other function from the current executable, mischief can result.

FossilOrigin-Name: d01688554715eb4aaa1b1fd1a6b660b84e930edb0e062156ecf5228ee81ca754
2023-06-01 16:40:28 +00:00
drh
f96148c4c6 Add an ALWAYS() on an unreachable branch.
FossilOrigin-Name: a00928d48061c1169d5564996e19e7d7c2b962842100bb119846d0f696123c23
2023-06-01 00:28:11 +00:00
drh
e411b69537 Fix the LEFT JOIN strength reduction for IN operators in the WHERE clause.
Further simplifications and refinement of the algorithm.

FossilOrigin-Name: 96c72dde79d4069f6c2f81467a35b617633f86f7a7dcafbda991affdaa1f8537
2023-06-01 00:01:20 +00:00
drh
d8cf688469 Add a comment to explain why both sides of an AND must be non-null-row in order
for the overall expression to be non-null-row.  No code changes.

FossilOrigin-Name: 8396032ce14a75f408f0a75bcb36a6504d5188f20886e275746a2c336a74296f
2023-05-31 18:52:46 +00:00
drh
29e70da4a4 Improved detection of when the LEFT JOIN strength reduction optimization
can be applied.

FossilOrigin-Name: f544a8e47cdd5ad7233887a558489983f4f305a39391ff463c43e2e4157da087
2023-05-31 18:35:12 +00:00
drh
d3b54d624f Minor enhancement to the sqlite3_trace_v2() documentation. No code
changes.

FossilOrigin-Name: fba97230e38276f2a02fc24353c3d911dfa24f3a4f75f691de9461d4daf3ae54
2023-05-31 12:42:09 +00:00
dan
d8091fe979 Fix a problem causing an infinite loop in the recovery extension when processing a corrupt free-block list.
FossilOrigin-Name: 5a516c6c7a25cec4d0a0cca530017a3299f7a332319f3e1f7cf12f53c32b88ca
2023-05-31 11:03:17 +00:00
drh
8eb9c06e65 Enhancements to date/time functions:
(1) Add support for time-shift modifiers of the form (+|-)YYYY-MM-DD HH:MM:SS.SSS
(2) Add the timediff(A,B) SQL function that returns the time-shift modifier
sufficient to move B to A.

FossilOrigin-Name: 574bf370b0b9a72eb0468e0e121d4d6171fc533883b66d335f6794ef5ee1f051
2023-05-30 16:40:42 +00:00
drh
7d65f1bec0 Simplifications to the new timediff() logic.
FossilOrigin-Name: d6954259bd3f8475f3804fd02a1591d037efa9df54da45776863c024ff90e596
2023-05-30 14:46:30 +00:00
stephan
73d806dc1f Minor tweak to the OPFS async proxy to attempt to account for a spurious high-load console error message which was reported via the sqlite-wasm npm project.
FossilOrigin-Name: a61467d1fbb7a2804bfdc685a38e0b738747b9afd42c25a78a938b114a822f61
2023-05-30 14:10:28 +00:00
stephan
e32fef1400 Minor internal JS doc fix. No code changes.
FossilOrigin-Name: 68abee3c1bf4e9ff632fccaa6ac7c5c4cdf55c4ff1749830ae3bd5ff6d55ebb2
2023-05-30 13:27:57 +00:00
drh
cc4bfd9623 New test cases for the timediff enhancements.
FossilOrigin-Name: f14633ce6ddf28a14b03e2da623d96e439966aa3fc30c26cb0be59c0e15b3e9c
2023-05-30 11:51:45 +00:00
drh
30bb082d3a All date/time modifiers of the form (+/-)YYYY-MM-DD without the following
HH:MM:SS.SSS.

FossilOrigin-Name: fa9237a8ab803ca3f67fe753516b7bdb98be3d625e8e241ddf9b02509210e225
2023-05-30 11:13:56 +00:00
drh
36a5f1e90c Problems fixed. All tests are passing now.
FossilOrigin-Name: cff293b0a79107def7bfe54fd60ac4a721c5098c85229d9b46a4e2c4cbf34a6a
2023-05-30 02:50:32 +00:00
drh
6abbef89e6 Improvements to the timediff() function. Test cases added. Not all test
cases are passing.

FossilOrigin-Name: 2cf6518140d61e2123dc20f39d7e97e7bce17e7641405df7fd63e1cdda444ae0
2023-05-30 02:16:33 +00:00
drh
1936a1933c New date/time modifier: (+|-)YYYY-MM-DD HH:MM(:SS.SSS)?
FossilOrigin-Name: 3832b8a9ef84d9b53b48dfce9c1e724897cd7b3e05711e01675419655f894eac
2023-05-29 20:33:33 +00:00
drh
0cbc2143b9 Prototype implementation of a proposed "timediff(X,Y)" SQL function.
FossilOrigin-Name: 054a195125a273bab026ada5f07cc7c32818007027a1fd028ca59d2f179276d4
2023-05-29 18:01:42 +00:00
drh
4308b88dcd Fix an issue with sqldiff reported by
[forum:/info/9bd2155bdfae25a7|forum post 9bd2155bdfae25a7].

FossilOrigin-Name: 736a79c1491065f4ee77ce644af0e529e555ca733c78dbd55487d55d4ddbe5bd
2023-05-27 20:08:23 +00:00
dan
870fe69c72 Add extra tests for fts5, large rowids and "ORDER BY rowid DESC". No changes to code.
FossilOrigin-Name: b5b5eaeed3ef55415e27aa04561ab446f3be881b56b7cbf9b8ba3307f0b2bf69
2023-05-27 19:34:46 +00:00
stephan
39bd6a0d46 Add ability for the JS Worker1.exec() API to report the number of changes made to the caller, per request in [forum:d0b19483642e20dd | forum post d0b19483642e20dd].
FossilOrigin-Name: 6e79505df915612b60696e4eec5c9973175fe6ecf273eb3152b996e63ae54a07
2023-05-25 16:49:06 +00:00
stephan
4e8e33ba84 Minor cleanups in demo JS code, per forum feedback.
FossilOrigin-Name: 80c7c0360c08bea0733deccb8071920c60558b75df76b6afad093c82adf30ea6
2023-05-23 19:11:42 +00:00
dan
583a5cf5d2 Avoid performing aggregate processing more than once for a single expression. [forum:/info/36ff78b2a3|Forum post 36ff78b2a3].
FossilOrigin-Name: 367b4cc549a14222d54530538e692e9d1a365002c1b8c4ef80ddc0523bfdb3a2
2023-05-23 17:35:18 +00:00
drh
ddf6b27579 When converting an aggregate expression to AGG_COLUMN, be sure to remove
the EP_Unlikely flag if it is present.
[forum:/info/fbfe330a2009d036|Forum post fbfe330a2009d036].

FossilOrigin-Name: 48e65f18b2ebbe786e84e208f2c6c68de6067ba86912fea5a120fd41d0af2184
2023-05-23 15:16:20 +00:00
dan
3195b88b79 Fix a buffer overread in the recovery extension that might occur on 32-bit platforms.
FossilOrigin-Name: ff4a9a2b59657116da99c748ada19dbc64b7d0fd4c920e1c517d8bda3466f06b
2023-05-23 14:05:02 +00:00
dan
9d31508a54 Add test cases for the recovery extension. No changes to code.
FossilOrigin-Name: cec49c7d93362f527f0b4744cd1ae95d44a79671d49d69baa77fda70be29f7e8
2023-05-23 11:47:56 +00:00
larrybr
d294792d1a Avoid duplicate WIN32_LEAN_AND_MEAN #define. Fix a trivial nit likely never observed.
FossilOrigin-Name: 81ffcf41d69ae73ee8c037f675e18e2b46a15bee34062914640456381262d6fc
2023-05-22 20:36:55 +00:00
drh
0503cd6d11 When a floating-point RTREE is presented with large integer constraints -
integers that are too big to be represented exactly by a float - then take
extra steps to ensure that all possibly relevant entries in the RTREE are
returned, even in boundary cases.  Fix for the problem identified by
[forum:/forumpost/da70ee0d0d|forum post da70ee0d0d].

FossilOrigin-Name: bfd8d9100015f3e3fb011698963d670bd89b64ec8a8ab931e0c6c3076b029377
2023-05-22 16:35:21 +00:00
dan
b838a229be Fix a buffer overrun that could occur in fts5 when processing corrupt records.
FossilOrigin-Name: 4891dbd938f4bfd345eaef01f2addea9512eaa98f860844c73abb907b6a8e0e8
2023-05-22 11:02:15 +00:00
stephan
a6ab50bc42 Extend detection of the INSERT...RETURNING locking case to the DB.selectValue(s)/selectArray/selectObject() family of functions. Add tests for INSERT/UPDATE...RETURNING with those functions.
FossilOrigin-Name: 3181c50540df0eff6cb5db79bb477c469bb7b73b0692260ba600db200fcef4ac
2023-05-19 18:23:53 +00:00
stephan
02be13cea6 Minor doc typo fix.
FossilOrigin-Name: 4533be08786306a4fcb4b21458444dffd0fa2764ebb2538313f3a16d9324cacc
2023-05-19 17:59:21 +00:00
stephan
a382d236da oo1.Stmt.finalize() no longer throws, but instead returns the same as the C API. oo1.DB.exec() now triggers the INSERT...RETURNING locking failure as an exception via reset() instead of finalize(). Some code-adjacent internal API renaming for clarity's sake.
FossilOrigin-Name: 4ee6b3aa531b980acea4c4b58ee256e765c5105100468928def3d4c9825fa9bc
2023-05-19 17:50:16 +00:00
drh
fe19414331 Improved documentation for sqlite3_reset(), in response to
[forum:/forumpost/a72bab3dea|forum post a72bab3dea].

FossilOrigin-Name: 1dfeb3dceee8f30daf5462683f264b9de23e7068e036e70b11ee1b608ac2f7fa
2023-05-19 16:42:49 +00:00
stephan
7fe416fae1 sqlite3.oo1.Stmt.reset() now throws if sqlite3_reset() returns non-zero, analog to [f23eb5c6d365].
FossilOrigin-Name: 487ae12c9a21e5862bd590bbb1030c39734657d52136cf67b98c7545e6ecbe1c
2023-05-19 16:34:56 +00:00
stephan
416aeb16ee Add a basic INSERT RETURNING test for the oo1.DB.exec() API.
FossilOrigin-Name: d29d62cf7658aeb49f3c8a5d0b0809d945ebc9b79379a255eb88f771d2a2c430
2023-05-19 16:12:06 +00:00
stephan
2492b6c0fb sqlite3.oo1.Stmt.finalize() now throws if sqlite3_finalize() returns non-zero. This is intended to address the INSERT RETURNING case covered in [forum:36f7a2e7494897df|forum post 36f7a2e7494897df].
FossilOrigin-Name: f23eb5c6d36546ee1e181a03660e0b2dc8005bba24bee8bae594b0c78bd152cd
2023-05-19 15:54:41 +00:00
stephan
8e2fd6eae3 Correct typo in an 'extern' decl name, reported in [forum:1d4342156439233b|forum post 1d4342156439233b].
FossilOrigin-Name: 6ac18827d8c5be35442dc452af703023c759916c179f165c4e54b3e430a8f7b0
2023-05-19 12:41:14 +00:00
drh
1cb4e2e196 Change the RTREE engine so that equality comparisons of floating point
values are duplicated in the byte-code so that the comparisons are done
using 64-bit floats and consistent results are always obtained.
[forum:/forumpost/da61c4a1b5b4af19|Forum post da61c4a1b5b4af19].

FossilOrigin-Name: 4ec0f0a31b0df93ad15545fe1db117c933e28c75ad3cbc8475b56fecdb084905
2023-05-19 11:48:05 +00:00
drh
2c6c98dbf0 Fix incorrect b-tree root page reports from the enhanced PRAGMA integrity_check
output introduced in version 3.42.0.

FossilOrigin-Name: 9b538f62539bcde7d7d7ad06eccdc558ecbd3f9160db35197568f4d3b4247c76
2023-05-18 23:25:48 +00:00
drh
a03be7987b Fast-path the btree transaction start for the common case where a
transaction is already active.

FossilOrigin-Name: 798c3ff20c606b5f9fde16dc67781f238370a7c450bc239c3a98d0f4ca370399
2023-05-17 19:23:24 +00:00
drh
653882ed8c Simplification, performance improvement, and size reduction in the
codeAllEqualityTerms() function of the code generator.

FossilOrigin-Name: 4fbe02651e877e442d62308d7f607e503695104cd71c5565132fcd1398c120df
2023-05-17 16:13:48 +00:00
drh
60fd5c34ab New assert() statements to verify that Expr.iColumn is never used as an
array index when its value is negative.

FossilOrigin-Name: 6084c5fb6d3fcedf35cd6c597a44ec7bf8b4a2576c7b277e5342d2a7905318e7
2023-05-17 15:46:46 +00:00
drh
9c9b33cbaf Improved assertions on substExpr().
FossilOrigin-Name: 6dbd5b3cc801a75ea23842a43eb7106b62fc1d26dd5a8477a0217325539a7c1a
2023-05-17 13:21:45 +00:00
dan
32a5feb53e Avoid an assert() failure that could occur in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds when a WITH clause attached to an UPDATE or DELETE statement created a CTE of the same name as the table being modified.
FossilOrigin-Name: 8edf56d1698c3db38250db3b25864f658488414efb3a6b3e1443283b6affd26d
2023-05-17 11:31:51 +00:00
drh
010bd47b98 Fix two assert() statements that failed to take into account
the likely() built-in function.  This does not impact production code.

FossilOrigin-Name: 8504fe812c5b4956c8acad515d537add54cb591bc81747113f9b24526d7685b8
2023-05-17 00:26:50 +00:00
drh
ea1b2fa034 Increase the version number to 3.43.0 in order to begin the next
development cycle.

FossilOrigin-Name: 7874023cd460cbe05401433b8e695a77955e2c055c360a93b92d4ce6937bd136
2023-05-16 14:20:04 +00:00
stephan
73ab708b5c Resolve the JS-side corner case reported in [forum:7774b773937cbe0a | forum post 7774b773937cbe0a] by not caching oo1.Stmt.columnCount.
FossilOrigin-Name: 37d44e8c447626738a8a7f915a9bc3f35fbb95581236dd152fc119b0c3a24c2a
2023-05-16 14:18:48 +00:00
drh
89efa89778 Version 3.42.0
FossilOrigin-Name: 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0
2023-05-16 12:36:15 +00:00
drh
89caab8147 Update the tool/mkmsvcmin.tcl script so that it prints a one-line message
to explain what it has done.

FossilOrigin-Name: 4254f086419892634c80b0b915e14edea365adc6a45bcc75eecba889da274ac3
2023-05-16 12:34:26 +00:00
drh
e680b6dcf7 Fix a C++-style variable declaration in the generate_series() extension.
FossilOrigin-Name: 1d3e008905461ebbd3ea0a862672f740fa72914d4d59fcf800e1ce56f1edfc9d
2023-05-15 19:17:31 +00:00
dan
aeb064c069 Limit the number of nested NOT nodes in an fts5 expression to 256.
FossilOrigin-Name: 01219e69b430c8f5fea5ab6ce511ba8c9b4c9b32b6d2d36623dde99c3d3812c9
2023-05-15 17:24:48 +00:00
drh
ff4e771c0f Increase the stack size available to fuzzcheck to 8MB on Windows.
FossilOrigin-Name: 2290dc6876041bcc982f162f59fdc9fd98b0983e1058c0a33fd46937ecc4bd84
2023-05-15 17:20:21 +00:00
dan
4042d2b424 Limit the number of nested NOT nodes in an fts5 expression to 256.
FossilOrigin-Name: 0e5c1ee40a146ef8b2b3c5f53d0a45e092bc8d8e933f3819805c995819d31bae
2023-05-15 17:14:16 +00:00
drh
307db965c6 Add the --wait command-line option to fuzzcheck.
FossilOrigin-Name: 5a479a2c7637a018d1828d9d37973bf3d36a2fc4cd5b752bca61a41cd0920d39
2023-05-15 10:55:04 +00:00
larrybr
b579db6d5c Make generate_series() correct on ones complement ALUs and acceptable to UBSAN.
FossilOrigin-Name: 4c5cd3e6968c44749b7663beee790969b41d247b9201b771ef90cbb03d09108f
2023-05-15 03:48:48 +00:00
drh
eb4455e4e4 As evidenced by [forum:/forumpost/f3f546025a|forum post f3f546025a], the
new RIGHT JOIN related restriction on the push-down optimization implemented
by [da3fba18742b6e0b] also needs to apply to the automatic index
(a.k.a. hash-join) optimization and to the Bloom filter optimization.
Computation of the restriction is now
moved into the sqlite3ExprIsSingleTableConstraint() routine.

FossilOrigin-Name: 4902015dcf3869f08d9986e422faa231d9218a5e0fc59ba8df0f407e4eb3d605
2023-05-15 02:06:35 +00:00
drh
fa746af4a3 Simplify the interface to constructAutomaticIndex().
FossilOrigin-Name: c5da16551619718bf649c517515261706843e11e131f0b99e1fd6927d0f7e238
2023-05-15 01:02:50 +00:00
dan
b8d689b666 Fix windows-specific problems in test scripts sessionnoop2.test and sessionrowid.test.
FossilOrigin-Name: e4989c111ddffe6818cbb88a72bd027b30124d1e8de0cce4109c72a214ffb5b8
2023-05-13 20:01:27 +00:00
dan
5e65cd1caa Remove unnecessary call to sqlite3_dbdata_init() from shell.c.
FossilOrigin-Name: 84ca2000007d217f911a3b1586143fc9261c0697a9e9fadda6bd3dd6afdfb099
2023-05-13 19:38:30 +00:00
dan
fd0791587b Add an "#ifndef SQLITE_HAVE_SQLITE3R" directive to shell.c.in, to avoid including the recovery code a second time if the shell is being compiled with sqlite3r.c.
FossilOrigin-Name: 6f1a60fb7b3ef463b4131dfecbc72b7c778c794a9aa13ce4617ab6dd895508b2
2023-05-13 19:13:40 +00:00
larrybr
ea51c09a8b Mention that sqlite3_mutex_free() accepts NULL as a no-op.
FossilOrigin-Name: 603d9ad5012ca8996783996d7b8cd6a1aabf12b21604a2ccc137f4c2d99427b9
2023-05-13 15:34:15 +00:00
mistachkin
273c2a9425 Fix compilation issue seen with MSVC.
FossilOrigin-Name: 67001887044da71ab50c07d8345bd950a0a1f9688cf9cd6966312ea163cf6e17
2023-05-13 05:13:29 +00:00
drh
59b6a2bcbe Fix harmless compiler warning caused by [0772ddf56713d013].
FossilOrigin-Name: f06c16a8b0e7a15ce4f7d99af3376a1bf1bfbfc0fdc048b079418ae74c619d6b
2023-05-12 19:06:00 +00:00
dan
83be5586a0 Add multi-threaded test for "INSERT ... RETURNING ..." and SQLITE_BUSY errors.
FossilOrigin-Name: 559cb1c6de384fd14160db005acaf1858b8b018d3d40d7f786a56a49d3cdbd59
2023-05-12 19:02:50 +00:00
drh
4f3dc93978 Make the regexp extension more robust against OOM errors during compilation
of the recognizer engine.
[forum:/forumpost/f50aecd5e8|Forum post f50aecd5e8].

FossilOrigin-Name: 0772ddf56713d013cd1bd44f9c75977ca14f852e3a8f038b0a6b9814f6519d79
2023-05-12 15:45:34 +00:00
larrybr
fb74019a14 Fix unlikely strange result of CLI edit().
FossilOrigin-Name: ab3797e844c97fed344b36f30cfb788aca9e0d68c574fb833712219eb712db44
2023-05-12 14:51:00 +00:00
drh
69bc8c70f9 Ensure the _O_U16TEXT is defined for Windows builds of the CLI.
[forum:/forumpost/c80aa942dc6bf2|Forum post c80aa942dc6bf2].

FossilOrigin-Name: 504effa89b48c0dc6cd12b3eaf6017be3f32017c601af17759a3cc185346d868
2023-05-12 13:20:57 +00:00
drh
26a3e56649 Remove a stray CR from end of line in a source file.
FossilOrigin-Name: 48139fb904de4b7b383e7f8c29bed83ad878eb22b1dd773c366a0aee74613d23
2023-05-12 12:57:44 +00:00
drh
61791c6f4c Fix harmless typos in comments.
FossilOrigin-Name: 607c3efbe0293d7c11a955a9f21e24fb9f7f1bb758e13e60f4ba0cc0ac8b900c
2023-05-12 12:45:56 +00:00
drh
6b429dc11b Ensure that all prepared statements are expired and forced to reprepare
whenever the database text encoding changes.
[forum:/forumpost/43cbfc4d23|Forum post 43cbfc4d23].

FossilOrigin-Name: 469718f106e1cfa7f8f4714a9e743108c361af81e0258061c2b76880a7c352ae
2023-05-12 10:52:12 +00:00
drh
78b404d976 Add [/info/cec6a06508239c09e363?ln=5525-5531|restriction (5)] to the
omit-noop-join optimization.  Fix for the issue reported by
[forum/forumpost/49f2c7f690|forum post 49f2c7f690].

FossilOrigin-Name: 3e9c9bbdb59b9d500ff218db538c047c83da7ac18ebb95c3ee7629ab15e0b43a
2023-05-11 21:15:55 +00:00
drh
5ca40d84ad Fix a minor typo in a comment. No code changes.
FossilOrigin-Name: 607cfb5bc5c0fb8b789944c2326cfdebf0629e45fbf0a61dd5f667ed685a1bbe
2023-05-11 18:03:11 +00:00
dan
418d212308 Fix the rbu_exclusive_checkpoint=1 option so that it works with a zipvfs database in pass-through mode.
FossilOrigin-Name: caca67d30670913914335aa3edff784e1c3d26aed70ae32efb5607ccf31ad142
2023-05-11 17:25:14 +00:00
stephan
0c7bcf4c0e Doc typo fix. No code changes.
FossilOrigin-Name: e841b142f583e49350c7cdd14dc4da72434cc67c7b521ae741e03e37e785d7e0
2023-05-10 21:08:01 +00:00
stephan
161f742856 Resolve the JS-side corner case reported in [forum:7774b773937cbe0a | forum post 7774b773937cbe0a] by not caching oo1.Stmt.columnCount.
FossilOrigin-Name: c3d25c3a25e79e01c4ad0cf11f7dc3b0fb1932f3bcd04935a728ef62f7e07cf1
2023-05-10 21:06:02 +00:00
drh
28f4e7b286 Enhance the split-sqlite3c.tcl script so that it uses single-character
extensions on subordinate source files, even when the number of subordinates
exceeds 9.  This is not yet needed, but might be soon.

FossilOrigin-Name: 4150e416263f24efcbfe68d5b1e15ec7e79df41dff0b6dfdc59f06ee9e205049
2023-05-10 16:04:04 +00:00
drh
0051a56dec Fix harmless compiler warnings from the CBMC compiler.
FossilOrigin-Name: 5bc17cbccdd369486fca049be9d7457e18f162c0e2f5475809ffc8f01c5fa9d2
2023-05-10 13:56:32 +00:00
drh
5af043c2e7 Rename sqlite3IsTableConstraint() to sqlite3IsSingleTableConstraint() and
improve its header comment, in an attempt to make the code easier to reason
about.  No functional changes - should generate identical machine code.

FossilOrigin-Name: 5dae897431a0a9dbb354c4a8a48f935ea7438035d96f90b83dd81eae434c8277
2023-05-10 11:05:59 +00:00
drh
d733ee5cca Add a missing comma to the documentation for the OP_Jump opcode. No changes
to code.

FossilOrigin-Name: 7e2c2b1cee760af68cf303ce9ec1babbaf607fe54e043893c046d2d37cd0ab46
2023-05-10 10:03:28 +00:00
drh
88a99437b9 New restriction on the push-down optimization to prevent an ON or USING clause
on the left side of a RIGHT JOIN from being pushed down into a subquery that
is on the right side of that RIGHT JOIN.
[forum:/forumpost/a7d4be7fb6|Forum post a7d4be7fb6].
Also add comments to describe previously undocumented push-down optimization
restrictions.

FossilOrigin-Name: da3fba18742b6e0bd5290bee9d86a2d5cb1ff2de25d737ef93060d7c1143273f
2023-05-10 00:33:21 +00:00
larrybr
5fbb2adf7d Fix bug in fall-back logic of CLI .clone
FossilOrigin-Name: 0dcd9785c11e33e6393b7c1be1ff8fe7129f280439aed12de22d4687609a8bac
2023-05-10 00:20:42 +00:00
dan
d9be387361 Fix recover1.test so that it works with DEFAULT_AUTOVACUUM builds.
FossilOrigin-Name: 4ffae48e831eedf8f5e61dc6d38817c0fdccfb2f4f1189d07f9722b9e3a48b5e
2023-05-08 16:26:22 +00:00
drh
bbd0ae2e87 Improved error handling when ".open" fails in the CLI.
FossilOrigin-Name: 38544b11f0e19cc6c6f8230a89d28e36c7c3587481deaac6cedbf82338ca0d47
2023-05-08 13:47:38 +00:00
drh
addc7e0e5b In editPage(), if an attempt is made to edit an empty 64KB page, then take
the slow path through rebuildPage(), in order to maintain strict invariants
in the editPage() code.
[forum:/forumpost/0f37727c0d|Forum post 0f37727c0d].

FossilOrigin-Name: a865e574e510c1ca192d0bd5293fb583def90f7ed086af2c89ca856ce93d115b
2023-05-08 13:38:14 +00:00
drh
c42bbfc550 Ensure that the label for a JSON object really is a string and not an array
or object that just happens to end with a string.
dbsqfuzz 32f62ed8676d0a153dbe756aeae3202d3670fe50.

FossilOrigin-Name: c335737c2889722ea05b732a5efff8a2f31140c18ca038c41e05c2a26e0db5bd
2023-05-08 11:11:08 +00:00
dan
6d841fdc89 Add tests for recovering data to a lost-and-found table from a utf-16 db. No code changes.
FossilOrigin-Name: 832f6e9f797eecb9a3dae4e7e20c70eda1e91372e9d3ce4223d57f26582cdbd2
2023-05-08 10:51:35 +00:00
drh
28f32bedd1 It turns out that pagerExclusiveLock() can be called with the lock state
already set to RESERVED if the SQLITE_FCNTL_PERSIST_WAL setting is set and
a specific sequence of multiple journal mode changes occur.
Enhance pagerExclusiveLock() to deal with this.
[forum:/forumpost/8130545bc6|Forum post 8130545bc6]

FossilOrigin-Name: 2bb8d977392f635515aa4a36f6f763a2e4858f7adc1120519e2e74c04a9749b5
2023-05-07 03:23:32 +00:00
drh
4e73863fd4 Fix a comment in the JSON logic. No code changes.
FossilOrigin-Name: 3f30ea5ec9d849c64d8c38f4fffbc06c749ecff91ab90bc29b3a3cc9ec5b9df0
2023-05-05 20:22:06 +00:00
dan
77eb3e305c Fix a buffer overrun that could occur when using the format() function to format a very small real value with the "," modifier.
FossilOrigin-Name: 910e770ad4d8e8e45bf069af963f2e975bfcfb882578dc5fe714cd2396258934
2023-05-05 19:36:13 +00:00
dan
ed96436f23 Reduce the maximum depth of nesting in json objects to 1000.
FossilOrigin-Name: c7697a0d45bfab20ec09f17ad65e375ddb43af6762278481c13a65c9a784978e
2023-05-05 15:52:44 +00:00
dan
3e49355e17 Do not attempt to run json502.test with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 6664850647cd314c076842df5bf94e4f12d9be7fb56795b2af25f15c1267fa4d
2023-05-05 15:28:35 +00:00
drh
e030619109 Updates to compile-time option usage and especially to the compile-time option
test script in tool/omittest.tcl.

FossilOrigin-Name: fece588b186c4f9f76d626313e35336fd5681e966e9bd0fa1053b147c4e3c315
2023-05-05 14:16:31 +00:00
drh
fb18d81038 Fix the pager2-3.1 test case so that it does not run if a required
dependence (shared-cache) is omitted from the build.  Fix for
[forum:/forumpost/7a028538a7|forum post 7a028538a7].

FossilOrigin-Name: a77c8a780f884d0cb01d20912cf1aeec0bb7f3999d23117fe5bd82bc4405d483
2023-05-05 14:14:10 +00:00
dan
cad6aae45e Allow virtual tables to prepare writes to shadow tables in defensive mode from with xRelease() callbacks - even if the xRelease() is invoked from within sqlite3_finalize().
FossilOrigin-Name: a17106494a8a67bc92cfe27ee8ef9bf160517d6930d796980ae12287b98c1cfe
2023-05-05 11:47:31 +00:00
drh
0498caec89 Improved formatting of comments on SQLITE_CONFIG_xxx defines as those
comments are used by documentation.

FossilOrigin-Name: 2cb840bc9df81f76699f742e5db03835f4c272548cca0e6d24412503db3d76b3
2023-05-05 11:33:59 +00:00
drh
d2bef86709 Add the "subsecond" modifier to the date/time functions.
FossilOrigin-Name: 6fcb5a941fba0449d017954590bde7da74e5a1f8fd9b3e1febdff9bed1f22051
2023-05-04 20:28:19 +00:00
larrybr
88813681c2 Add some tests of subsecond modifier for date/time functions. Sync with trunk.
FossilOrigin-Name: 6499ebff545e663198bd0534be205a4e9ca68c7fb20fdcfa54fae4d9b79bfe3a
2023-05-04 20:19:33 +00:00
drh
6242c9386f Enhance the format() function so that the "," modifier works for floating
point numbers in addition to integers.

FossilOrigin-Name: 83683e108bce83c105bbcce1aa62880d8f14ebf3383d87d83a1e5c85026a7817
2023-05-04 14:44:53 +00:00
drh
e8468098a0 Add support for the comma (,) modifier to %f formats in the format() function.
FossilOrigin-Name: 7080e196a1f887640ff51ddc508ec6796ce12874c2944855702753b64a8e5e50
2023-05-04 13:07:49 +00:00
drh
c1e40a3a02 Fix a bug in cursor hints that can cause references to tables that have not
been opened.  Cursor hints are intended for use by COMDB2 only and should not
appear in production builds, so this should not be a factor for the vast
majority of users.

FossilOrigin-Name: d3370d59cffb7ab982d6c620c93d22aa6a9dc786e1c4af95ca8d45ff0b9b7d6f
2023-05-04 11:29:15 +00:00
drh
62b28db5c7 Add another assert() to FTS5 to demonstrate that a pointer is never NULL.
FossilOrigin-Name: b8a84a1bf53fa07ef01c57c6db6329ba439774a262b3adcbe94e7bd77525e296
2023-05-03 14:10:05 +00:00
dan
3f23eb6813 Add an assert() to fts5_config to ensure that a potential OOM is being handled correctly.
FossilOrigin-Name: fe9c207657400f9d9f4e822eb658157bc147ed538e2701322f6f973933f023ed
2023-05-03 13:57:57 +00:00
drh
3442306989 Protect a macro argument with parentheses in FTS5.
FossilOrigin-Name: bc07fe51fe0c6bb50ca8ae1baefcc35c8f5395b2d0de641bf0b0cedc92d754d4
2023-05-03 13:48:33 +00:00
drh
dda2833a4e Add a comment to the [0512f82a2cde7447] change to link it to its TH3 test case.
FossilOrigin-Name: 1281d4d9d799ef83e6eb51d656ede82b4503d39adf169deb936b30ebfddd88b1
2023-05-03 13:33:37 +00:00
drh
69e2422973 Enhancement to showwal such that it shows what the page hash should be
on a hash mismatch.

FossilOrigin-Name: 960dc97083ed9a7bfa912010b9ea19114f51dd10e73d5c5bf06cc642ebd1a2e7
2023-05-03 13:03:30 +00:00
larrybr
6539977cfd Conform CLI double-quoted escaping to what its doc says.
FossilOrigin-Name: 910535ba518f35ecc64c980ad67e3af69008d1995235f52ab12db6cefdb6602b
2023-05-03 11:27:15 +00:00
drh
b4824b055c In the zipfile extension, leave the catalog list in a consistent state when
the last entry is removed from the list.
[forum:/info/f03f1e4c5a5c9959|forum post f03f1e4c5a5c9959].

FossilOrigin-Name: 1b489d008b7bda12f9bf92e246bc613ef61e9c74ace0652d6d088e5a6e0696f6
2023-05-03 07:30:15 +00:00
drh
ce2aa8bebe If the page size is wrong on the page1 content inside a WAL file, then
running VACUUM could trigger an assert().  This check-in changes that assert()
into a branch that returns SQLITE_CORRUPT.
[forum:/info/4ef9b37d74d2d2e8|Forum post 4ef9b37d74d2d2e8]

FossilOrigin-Name: 0512f82a2cde7447cb348d9fd620f39f2f0e359141903cde20f7ba30b5d34af3
2023-05-03 06:48:08 +00:00
drh
681307dc80 Improved detection of excess recursion on arrays and objects in the JSON
parser.  Fixes a problem detected by dbsqlfuzz.

FossilOrigin-Name: d40fd5924adaa8d6b1dd6b9a4087f64d496cf60096ae11c9229c59309c0d4844
2023-05-03 06:38:03 +00:00
drh
790adfd8ec Do not overflow the Index.aSample[] array if the same index appears in
the sqlite_stat4 table under multiple names because it is a WITHOUT ROWID
primary key index.  [forum:/info/537d8ab118df7edd|Forum post 537d8ab118df7edd]

FossilOrigin-Name: 9350a25ac0b55a6b901bc50e4db6d4e883c2617e1d2a8fdc90effabe52bb0012
2023-05-03 05:00:10 +00:00
drh
8777bdb78a Do not even attempt to load the sqlite_stat4 table if the use of STAT4 is
disabled using sqlite3_test_control().

FossilOrigin-Name: 0bf94c77d97582be5368bcfd149f3db7b9f928b4684aaa2626d98a2bdee8f96f
2023-05-03 04:21:31 +00:00
larrybr
164b332d80 Fix CLI mishandling of OOM during .import _of_ a DB. [forum:7ed4a250d3|Reported by forum post 7ed4a250d3].
FossilOrigin-Name: 30da3f0ebd944754881bce678c61289fdaf1e32198d241cc6b5c003e4fb33c0e
2023-05-03 02:32:42 +00:00
drh
b504623802 In the CLI, ensure that the argument to quoteChar() is not a NULL pointer
due to a prior OOM.

FossilOrigin-Name: 776d1a47aae3c3679a2d158595e84facf118adf2d1bca0f0642311dd346479b8
2023-05-03 01:25:37 +00:00
dan
9cf09b5672 Fix a problem with the sqlite3changeset_size() API and rowid tables.
FossilOrigin-Name: 92ade220dcf5c1b76a5db605b1467a01051271957cd26f790755904fd82772eb
2023-05-02 20:34:15 +00:00
larrybr
d8200de04d Give CLI quoted args hex escapes (as documented.)
FossilOrigin-Name: 90e434a6ae370a35109802fc336b98298d345f3d23125ef2cc68c31d8e69bb50
2023-05-02 19:33:27 +00:00
larrybr
8594f02c5d Cure CLI hang on .import with high-ASCII column separator.
FossilOrigin-Name: aac8ac631de5c5b439c48c13f5fd271d76c11b1a5fd0919dfe4506ef7725f5ab
2023-05-02 18:03:25 +00:00
drh
bdb40cb18f Allow for lower-case "nan" to mean NaN in JSON.
FossilOrigin-Name: 6bee0a19e2efb6e39097fb22602556791d3d3962c50a1a0471c39a0c61db632e
2023-05-02 17:33:34 +00:00
drh
d6b3a02d21 Interpret negative arguments to sqlite3_sleep() as zero.
FossilOrigin-Name: 2b542326aa8e7e1f6ed9d999b95ae5340278e0821277a17de3cc803b4af793ae
2023-05-02 16:34:15 +00:00
drh
8c79ea8447 Improved handling of NULL arguments to json_valid() and
json_error_position(). [forum:/forumpost/06c6334412|Forum post 06c6334412].

FossilOrigin-Name: ab78e6946ba8125a83ff155561adf9c8df4d1c09a645fce08c8245ddb08bfa3b
2023-05-02 11:12:01 +00:00
drh
67a17779cb Fix typo in comment. [forum:/forumpost/3da7d9c445|Forum post 3da7d9c445].
FossilOrigin-Name: 41a8a15c4b6f6157b12d43976e300763ef8a4963986d2806557ad0d8b0a784cd
2023-05-02 10:22:05 +00:00
drh
53ffe6e21d Minor code change in the CLI to make a UAF warning from scan-build go away.
FossilOrigin-Name: ad6aae768ad0816bfd1c8e9db5c0153226982d3af9a089f31e608223339e9829
2023-05-02 00:33:45 +00:00
drh
f9b58eb4f8 Fix harmless compiler warnings.
FossilOrigin-Name: 342af5b4fa0bd7c699e5497161db13d0cf795c7a5875ae30d666122e518f213b
2023-05-01 20:42:15 +00:00
drh
0f97dc28b0 The gcc definition of the SQLITE_INLINE macro is not compatible with
string ANSI, so disable it if the -std=c89 command-line option is used.

FossilOrigin-Name: 62d703d83cf8cf3358715792347c49315a82c659e475158e385746f4329a4f39
2023-05-01 20:09:52 +00:00
drh
1f02cd6cd6 Fix harmless compiler warnings in FTS5.
FossilOrigin-Name: f6210017b3143ccbaea23655852f947f779bb438ad4fbf582f5da42f7cd1d9f5
2023-05-01 19:59:10 +00:00
stephan
58d40363b9 Remove xFileControl() handling from the OPFS VFS altogether, re-routing all syncing through xSync() instead. This eliminates superfluous syncing introduced in [a371374148a2], as discussed in [forum:647d2f811dbc2dfe|forum thread 647d2f811dbc2dfe].
FossilOrigin-Name: f809de7f232c8c2731a877c7bf1ad39fda5b326b2e45e4748cab4dc5e5b535bd
2023-05-01 19:28:07 +00:00
drh
59fe13e39a Fix harmless compiler warnings.
FossilOrigin-Name: 0a926994691ccb02ea4f0ba3c2e8f728871ae67d24c705fbc0f7af81f38d5f47
2023-05-01 18:52:35 +00:00
drh
abdcfcef83 Add support for JSON5.
FossilOrigin-Name: f8c3ed23a6931b1da3b93b3274b132387078112a5c8e8d06b5312c47987d3937
2023-05-01 18:28:48 +00:00
dan
5ecee3dae3 Fix typos in comments in sqlite3session.h preventing documentation from being correctly generated.
FossilOrigin-Name: ab75170d5609c477613466e8880f20b74b0069281db6536fe09db06ea9d7cff3
2023-05-01 15:59:20 +00:00
drh
4cc6f869a4 New enhancements to the sqlite3_db_config() constants documentation.
FossilOrigin-Name: d74011a3c495719fe1816e15251269824396ac2a40e41f7b96f0dd507c9be609
2023-05-01 15:57:46 +00:00
stephan
043353483e Expose the SQLITE_DBCONFIG_STMT_SCANSTATUS and SQLITE_DBCONFIG_REVERSE_SCANORDER sqlite3_db_config() options to JS.
FossilOrigin-Name: 0a7024af3f0e1dddc1a60c67bc4084e46b297dc16fe753bd5e6a45a59fd1cfa4
2023-05-01 15:42:59 +00:00
stephan
d45bbbb05c Implement full xSync() for the OPFS VFS. The previous implementation was not correct for journal files. Reported in [forum:647d2f811dbc2dfe|forum post 647d2f811dbc2dfe].
FossilOrigin-Name: a371374148a2874be6e48890781aa5952229056b146a50fa4d035693341c5636
2023-05-01 15:15:11 +00:00
drh
b5fab68162 Fix typos in documentation comments in sqlite3.h.
FossilOrigin-Name: 6a8b00788e7911287a8287277eb603e983e3324c9d62de0889ce6f0b2d848f4a
2023-05-01 14:50:54 +00:00
drh
908dec7404 Do not apply the "AND false" optimization if either operand comes from the
ON clause of a join.  Fix for the problem identified by
[forum:/forumpost/96cd4a7e9e|forum post 96cd4a7e9e].

FossilOrigin-Name: d095da0e7a24e3bcab6495d964f76a86d7a5910d2d6edddc6e8092bfa6084fe6
2023-05-01 11:24:35 +00:00
drh
e210c93903 Fix abbreviated paths for objects such that they work even if the object
key begins with '$'.

FossilOrigin-Name: 1b991c78141a9915ae9350ecb347a758e50d7d25c8a0f4cc098ae10d47c27043
2023-05-01 03:56:48 +00:00
drh
5196d93505 Fix a problem with json_patch() when one side or the other is JSON5.
dbsqlfuzz bc10593a4ba8e7a7862593532285be31f00f8e41

FossilOrigin-Name: e18c0899cc774f6f20d2a73381fa3ab3af9355cf4d108c7612db259eadbb8b96
2023-04-30 23:52:55 +00:00
drh
dae7ae359e Accept the full ECMAScript 5.1 IdentifyName syntax for keys in objects.
FossilOrigin-Name: 9be2c87518b33713210e3e2fa56924888e19415c71329141d18150b275f6f25e
2023-04-30 20:37:49 +00:00
drh
4a398c317d All JSON to understand floating point literals "Inf" and "QNaN" and "SNaN" in
any case, without the SQLITE_EXTENDED_NAN_INF compile-time option.  This
extension is always available.

FossilOrigin-Name: fb551145e0d84213b3343dc1bc7db70c898b9dea24a72b968240617f4b52d821
2023-04-30 19:45:25 +00:00
drh
7be1473ccb Omit the json_valid() function. Change the name of json_error() to
json_error_position().  Use "NOT json_error_position(X)" as a substitute
for "json_valid5(X)".

FossilOrigin-Name: 34c4e900a9cc51630eeaf01deef74bf5b18d66e0ab1dc61a2023ac8f837a5197
2023-04-30 19:34:41 +00:00
drh
5a5cba0692 Merge all the latest trunk enhancements into the JSON5 branch to
facilitate testing of the JSON5 branch.

FossilOrigin-Name: 30d12edebad9b097cd5f0da355304d1cb2f8b70d7c7dff378fd7ad7c8ebf9279
2023-04-29 18:40:48 +00:00
dan
e01e3b5b94 Fix a crash that could occur in fts5 'secure-delete' mode when operating on corrupt records.
FossilOrigin-Name: 2e85b0e3dcae0915aa6472a3654c8ac72a6b2083c11747f3f657c79bbdaf530b
2023-04-29 18:31:44 +00:00
drh
440f7b4833 More ALWAYS() macros.
FossilOrigin-Name: 770b09f7a795956be63a06847059370db8dfc88654878d742b7b826947029962
2023-04-29 17:35:29 +00:00
drh
f8ae2d2a2a Add ALWAYS macros on unreachable branches in the new JSON5 logic.
FossilOrigin-Name: 91e15ed9d93e51b750172a074dbbcf206128e9476571ce6189b8ea0ba5ab4135
2023-04-29 17:13:39 +00:00
drh
399875f6c5 Simplification of the logic that normalizes JSON5 integer literals into
canonical JSON integer literals.  Improved reporting of OOM.

FossilOrigin-Name: 01ee613c07fcb87e7d7b7f1b1387982715d1343418f37f4a1dc90e43a76d20e8
2023-04-29 16:31:08 +00:00
drh
d76d954de3 Do not allow leading zeros on non-zero numeric literals in JSON.
FossilOrigin-Name: 3e91494390ba88498eb243f61ce4ef4efa23b58326108a769bc72331d7d7d75b
2023-04-29 16:00:20 +00:00
larrybr
b608d7e2c6 Cure CLI generate_series() overflow bug (forum:754e2d4db2a5|noted by forum post #754e2d4db2a5) and bring behavior with negative step arguments closer to as-documented and eponymous function in PostgreSQL.
FossilOrigin-Name: 07383758d68e05021ccd393a69c1fa94836dfb02331326c082495a531a384363
2023-04-29 15:42:46 +00:00
larrybr
29c2f0366d Replace duped generate_series() test with another corner case.
FossilOrigin-Name: fb2f08783fdfef4d5123ad66792de2265d39272d40d7bf1be7dd21876e8ffd73
2023-04-29 15:29:29 +00:00
larrybr
e0a3e4bd51 Sync w/trunk, improve generate_series() variable names.
FossilOrigin-Name: ecbf7e13e6454ee879c178c53ffa6face789e93ccbebb0cfac8fde72cb3a4952
2023-04-29 12:29:15 +00:00
drh
64953f0fb8 Minor fixes to to the JSON% parser.
FossilOrigin-Name: 2fe684cdcdc3cab4ec3348ca5aa5948e4472c562b739c29faebcb77397f8d969
2023-04-29 12:13:27 +00:00
drh
f176776bd7 Correctly recognize an isolated U+feff as a space character in JSON5.
FossilOrigin-Name: 4473dc8e3ad18bb6185ed4a819baf881a7d26ac74bc70fae6ba23a0030be8316
2023-04-29 00:59:22 +00:00
larrybr
7667f5f12f Add tests for generate_series(), and change an existing test that enforced varying rowid-to-value mapping with query ordering. (That no longer varies.)
FossilOrigin-Name: 9605db4ae37ef383f8e5568af4543a9e6f336bace6ed80ff80fe4c0b0f437078
2023-04-28 23:39:16 +00:00
drh
8f3fe2ead2 Bug fixes in the logic to skip over JSON5 comments.
FossilOrigin-Name: c736b77a2fc5f8f2ba8f770adf05443dfdc3a9847ee519f411e661f76756d611
2023-04-28 23:38:54 +00:00
drh
6e2de57963 Bug fix in the offset computation for json_error().
FossilOrigin-Name: 8f7ab5d9210490eb451534df246b82081a5aa252a1bd662659df3da429290837
2023-04-28 23:19:11 +00:00
larrybr
b0d46fcd72 Revise generate_series() extension (in CLI) to address overflow reported in [forum:754e2d4db2a5|forum post #754e2d4db2a5] and to make behavior better match the like-named PostgreSQL function.
FossilOrigin-Name: beeea3e1b010dace9789f27172462b912819d0f8142a67e3e1e7335211e0e9a8
2023-04-28 21:25:03 +00:00
drh
8e7efe3764 Improvements to the accuracy of json_error(). Add the extension SQL
functions random_json(SEED) and random_json5(SEED).

FossilOrigin-Name: 8d09dc1c45a8026b94f70273d064e47939f30cadedc17548b5a26ba054a8d3a7
2023-04-28 17:38:35 +00:00
drh
272ae627c5 Add the json_error(X) function that returns the 1-based character offset to
the first syntax error in JSON5 string X, or 0 if there are no errors.

FossilOrigin-Name: 901ad995d5a722ca2672516205ff488e9acd703a828ca5fc43f11fca5f2af120
2023-04-28 14:48:11 +00:00
drh
016f46666b Fix indentation and omit trailing whitespace in the random JSON generator
script.

FossilOrigin-Name: 629db09fceb7bf37561b52ccee06ebf4df261291e9a8ffcca82b243f6db5ff07
2023-04-28 13:25:35 +00:00
drh
1170fb52e1 Fix json_tree() so that it is able to deal with the JNODE_RAW labels of
a JSON5 object.

FossilOrigin-Name: f56528d413d8e622f7c4f18b2f9f2e620bfb441c020461299b35a90072ee6c13
2023-04-28 11:02:01 +00:00
drh
ea2529528e Merge all the latest trunk fixes and enhancements into the json5 branch.
FossilOrigin-Name: b5ca15cfc19380cf870b70be6a86e70f2026cc3d6d89005b45891d58c4f11c2d
2023-04-28 10:23:01 +00:00
drh
90f549a0cf Do not assert() a bad string representation in an sqlite3_value after
an OOM.  dbsqlfuzz c822a17a23c524a0ac7cfb203c7198209da15de8.

FossilOrigin-Name: 91fee79a01971259b21478e60a069a711a00efc79ddfececa6224a152cd8d09a
2023-04-28 10:10:52 +00:00
larrybr
fb016bf257 Make CLI .load slightly harder to abuse.
FossilOrigin-Name: 2779f9270cc431786d0e16ef05ec05b0f22dda2307f3bf17467ad0b25304e160
2023-04-28 00:28:06 +00:00
drh
fe03773305 In the CLI, early out from the output_quoted_string() routine if the
input string is NULL.  [forum:/forumpost/8a22c0bfa7|forum post 8a22c0bfa7].

FossilOrigin-Name: 2881978d7b7014738a21c590b0430c4fa40e6b00b9547d0284b7656124523ae9
2023-04-28 00:19:55 +00:00
drh
93b4c3beb8 Use a new technique to detect fresh OOM faults in columnName() that does not
rely on there being no OOMs prior to entry into columnName(), as
[forum/forumpost/fb6811c2f9|forum post fb6811c2f9] demonstrates a technique
which could cause an OOM prior to entry into columnName().

FossilOrigin-Name: a63346d6a0c0ca7ba4c87499de2e461be9c77e9b5d98f2bebf308cdb6599f33c
2023-04-27 23:59:51 +00:00
drh
bfd28f9e01 Remove a faulty assert() from the CLI.
[forum:/forumpost/726c4f7db0|Forum post 726c4f7db0].

FossilOrigin-Name: 4bbebb6bfb9910265d91b777c1711b3b8e0732bcf299f7459b20c4ea110422bd
2023-04-27 23:44:38 +00:00
drh
d5de1f39b5 Remove an ALWAYS() macro that can in fact sometimes be false.
[forum:/forumpost/f0e872fcee|Forum post f0e872fcee].

FossilOrigin-Name: d85880e4ed89e2198beea642818051f7a91a71fea9929be0a7ed0603b493ce47
2023-04-27 23:40:03 +00:00
drh
52da6d2607 Test cases added, and some bugs fixed.
FossilOrigin-Name: bc84a82e4ddc1b71025c56c49e62a44f0b12fa87a6417ad61967d9d3121a0d4e
2023-04-27 23:29:09 +00:00
mistachkin
263b86c54c Fix compilation issues seen with older versions of MSVC.
FossilOrigin-Name: 4ba2a651120391d779a3db9881c0fb17e1322cc9d8738f915a46e31a2f313578
2023-04-27 22:17:12 +00:00
mistachkin
cf5dce045f Adjust OSTRACE usage so that it works with the changes in the previous check-in.
FossilOrigin-Name: 1eb4573e9092d350d00d05ba716cb0272e2dbb1ecbaadc2a7cc22de0b8cc2bda
2023-04-27 21:31:21 +00:00
drh
ae31f48826 Further optimizations to the JSON parser.
FossilOrigin-Name: bb8f1c16f244f893170f3d03bc445bd15fc337804c7c3e76c548397f5b95b39a
2023-04-27 19:30:53 +00:00
drh
1371df2117 Faster implementation of numberic literal parsing in JSON.
FossilOrigin-Name: 58398292e8473b0b9e4b77dd5ed27334bc24a85d0c399e8d0b86de6fb59dadce
2023-04-27 19:13:20 +00:00
drh
49d8e0ef97 Add support for hexadecimal integer literals in JSON.
FossilOrigin-Name: 85e00c9e68d0695592e8f72555ee133c096bfca5a860a8e21d1e0ef756705aaf
2023-04-27 18:28:10 +00:00
drh
47dd0e735d All floating point literals "NaN" and "Infinity". Additional variants
of these literals are available if compiled with SQLITE_EXTENDED_NAN_INF.

FossilOrigin-Name: c13346afbecb92275e741252897d00478dab4be2d158889bc735e80efd9444f5
2023-04-27 17:32:29 +00:00
drh
8ded164200 Fix handling of reverse solidus in string literals. Allow decimal points
in floating point literals to occurs and the beginning or end of the mantissa.

FossilOrigin-Name: d92a6ab2871095ac66c60cfa15dbafa7b762f83d287d452f61792eb30cf5b26b
2023-04-27 16:57:14 +00:00
drh
dbcea23976 Fix the handling of escape solidus in the JSON routines.
FossilOrigin-Name: 676877aca235e620ee12d10235dd6ad009d4968455ec170daeb1998b94a7e0a2
2023-04-27 16:24:12 +00:00
drh
13f8a80d94 JSON string literals may span multiple lines by escaping new line characters.
FossilOrigin-Name: 66da4bd4a30c390fa1a7960ce2edaef82e63971ecf33ffb6b906db9f278041c5
2023-04-27 15:48:58 +00:00
drh
ef3a162be6 Allow the labels on JSON objects to be unquoted identifier names.
FossilOrigin-Name: fb428db3f64f148ab9a3478fdcc8b3733e58102b3c8895a482e2551d974d5661
2023-04-27 15:11:26 +00:00
drh
0d8579120a Performance optimization in the JSON parser.
FossilOrigin-Name: 5a88ba743f55d45b1c0ce0090bb3b396bcf7fcf7b3bcb989aaf30b8bb772599e
2023-04-27 14:38:51 +00:00
dan
2e225a35b4 Fix a problem on windows sometimes causing SQLITE_NOMEM to be returned if an error occurred while opening a temp file.
FossilOrigin-Name: c22a39a6b28e3039fe453c0c0db98744b8a63ef9063cc3f6e0ed67d2506d34be
2023-04-27 13:55:29 +00:00
drh
a549e7a527 Permit JSON5 whitespace in all contexts of objects and arrays.
FossilOrigin-Name: 93f3ab26b57c0469862a56e97d4b3c796b27f9f582046fcff1f2aa8d8910c550
2023-04-27 13:44:26 +00:00
drh
f59c01e24c Translate JSON5-only string literal escape sequences into the JSON equivalents.
FossilOrigin-Name: 14e82f36eed31af1237898728bf353b968523c62b1f8d1d90dbbabd92d0c2834
2023-04-27 12:24:00 +00:00
drh
c5ee2d8e80 Implement some of the JSON5 enhancements to string and numeric literals.
This is an incremental check-in of work in progress.

FossilOrigin-Name: 9508efa9d61c0ff0eb73100dd52889dadc5fa2a2091b944a9b8a74e8a5c50e82
2023-04-26 20:26:14 +00:00
dan
6a9ba9a8c2 Fix a typo in a printf() format string the sessions module.
FossilOrigin-Name: 14d1c4a828660bc137dcea1bb4cc439e1ed3872867a0dab486f6a639ef3bcc45
2023-04-26 18:50:49 +00:00
drh
d924af2325 When changing a large integer into a floating point value, cancel the
string representation.  Fix for
[forum:/forumpost/5c74a3bc4a|forum post 5c74a3bc4a].

FossilOrigin-Name: 3e2da8a7e35c839128d26aac575605e1e34889e8ab3484440bdd65c4d752c6bb
2023-04-26 18:23:47 +00:00
drh
f14b2e35fa Partial implementation of JSON5 numeric literal extensions. Use a switch()
statement in the parser for better performance.

FossilOrigin-Name: 78404dc37024cad5fe7eacf78ea85b56f08b129a1b9a046c3e1b11275068a485
2023-04-26 17:30:28 +00:00
drh
5255102e04 Improvement to the way the JSON performance measure scripts work → keep the
test database in the directory of the test, not in the source tree.

FossilOrigin-Name: ac411dbdcbf0b9040fb5b7de173271f383a6aa303d57f22ebd200809a5b4a6d3
2023-04-26 15:58:08 +00:00
drh
f62518f65d Work toward implementing JSON5 whitespace. Untested and incomplete.
FossilOrigin-Name: d262c059455ebe0650a45a6c1c04d1baf9609c635df352732dd192426e1bdc39
2023-04-26 15:19:19 +00:00
drh
ddc8b9ee0e Fix to the json-speed-check.sh script.
FossilOrigin-Name: d839c9544d7f28c1abc779eb2d40f95c1a9386984656fbd29d19b1e7830171bc
2023-04-26 13:52:20 +00:00
drh
02efa7be96 Add scripts for JSON performance testing.
FossilOrigin-Name: 3051d6a7c12cbf86634d8fab64f3f3bc9a1eb184260e56a82eb543cb634ba7ef
2023-04-26 13:25:30 +00:00