1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00
Commit Graph

19257 Commits

Author SHA1 Message Date
drh
c0190101d1 Enhance "box" and "column" mode formatting in the CLI to better deal with
double-wide characters.

FossilOrigin-Name: b0de22ed0abf2ea5d269f191c884d7b2be167a2ed27018c25aaa0ea238cd621a
2025-05-31 20:51:42 +00:00
dan
51e3f855b8 Fix an affinity problem caused by a USING or NATURAL JOIN on the LHS of a FULL JOIN. [forum:/forumpost/5028c785b6|Forum post 5028c785b6].
FossilOrigin-Name: 8d393ca07fe09f48d77adb517e2e4baaa58a9251422de62a0504999205d3ea1d
2025-05-31 18:16:21 +00:00
drh
5248693924 Relax query flattener constraint (3b) and thereby allow flattening the RHS of
a LEFT JOIN even if the RHS contains a virtual table.  This was previously
disallowed by [9dbae1df75219e2a] as a performance optimization.  It
turns out that the constraint causes performance issues, and we do not have
a record of any performance issue that it solves.

FossilOrigin-Name: 1ddaa92057e550ea281d45d9860eafe69399224725548a93dd91c47a34e52152
2025-05-31 16:17:14 +00:00
dan
420233e375 Fix assert() statements in os_unix.c and os_win.c. Allow walsetlk_recover.test to run in non-SQLITE_ENABLE_SNAPSHOT builds.
FossilOrigin-Name: 9f521ecda2b8d2f383cc84e308b3a4adfcf1bd6339eb834c8fa76c8704c861b7
2025-05-31 15:10:41 +00:00
stephan
10206572b6 tcl extension: UDFs may now 'break' to return an SQL NULL. Add the (eval -asdict) flag to use a dict, instead of an array, for the eval row data.
FossilOrigin-Name: 413a626b5c7902c1810142536c36e4ea8ee7c616ea82dfe1114199f9319091f7
2025-05-31 11:02:06 +00:00
stephan
b504aab848 Add some missing UNUSED_PARAMETER() annotations to squelch downstream build warnings when using -Wextra -pedantic.
FossilOrigin-Name: a98a2f49355ec39c56e571c70d377675b1bd99a6d43cf9217b0eb1e081895d8e
2025-05-31 09:44:00 +00:00
drh
d930d7ef14 Follow-up to the previous: The same optimization suppression needs to
happen if the left-hand side is coming from a LEFT JOIN.

FossilOrigin-Name: cf5b37b3a39013d8ca9de92da2289346caf52b56daff59e19b140cc586a3421f
2025-05-30 22:58:09 +00:00
dan
ded1959120 If blocking locks are enabled, avoid using the busy handler when blocked by another process running recovery.
FossilOrigin-Name: a35236757ab57c4c9b34e47c5dbc10d8f1220f8152955f5303cf9c3902ee169b
2025-05-30 20:52:18 +00:00
drh
dd16539e71 When synthesizing an ON constraint from a USING or NATURAL, if the left-hand
side is coming from a RIGHT JOIN, be sure to set the EP_CanBeNull flag so that
the optimizer knows to check for NULL even if the column has a NOT NULL
constraint.  Fix for the problem reported by
[forum:/forumpost/4fc70203b61c7e12|forum post 4fc70203b61]

FossilOrigin-Name: 60adc78a22956429d34ccc4e2c193c5994c11c3b3cff7901d47fad7d92dba935
2025-05-30 19:55:46 +00:00
dan
88ed38ca6d Avoid invoking the busy-handler if a blocking lock times out while attempting to open a snapshot transaction.
FossilOrigin-Name: fe11f85fd3283bb7002f43bd8b796e9e7b67f6d1a92eb676be06b46d1458fc1d
2025-05-30 18:23:03 +00:00
drh
8ae57fab64 Use a more robust backup definition for offsetof().
FossilOrigin-Name: 22441955e03df07903b98832a60c05c53721cd67c667f6c83d5e97fcc62735ee
2025-05-30 15:43:04 +00:00
drh
f429845a60 Extend the fix for ticket [623eff57e76d45f6] so that it covers RIGHT JOIN
in addition to LEFT JOIN.  Problem reported by 
[forum:/forumpost/7dee41d32506c4ae|forum post 2025-05-29T15:10:14Z].

FossilOrigin-Name: 29b1e1b97619d03a97ef562a5707929e241d019179b4ff1d0bc2a8c008441431
2025-05-29 18:44:41 +00:00
drh
b3bcf489a4 Do not use a partial index if the truth of the WHERE clause does not depend
on at least one column from the table being indexed.

FossilOrigin-Name: cbe2a392e45d40778570656d2ef2db43e58ad6453bd9d4b936fecfd963e22736
2025-05-28 14:59:42 +00:00
stephan
45fa2347fe tclsqlite.c doc typo fix.
FossilOrigin-Name: de0dfac1e5ca9d2661674c20664095386f60c77378311507fcba08111df52b38
2025-05-26 07:15:20 +00:00
drh
a01b7adb13 Change json_group_object() so that it ignores entries where the label
is NULL.  [forum:/forumpost/e5bd251fb5|Forum post e5bd251fb5].

FossilOrigin-Name: 28215d131cd970a2756338579fb6b6091ab155be8f419505cae8ac918956165c
2025-05-24 20:20:20 +00:00
drh
4a0b7a332f Clarify some malloc size computations to simplify the proof that they
are safe.  Remove some code associated with cygwin that is marked "#if 0".

FossilOrigin-Name: ba8184d132a935aa1980fbfb61ff308b93d433d559db4968f9014f7653ac9c6e
2025-05-19 14:50:36 +00:00
drh
79c792d5d9 Make the new sqlite3_setlk_timeout() interface accessible to loadable
extensions.

FossilOrigin-Name: 8819b7285b71932327f47d29fa575cfb338e2fccd3f7c2023faf0575bfdb0079
2025-05-19 14:04:48 +00:00
drh
890de76cf5 Remove stray tab characters from source files.
FossilOrigin-Name: 298ff5a1dc5dbccaf6acd91731044f478a5ce522745332801708ceee996b01e6
2025-05-19 12:46:08 +00:00
drh
a58208a214 Fix a harmless comment typo
FossilOrigin-Name: c4d25acec3c1e28e5a4664a74c263cc0d00e118a6db4b26b51cb0d42d0f2b26f
2025-05-19 12:34:11 +00:00
drh
972a0f5e8d Improved version of the previous check-in.
FossilOrigin-Name: 036c97e36cb36a2ac765a8e8539433dcb63f69155d4c24857f84faa44eed6eb5
2025-05-16 18:19:11 +00:00
drh
cd64392301 Fix the optimization of check-in [663f5dd32d9db832] that strives to avoid
duplicate compuations in the GROUP BY clause so that it works even if the
GROUP BY term is a subquery on the RHS of a LEFT JOIN.  Problem found
by dbsqlfuzz.  Test cases in TH3.

FossilOrigin-Name: 955a026996b93e530ca5b566689cc646b31d3b9b5a5837897a58452d70f6d942
2025-05-16 17:30:20 +00:00
drh
4165fd8a86 Rework the showHelp() function in the CLI implementation so that its
purpose and operation are well described by the header commit.  Omit
the use of enums that cause issues for MSVC 2025.

FossilOrigin-Name: 336ceeccc6f85bd78f4a26648af7edf9056d569a767b4120f125a02b2090a349
2025-05-15 11:20:54 +00:00
drh
691b44a1b3 Back out the "low-quality index" query planner hack of check-in
[bcac937526d9a6ef].  Subsequent query planner enhancements for dealing
with star-queries make that change unnecessary and the change was recently
found to cause a performance regression in an unrelated query.
Also fix a typo in a debugging message.

FossilOrigin-Name: e7dcf25efae364b7cdf9eb8265803c816c8b8557e4a7684da428badc6ffb3875
2025-05-14 16:40:05 +00:00
drh
494830ca8e First cut at enhancing the fsdir virtual table so that it works with
unicode characters on Windows.

FossilOrigin-Name: c9e04dadfdf6c860631ce5603693add565ff2033aa25af5736302af7045fc91e
2025-05-13 16:58:36 +00:00
drh
0df6c5b9a7 Omit the unused readdir_r() routine from test_windirent.c
FossilOrigin-Name: f9a216e3ad1b3bc9be350aad5ef3dc8b3534d3ee67d160bfedda81a61295320c
2025-05-13 15:09:13 +00:00
drh
94e22bc077 Provide the SQLITE_BUG_COMPATIBLE_20250510 compile-time option that restores
the JSON5 bug fixed in the previous check-in, in case some applications need
it for legacy compatibility.

FossilOrigin-Name: 491cf31904fdbc9567b838d1ba27901e75f8ea3a117043017d08354bb09f9711
2025-05-10 17:09:53 +00:00
drh
844b457950 Add enforcement of the obscure JSON5 syntax rule that the \0 escape
sequence must not be followed by a digit.
[forum:/forumpost/c061e87faf7d1c55|Forum post c061e87faf].

FossilOrigin-Name: 83c7477f2b9b0d6cb54cf6b14bf3c8ef4807e4bddc7986d275cf6717da8606b7
2025-05-10 15:53:17 +00:00
drh
733aff3be8 Fix PRAGMA trusted_schema=OFF and similar so that it restricts the kinds
of functions in CHECK constraints that the documentation says it does.  It
was letting through some function that it ought not have.  This is a
defect in [5720924cb07766cd].  See
[forum:/forumpost/3fa9d44c0b381342|forum thread 2025-05-08T08:50Z].
Additional test cases will be added separately.

FossilOrigin-Name: 25920beebf71ebc9a1bb9f56932280c9e03390f26fe9da2258f950979b238ce6
2025-05-08 16:18:18 +00:00
stephan
cc28137e08 Internal doc typo fix. No code changes.
FossilOrigin-Name: ac2aa39f7e3ae7ac921fac6566186939a1282f80ced5b3e3d5006a77ecf583ff
2025-05-08 13:51:55 +00:00
drh
f087b6ace3 Fix a harmless warning about and oversize shift operation on malformed JSONB
inputs.  [https://issues.oss-fuzz.com/issues/415850463|OSSFuzz 415850463].

FossilOrigin-Name: cf8b55b3b6f0b73158e21731a206d5a8d8d9892989d91171a11c6dbbee34b338
2025-05-07 17:13:30 +00:00
drh
288f356854 Fix a bug in the NOT NULL/IS NULL optimization of check-in [cb94350185f555c3]
that can cause invalid data to be used for a column if that column has a
CHECK constraint that includes the NOT NULL or IS NULL operator.
Problem discovered by the 
[https://issues.chromium.org/issues/415397143|Chromium fuzzer].  Never
seen in the wild, as far as anybody knows.

FossilOrigin-Name: 2adaee9aa90f280a406007695fbc4a314806584c93d6b62b46c031492b31ec27
2025-05-06 17:53:27 +00:00
drh
ad39fa81af Fix the sqlite3VdbeTypeofColumn() function so that it works correctly
even when SQLITE_DEBUG is defined.

FossilOrigin-Name: 1d5021533ed688d7a815ce75b338c72f577c14554027f88a21419935a9e68239
2025-05-06 16:28:44 +00:00
drh
f23a61258b Fix a harmless problem in the CLI in which SQL errors that occur during
the ".schema" command are properly ignored, yes still appear in the ".log"
output. [forum:/forumpost/42fe6520b803be51|Forum post 42fe6520b8]

FossilOrigin-Name: 20abf1ec107f942e4527901685d61283c9c2fe7bcefad63dbf5c6cbf050da849
2025-04-30 14:37:00 +00:00
drh
88ed1806a4 Fix an issue in Bloom filters on RHS subsqueries to IN operators.
See [forum:/forumpost/792a09cb3df9e69f|forum post 792a09cb3d] for
a description of the problem.  Also improve comments related
to [baa83b460c677c21] which was origin of the problem.

FossilOrigin-Name: cdef486e212fe4b26605065d9cff08f608cb80df48ee64e4be63637769bdfacc
2025-04-30 12:48:20 +00:00
drh
0f0450eda3 Fix an off-by-one error in an assert(), discovered by oss-fuzz. This is a
harmless error in as much as assert()s are disabled in production builds, and
because the off-by-one only occurs on nonsensical CREATE INDEX statements.

FossilOrigin-Name: 3e627d66ebdef8dfe41bd12a0474d1afca9f50051771774679d25bd1833e69ae
2025-04-25 12:39:32 +00:00
drh
d2fd099570 Remove an extra conditional that was inserted earlier today and which
is unreachable.

FossilOrigin-Name: 5ea56af2d27611c5a8ea275316d21a02e70032f93243549ae776e9a89edc6229
2025-04-21 23:44:55 +00:00
drh
81cde80f7b Further improvements to the decision of whether or not a BLOB input
is JSONB.

FossilOrigin-Name: 6538813cb89f6109727481e29633e2e98f98e0257c58695e3b53e8ce237d9195
2025-04-21 20:58:49 +00:00
drh
cbe4a26e02 Do a better job of providing bug compatibility with SQLite 3.44.0. See
[forum:/forumpost/07e206fcd6|forum thread 07e206fcd6] for background.

FossilOrigin-Name: 614d061b32c3bdf4825323d6f8e8a98624e4eeeb96dd442d8e365527122ed3bc
2025-04-21 19:53:12 +00:00
drh
10744c61ad When logging errors using sqlite3_log() and the error text includes the
text of an SQL statement, but the SQL statement text at the end so that if
the error message buffer overflows it is the SQL statement text that gets
truncated, not the statement of the problem.

FossilOrigin-Name: de0968226effb79f9d25539da7882fa5475e4ff2410870b45a63a6545deb5979
2025-04-17 19:01:54 +00:00
drh
56747d1840 Increase the size of the output buffer for sqlite3_log().
FossilOrigin-Name: a64e8491c9863f890daa9f5d8f678728dc0d00bc1f3c238b50214ec545450fcf
2025-04-17 17:46:28 +00:00
drh
6fe2a9a8f1 Attempt to provide EBCDIC translations to the tables in the JSON
implementation.  The SQLite developers do not have access to any
computers using EBCDIC and so have no way to test this patch, and
cannot vouch for its accuracy.

FossilOrigin-Name: 84e698f38429c142caaa66ac086410f2035691b2ad39ad2fc4e0ebc31dd58a5b
2025-04-16 17:36:26 +00:00
drh
0243ca8245 Correctly handle the case of a multi-column UNIQUE constraint that contains
the ROWID as one of it columns, and then the columns of that UNIQUE are
used in a row-value IN operator as a WHERE clause constraint.  Reported by
[forum:/forumpost/b9647a113b465950|forum post b9647a113b].  Problem
introduced by [723f1be3d4a905a6], part of ticket [da78413751863].

FossilOrigin-Name: d22475b81c4e26ccc50f3b5626d43b32f7a2de34e5a764539554665bdda735d5
2025-04-15 21:59:38 +00:00
drh
8488789d74 Fix a minor typo in a code comment.
FossilOrigin-Name: 158e8c4fd7bdfc1cd4c0135abecd0d00994cd4027cf74ce6e5cf73d76475ae95
2025-04-15 19:53:36 +00:00
drh
483e1181c5 Improved estimate on the number of output rows in a recursive common table expression
that uses the UNION operator.  Follow-up to [f911f1c4977fbcae] and it's output row
estimate changes associated with DISTINCT queries.

FossilOrigin-Name: 92513f6bce7ecc778e78af3a77bc66ff65585fffa2e3138f8acb9e617121eeb0
2025-04-14 19:43:30 +00:00
dan
2d1c71abeb Fix an obscure problem allowing the propagate-constants optimization to improperly substitute a column of a sub-query with NONE affinity.
FossilOrigin-Name: d82725dcaec7437f37fc15dfb492b51a4f9dbbbcaea04e387d9471b7d291cde2
2025-04-10 14:53:32 +00:00
drh
8a6f89c845 Remove unnecessary "www." prefixes on domain names in URLs.
FossilOrigin-Name: 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6
2025-04-10 10:18:07 +00:00
drh
fda6e50ac8 Remove an incorrect ALWAYS() macro. [forum:/forumpost/23875495059357a2|Forum post 2025-04-08T19:16:42Z].
FossilOrigin-Name: 062cca9c63ef6d7b9a525df69391e9b032284703aeb45a18c728305dd5957c43
2025-04-08 20:00:33 +00:00
drh
29c7c8b913 Fix a harmless code typo introduced by [b57e3c3db00a6bc6] and reported by
[forum:/forumpost/09957d8b2a|forum post 09957d8b2a].

FossilOrigin-Name: f3a6cdb89b13bc173cfce9526f836600469b0242fe62b8f92f8747896d7d47bb
2025-04-06 10:22:26 +00:00
jan.nijtmans
82d05b7b54 The win32lock and win32longpath tests don't work on Cygwin
FossilOrigin-Name: 32ef3f26e7fb34dfdb23617a19bb9baa2e4c3dca564a88850b58a0fbe6446cf8
2025-04-04 13:23:03 +00:00
drh
76076d442a Fix a typo accidently added to the prior check-in.
FossilOrigin-Name: fb2f283038f9329b6f791d92d6f943269f24f1a0efd5859165b63f517ed52ddb
2025-04-01 16:26:51 +00:00