1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Commit Graph

32669 Commits

Author SHA1 Message Date
dan
a5ae4bd098 Return an error if the arguments of a table-valued function that is on the left of a RIGHT JOIN depend on tables to the right of it in the FROM clause. Report [bugs:/info/2026-08-31T08:07:08Z | 2026-08-31T08:07:08Z].
FossilOrigin-Name: 43c8d7c41c3d8a2602ea0a7759c6b85eeca8640bc85024746e77eb58648f73a6
2026-08-31 15:02:19 +00:00
dan
aba9f8ef69 Fix a bad interaction between the skip-ahead DISTINCT optimization and "ORDER BY ... NULLS FIRST/LAST" clauses. Report [bugs:/info/2026-08-30T23:22:05Z | 2026-08-30T23:22:05Z].
FossilOrigin-Name: 7bfd3d6f80316f3d129a1e8c798be0a0efa8fbeb69d6958c1c2af9f4f6945a9e
2026-08-31 11:04:03 +00:00
drh
638e0b1a03 In Lemon, remove the option to omit compression of the action table.
FossilOrigin-Name: 9b75f0c3466a551ff24a21a4caac3e0b6b92768e025c603560929e374acf5ef3
2026-08-31 09:48:26 +00:00
drh
d92acf1afe Follow-up to check-in [2cb349e5b02aa549] to help indexes on negative
DEFAULT integer values get stored more efficiently.

FossilOrigin-Name: c77ff6089de242d8cb7487ea36b094e403c9ed1a48a8ee713d64a0b87b334369
2026-08-29 20:27:09 +00:00
drh
a162198e12 Remove a redundant OP_RealAffinity inserted by recent changes to
sqlite3ColumnDefault().

FossilOrigin-Name: c7a987a4f7b4c937073536b714235e18295cc2c3bd8df8dfa4d8ba770ab6038d
2026-08-29 19:51:48 +00:00
drh
8dddb9b0cd Fix the CLI so that it does not capture ".echo" output as part of the
result of a ".testcase"...".check".

FossilOrigin-Name: 33322913a87caf64f430786e9b5fbe7b1fe42b82b410c8b7b410737ffd8e29e4
2026-08-29 18:39:28 +00:00
drh
2cfd7cc6c5 Ensure that ALTER TABLE ADD COLUMN has zero return columns, even when
altering a STRICT table.  Test case in TH3.

FossilOrigin-Name: 778e2bb9a6e06398012bc59b4c62bf8269828bf8f68e9c14e819c6f34edbe29f
2026-08-29 16:26:34 +00:00
drh
84340490ff Fix harmless comment typo.
FossilOrigin-Name: 66f608cecab53b5e3cd02bd33566ee7c37b123b9002bbf84f7b22b7856bec9c0
2026-08-29 13:42:11 +00:00
dan
492e7fc0a7 Fix a case in the fts5 matchinfo() demo function causing it to return the wrong error code.
FossilOrigin-Name: 5251f4d7071f86ad9d772d8b9309bc7191ca485c3db5cb658f689abf02de72c4
2026-08-27 18:07:23 +00:00
drh
a8e841bbd7 Built-in SQL function oom() invokes sqlite3OomFault() and then returns NULL,
but only if compiled with SQLITE_DEBUG or SQLITE_BUILTIN_OOM_FUNCTION.

FossilOrigin-Name: 90dfac7f2734078ae8c30b6f3379ed4d2283726fee9ea5799d73408d40e7e63e
2026-08-27 14:26:50 +00:00
drh
75136699f7 Fix a C90-compliance issue in the CLI.
FossilOrigin-Name: 555f31c64d3fcc55df2715a7c8c1cb28503b2c0eb21d950ccdcbf6f577593dd5
2026-08-27 10:58:16 +00:00
drh
658bd4ee92 Enhance the authorizer so that it invokes the callback for the use of
SQL functions in the DEFAULT clause of a CREATE TABLE.  It does this both
with the CREATE TABLE statement is first used, and whenever the DEFAULT
expression is used, but not when the schema is being reparsed.

FossilOrigin-Name: 4b30d1d7e22b9b74753a6fb4d9e1f884ddcee12273d6842954ed44de94e5f4b9
2026-08-27 10:31:42 +00:00
drh
7022e15ab5 Update a stale comment. Fix minor #ifdef issues.
FossilOrigin-Name: 2959ec249b584e033877b714dd868ae52bd1e19c718ea30d2ecad7b3efea51b1
2026-08-27 10:16:08 +00:00
drh
9ec2b69c0d Fix the ext/misc/compress.c extension such that it compiles independently
of the CLI.

FossilOrigin-Name: 4cd5ecc5b3ea4b86875849ede0c5a072e76331eae3ccac139e51fe7568260b42
2026-08-27 10:01:13 +00:00
drh
1e56db7387 Minor enhancements to the built-in ".mode" documentation in the CLI.
FossilOrigin-Name: b3a034a82da1f141769e97fdff3aab89a0e465570b978249afe277236da251d7
2026-08-27 09:44:24 +00:00
drh
ebba9a05f2 Performance optimizations and code simplifications.
FossilOrigin-Name: cbf2e796e02b23df9d51b59e047673fe0bdecd6497e678507b5bbc5c136dad7d
2026-08-27 01:42:32 +00:00
drh
0754d37652 Split the sqlite3ColumnExpr() routine out into two routines, one that works
as before and the second sqlite3ColumnExprAuth() to deal with the
authenticator in places where that is needed.

FossilOrigin-Name: 51a1149bdcbe142b8eb92c2b817d3973bf88aaa73859e0c475505aa201da920b
2026-08-26 21:04:25 +00:00
drh
04a4ee45c5 An attempt to make the authorizer effective at preventing the use of
some functions within the DEFAULT clause of a table.

FossilOrigin-Name: 321e41b09179acba59958bdd6b07e4b7d915b9c0dfca143e4914b3690692c201
2026-08-26 19:37:23 +00:00
drh
8ded810322 Add the --deny and --ignore options to the ".auth" command in the CLI.
FossilOrigin-Name: da1e7d73c64d0a0c140c17794a60772d842d38204cf9a1b16c9ba338d733e9b9
2026-08-26 18:21:00 +00:00
drh
8a9882714d The sqlite3ExprListIsConstant() routine probably should not return true
if the list contains a function like random().  Fixed here.  Simplify
the logic used to test if expressions are constant.

FossilOrigin-Name: 753f42a0925112fd4f2bbe40e72919230890ffc8014900d36624c0dfa371bdf7
2026-08-26 15:23:14 +00:00
drh
b130fc5319 Enhance the tmstmpvfs.c extension so that it tags zero pages in the log file.
FossilOrigin-Name: e9d649b77b14990cdc5440e08fdace6989737f3fd1acfc8b1c1bb72be7022ec0
2026-08-26 12:31:34 +00:00
drh
86a15af2b1 Improved handling of OOM conditions in the sessions extension.
[bugs:/info/2026-08-25T17:04:14Z|Bug 2026-08-25T17:04:14Z].

FossilOrigin-Name: ce2aa9f8495edfa361220c4702a54035e9df78984ce6c9fff40e04bd45cc3393
2026-08-25 18:40:50 +00:00
dan
39ccdd9314 Add assert() statements and comments to explain why the return value of sqlite3_column_name() does not need to be checked in fts3.c. Repor [bugs:/info/2026-08-25T17:08:22Z | 2026-08-25T17:08:22Z].
FossilOrigin-Name: 08b34b1656b7dec2328345bb8ea93d75193703aaff52546fc17844b7110b2741
2026-08-25 18:28:21 +00:00
drh
112122c2f9 Avoid a possible NULL pointer dereference in the QRF sublibrary when
compiled with SQLITE_ENABLE_STMT_SCANSTATUS.

FossilOrigin-Name: 58014b2a2efdf0800946591d2d53d1c001a9b58681156dc201aa542912567570
2026-08-25 18:26:40 +00:00
drh
603233d42e Improved handling of OOM errors in the Windows implementation of the
sqlite3_stdio.c extension.
[bugs:/info/2026-08-25T16:55:53Z|Bug 2026-08-25T16:55:53Z].

FossilOrigin-Name: 555489e4c21f5ab65364c73217ec76202a5c97d2f4d66cf38e00158af13ecad6
2026-08-25 18:16:16 +00:00
drh
e18ff9bf54 Prevent some potential NULL pointer deferences following misuse of the
non-standard amatch extension.
[bugs:/info/2026-08-25T16:47:32Z|Bug 2026-08-25T16:47:32Z].

FossilOrigin-Name: 99b69371a136d71e91b482e97e38bfbc3b0c1a63db6c75af5c83494fd758d4cd
2026-08-25 17:59:05 +00:00
drh
61387ffc4e New optimizations for improved performance of UNION with LIMIT 1, with
or without ORDER BY.

FossilOrigin-Name: b5b8ede613c40cf4a1ad0fe2af9b98d410982e0680b1da00c67ff1c2c34e0d6b
2026-08-25 17:12:09 +00:00
drh
4213c5cc4f Fix two test cases that do not work when optimizations are disabled.
FossilOrigin-Name: e78b72fadfe4c263f5af56aa887891a49055edfccda9397267804b3aaf4afd53
2026-08-25 17:08:19 +00:00
drh
46c7844d76 Make the optimization of UNION with ORDER BY and LIMIT sound by restricing
it to LIMIT 1.

FossilOrigin-Name: 7e6e665d05e5d5895bac60d68b49bdf28e2ec6d8dc4ef8c18703f2e6d4f8870f
2026-08-25 16:29:27 +00:00
dan
a62edeb74d Fix OOM handling in little-used extension file "expert.c". Report [bugs:/info/2026-08-25T16:02:31Z | 2026-08-25T16:02:31Z].
FossilOrigin-Name: c89f4f79676f34cd8399f4a8a3934ad63d4547b9528e736bad1ee0e6f5fe6305
2026-08-25 16:15:15 +00:00
drh
69785dee50 Merge the latest trunk enhancements into the union-to-union-all branch.
FossilOrigin-Name: c58631b26ad6ee39d8db2700a26413249fd88d137c3a7944bad7af07cd7fe121
2026-08-25 15:49:27 +00:00
drh
f666cf6efb Update the Lemon documentation with clarifications regarding the
%fallback and %wildcard directives.

FossilOrigin-Name: f3ad1b4394ff0902e4ae9e8d0ea36ee198149c5ce8745851eaf84105484fedf2
2026-08-25 14:27:11 +00:00
dan
11d653bbd3 When an expression that may have a subtype from the WHERE clause of a partial index is substituted for a column value, clear the subtype before the value is used. Report [bugs:/info/2026-08-25T05:36:33Z | 2026-08-25T05:36:33Z].
FossilOrigin-Name: e6ae6fbd5c0b33ae6950a5a45fc0631cd5e0a437eb672f0a2ec6d288596f1be2
2026-08-25 14:26:16 +00:00
dan
b1df30c735 Fix test file default.test so that it works with SQLITE_OMIT_ALTERTABLE builds.
FossilOrigin-Name: ff0e3dd09486dad093b8392e088d17f78e4445f68baebf63d24ad232d45e69b3
2026-08-25 11:50:11 +00:00
dan
6121d9909d Avoid coding WHERE constraints too early when using the OR-optimization with OUTER join queries. Report [bugs:/info/2026-08-25T02:08:22Z | 2026-08-25T02:08:22Z].
FossilOrigin-Name: a3d15e4937c8f767db046615994f53618be0a407dee09a1989a6382e9b945574
2026-08-25 11:42:00 +00:00
drh
eb13d2232e Change error message text in the previous check-in to not have initial caps,
for consistency with other error messages.

FossilOrigin-Name: c4bd2ffcb7110d71bf1ec8114d65b57cbbad084851295adca754def847751464
2026-08-25 10:39:48 +00:00
dan
9ca4d3f61e Prohibit using ALTER TABLE to add or drop, or rename to or from a rowid alias, unless the table is a WITHOUT ROWID table. Report [bugs:/info/2026-08-23T15:59:23Z | 2026-08-23T15:59:23Z].
FossilOrigin-Name: dfcff5be53c26b9a1728e485ac9c56d50be5ac9ce877fcae3965471469dc8a8d
2026-08-24 21:20:49 +00:00
dan
8c43b6559f Avoid a technically undefined signed integer overflow in fts5. Report [bugs:/info/2026-08-23T16:25:44Z | 2026-08-23T16:25:44Z].
FossilOrigin-Name: cde23480be10e2da6acb357d39e129b314429640143034b9e2207719dcf18350
2026-08-24 18:55:06 +00:00
dan
c737eb289c Fix some fts5 cases where all columns are excluded by a column filter (so that no rows match). Report [bugs:/info/2026-08-23T16:25:44Z | 2026-08-23T16:25:44Z].
FossilOrigin-Name: 7c9b711fc8c2c714ff8709750773c49dba1c6e4f39700806ebf59e6a094bf32d
2026-08-24 18:24:44 +00:00
dan
b3db734685 Ensure that the fts5_vocab.term column behaves as if it has blob affinity for comparisons.
FossilOrigin-Name: a832bc1ef270365658b60aa4eece35bad1fe26725a45453b302cc7a06cc46cc6
2026-08-24 17:29:17 +00:00
dan
ca3e62724e Fix a problem with combining index=none and secure-delete modes causing full-text index entries to be sometimes lost when inserts and deletes on the same token are combined in the same transaction. Report [bugs:/info/2026-08-23T16:25:44Z | 2026-08-23T16:25:44Z].
FossilOrigin-Name: e1f939f473d6e478ceabcb10a4f5b96d1d538c4aec39e0e3cfeb3c5ff97ea2ec
2026-08-24 17:08:41 +00:00
drh
cc9f93c1c9 Fix harmless compiler warning.
FossilOrigin-Name: 0c5f5b37cec32c270c2b956e7627bf2eec38baa1b4625a7dbed8a49564ec8d37
2026-08-24 16:19:06 +00:00
dan
d6bae5ec97 Ensure that when a large integer value (too large to be losslessly converted to double) is specified as a default value for a column with REAL affinity, the real version of the value is stored in indexes. Report [bugs:/info/2026-08-23T15:39:59Z | 2026-08-23T15:39:59Z].
FossilOrigin-Name: 2cb349e5b02aa549518f2e17cbfc6b4841e5686dcfb828f243c87ff3006f4870
2026-08-24 14:40:43 +00:00
drh
221ad559b6 When generating code to evaluate a vector IN constraint where the RHS
of the IN operator is a subquery, if the removeUnindexableInClauseTerms()
subroutine changes the order of terms in the IN operator, then do not
allow the modified IN operator to reuse a previously generated evaluation
of the subquery.
[bugs:/info/2026-08-23T06:58:36Z|Bug 2026-08-23T06:58:36Z].

FossilOrigin-Name: 8ee92456eb21878c44732e9adaac64009133eb03c36a7390b42427d63ff4a340
2026-08-24 14:30:29 +00:00
dan
1934b305cd Ensure that when a large integer value (too large to be losslessly converted to double) is specified as a default value for a column with REAL affinity, the real version of the value is stored in indexes. Report [bugs:/info/2026-08-23T15:39:59Z | 2026-08-23T15:39:59Z].
FossilOrigin-Name: c494b123f52506ab57edd3f4c317b882b270e13bd5798b6c8fbdf5eebbd4ed63
2026-08-24 14:22:19 +00:00
stephan
6bea9c26bb Remove a harmless unused variadic argument in sqlite3_rsync. Bug report [bugs:bc49306e10e92b10|2026-08-24T01:22:51Z].
FossilOrigin-Name: 5231ac428da4486d64e473e98aa72da5ca68848fba97845dbcf51fd2314debbf
2026-08-24 09:56:51 +00:00
drh
85e7fd94d9 The optimization of disabling an ORDER BY term if it is constrained by
an equality comparison with a column from an outer query does not work
if there is an affinity mismatch between the two columns.  This is a
follow-on to check-in [16aed5d0c63dcdc2] and a fix for
[bugs:/info/2026-08-23T01:02:14Z|Bug 2026-08-23T01:02:14Z].

FossilOrigin-Name: 383e42bc1096d6fe6a2a0a147da90a1bb0bfb37c78a3288bbacaaf9bf7ac17c4
2026-08-24 00:08:45 +00:00
drh
4efa7a477e Correctly enforce a UNIQUE constraint on a non-PRIMARY KEY column of a table
that has an INTEGER PRIMARY KEY with ON CONFLICT REPLACE and that has
a AFTER DELETE trigger that fires when the REPLACE happens and that trigger
tries to INSERT a new row that violates uniqueness.
[bugs:/info/2026-08-22T23:55:15Z|Bug 2026-08-22T23:55:15Z].

FossilOrigin-Name: 521c9f5f282f159332101be32031568cb3f08fd937f354a282e09957dd570f53
2026-08-23 21:41:08 +00:00
drh
0eaef28cf2 Enhance sqlite3_bind_int64() so that it never triggers a reprepare if the
value does not actually change.

FossilOrigin-Name: db0cb462aaf2014cfe8cfc90f7cddda07458a5439b2154dc2781420154bd3098
2026-08-22 19:27:30 +00:00
drh
13b624ae67 Fix incorrect termination of varargs argument to pickStr() in
check-in [852972861636d75e] from yesterday.

FossilOrigin-Name: ad7d15323b091b6e193ee7bc4eb1bf7b088cd18aa92ac29729cd30b16e4b2981
2026-08-22 17:56:46 +00:00