Update sqlite to version 3.50.4 (#20791)
Update to version 3.50.4
Stelios Fragkakis committed
Sep 8, 2025 at 15:25 UTC
2736af20c591eca277b9abcc63d26622edc7a54f
2 files changed
+167
-126
src/database/sqlite/vendored/sqlite3.c
+122
-81
@@ -1,6 +1,6 @@
1
/******************************************************************************
2
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.50.2. By combining all the individual C code files into this
3
+** version 3.50.4. By combining all the individual C code files into this
4
** single large file, the entire code can be compiled as a single translation
5
** unit. This allows many compilers to do optimizations that would not be
6
** possible if the files were compiled separately. Performance improvements
@@ -18,7 +18,7 @@
18
** separate file. This file contains only code for the core SQLite library.
19
**
20
** The content in this amalgamation comes from Fossil check-in
21
-** 2af157d77fb1304a74176eaee7fbc7c7e932 with changes in files:
21
+** 4d8adfb30e03f9cf27f800a2c1ba3c48fb4c with changes in files:
22
**
23
**
24
*/
@@ -473,9 +473,9 @@ extern "C" {
473
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
474
** [sqlite_version()] and [sqlite_source_id()].
475
*/
476
-#define SQLITE_VERSION "3.50.2"
477
-#define SQLITE_VERSION_NUMBER 3050002
478
-#define SQLITE_SOURCE_ID "2025-06-28 14:00:48 2af157d77fb1304a74176eaee7fbc7c7e932d946bf25325e9c26c91db19e3079"
476
+#define SQLITE_VERSION "3.50.4"
477
+#define SQLITE_VERSION_NUMBER 3050004
478
+#define SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3"
479
480
/*
481
** CAPI3REF: Run-Time Library Version Numbers
@@ -9385,13 +9385,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
9385
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
9386
** <dd>^This is the number of sort operations that have occurred.
9387
** A non-zero value in this counter may indicate an opportunity to
9388
-** improvement performance through careful use of indices.</dd>
9388
+** improve performance through careful use of indices.</dd>
9389
**
9390
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
9391
** <dd>^This is the number of rows inserted into transient indices that
9392
** were created automatically in order to help joins run faster.
9393
** A non-zero value in this counter may indicate an opportunity to
9394
-** improvement performance by adding permanent indices that do not
9394
+** improve performance by adding permanent indices that do not
9395
** need to be reinitialized each time the statement is run.</dd>
9396
**
9397
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
@@ -9400,19 +9400,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
9400
** to 2147483647. The number of virtual machine operations can be
9401
** used as a proxy for the total work done by the prepared statement.
9402
** If the number of virtual machine operations exceeds 2147483647
9403
-** then the value returned by this statement status code is undefined.
9403
+** then the value returned by this statement status code is undefined.</dd>
9404
**
9405
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
9406
** <dd>^This is the number of times that the prepare statement has been
9407
** automatically regenerated due to schema changes or changes to
9408
-** [bound parameters] that might affect the query plan.
9408
+** [bound parameters] that might affect the query plan.</dd>
9409
**
9410
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
9411
** <dd>^This is the number of times that the prepared statement has
9412
** been run. A single "run" for the purposes of this counter is one
9413
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
9414
** The counter is incremented on the first [sqlite3_step()] call of each
9415
-** cycle.
9415
+** cycle.</dd>
9416
**
9417
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
9418
** [[SQLITE_STMTSTATUS_FILTER HIT]]
@@ -9422,7 +9422,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
9422
** step was bypassed because a Bloom filter returned not-found. The
9423
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
9424
** times that the Bloom filter returned a find, and thus the join step
9425
-** had to be processed as normal.
9425
+** had to be processed as normal.</dd>
9426
**
9427
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
9428
** <dd>^This is the approximate number of bytes of heap memory
@@ -9527,9 +9527,9 @@ struct sqlite3_pcache_page {
9527
** SQLite will typically create one cache instance for each open database file,
9528
** though this is not guaranteed. ^The
9529
** first parameter, szPage, is the size in bytes of the pages that must
9530
-** be allocated by the cache. ^szPage will always a power of two. ^The
9530
+** be allocated by the cache. ^szPage will always be a power of two. ^The
9531
** second parameter szExtra is a number of bytes of extra storage
9532
-** associated with each page cache entry. ^The szExtra parameter will
9532
+** associated with each page cache entry. ^The szExtra parameter will be
9533
** a number less than 250. SQLite will use the
9534
** extra szExtra bytes on each page to store metadata about the underlying
9535
** database page on disk. The value passed into szExtra depends
@@ -9537,17 +9537,17 @@ struct sqlite3_pcache_page {
9537
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
9538
** created will be used to cache database pages of a file stored on disk, or
9539
** false if it is used for an in-memory database. The cache implementation
9540
-** does not have to do anything special based with the value of bPurgeable;
9540
+** does not have to do anything special based upon the value of bPurgeable;
9541
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
9542
** never invoke xUnpin() except to deliberately delete a page.
9543
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
9544
** false will always have the "discard" flag set to true.
9545
-** ^Hence, a cache created with bPurgeable false will
9545
+** ^Hence, a cache created with bPurgeable set to false will
9546
** never contain any unpinned pages.
9547
**
9548
** [[the xCachesize() page cache method]]
9549
** ^(The xCachesize() method may be called at any time by SQLite to set the
9550
-** suggested maximum cache-size (number of pages stored by) the cache
9550
+** suggested maximum cache-size (number of pages stored) for the cache
9551
** instance passed as the first argument. This is the value configured using
9552
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
9553
** parameter, the implementation is not required to do anything with this
@@ -9574,12 +9574,12 @@ struct sqlite3_pcache_page {
9574
** implementation must return a pointer to the page buffer with its content
9575
** intact. If the requested page is not already in the cache, then the
9576
** cache implementation should use the value of the createFlag
9577
-** parameter to help it determined what action to take:
9577
+** parameter to help it determine what action to take:
9578
**
9579
** <table border=1 width=85% align=center>
9580
** <tr><th> createFlag <th> Behavior when page is not already in cache
9581
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9582
-** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
9582
+** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
9583
** Otherwise return NULL.
9584
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
9585
** NULL if allocating a new page is effectively impossible.
@@ -9596,7 +9596,7 @@ struct sqlite3_pcache_page {
9596
** as its second argument. If the third parameter, discard, is non-zero,
9597
** then the page must be evicted from the cache.
9598
** ^If the discard parameter is
9599
-** zero, then the page may be discarded or retained at the discretion of
9599
+** zero, then the page may be discarded or retained at the discretion of the
9600
** page cache implementation. ^The page cache implementation
9601
** may choose to evict unpinned pages at any time.
9602
**
@@ -9614,7 +9614,7 @@ struct sqlite3_pcache_page {
9614
** When SQLite calls the xTruncate() method, the cache must discard all
9615
** existing cache entries with page numbers (keys) greater than or equal
9616
** to the value of the iLimit parameter passed to xTruncate(). If any
9617
-** of these pages are pinned, they are implicitly unpinned, meaning that
9617
+** of these pages are pinned, they become implicitly unpinned, meaning that
9618
** they can be safely discarded.
9619
**
9620
** [[the xDestroy() page cache method]]
@@ -9913,7 +9913,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
9913
** application receives an SQLITE_LOCKED error, it may call the
9914
** sqlite3_unlock_notify() method with the blocked connection handle as
9915
** the first argument to register for a callback that will be invoked
9916
-** when the blocking connections current transaction is concluded. ^The
9916
+** when the blocking connection's current transaction is concluded. ^The
9917
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9918
** call that concludes the blocking connection's transaction.
9919
**
@@ -9933,7 +9933,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
9933
** blocked connection already has a registered unlock-notify callback,
9934
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
9935
** called with a NULL pointer as its second argument, then any existing
9936
-** unlock-notify callback is canceled. ^The blocked connections
9936
+** unlock-notify callback is canceled. ^The blocked connection's
9937
** unlock-notify callback may also be canceled by closing the blocked
9938
** connection using [sqlite3_close()].
9939
**
@@ -10331,7 +10331,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
10331
** support constraints. In this configuration (which is the default) if
10332
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
10333
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10334
-** specified as part of the users SQL statement, regardless of the actual
10334
+** specified as part of the user's SQL statement, regardless of the actual
10335
** ON CONFLICT mode specified.
10336
**
10337
** If X is non-zero, then the virtual table implementation guarantees
@@ -10365,7 +10365,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
10365
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
10366
** <dd>Calls of the form
10367
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10368
-** the [xConnect] or [xCreate] methods of a [virtual table] implementation
10368
+** [xConnect] or [xCreate] methods of a [virtual table] implementation
10369
** identify that virtual table as being safe to use from within triggers
10370
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
10371
** virtual table can do no serious harm even if it is controlled by a
@@ -10533,7 +10533,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
10533
** </table>
10534
**
10535
** ^For the purposes of comparing virtual table output values to see if the
10536
-** values are same value for sorting purposes, two NULL values are considered
10536
+** values are the same value for sorting purposes, two NULL values are considered
10537
** to be the same. In other words, the comparison operator is "IS"
10538
** (or "IS NOT DISTINCT FROM") and not "==".
10539
**
@@ -10543,7 +10543,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
10543
**
10544
** ^A virtual table implementation is always free to return rows in any order
10545
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10546
-** the "orderByConsumed" flag is unset, the query planner will add extra
10546
+** "orderByConsumed" flag is unset, the query planner will add extra
10547
** [bytecode] to ensure that the final results returned by the SQL query are
10548
** ordered correctly. The use of the "orderByConsumed" flag and the
10549
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
@@ -10640,7 +10640,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
10640
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
10641
** xFilter method which invokes these routines, and specifically
10642
** a parameter that was previously selected for all-at-once IN constraint
10643
-** processing use the [sqlite3_vtab_in()] interface in the
10643
+** processing using the [sqlite3_vtab_in()] interface in the
10644
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
10645
** an xFilter argument that was selected for all-at-once IN constraint
10646
** processing, then these routines return [SQLITE_ERROR].)^
@@ -10695,7 +10695,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
10695
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
10696
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
10697
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10698
-** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
10698
+** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
10699
** something goes wrong.
10700
**
10701
** The sqlite3_vtab_rhs_value() interface is usually only successful if
@@ -10723,8 +10723,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10723
** KEYWORDS: {conflict resolution mode}
10724
**
10725
** These constants are returned by [sqlite3_vtab_on_conflict()] to
10726
-** inform a [virtual table] implementation what the [ON CONFLICT] mode
10727
-** is for the SQL statement being evaluated.
10726
+** inform a [virtual table] implementation of the [ON CONFLICT] mode
10727
+** for the SQL statement being evaluated.
10728
**
10729
** Note that the [SQLITE_IGNORE] constant is also used as a potential
10730
** return value from the [sqlite3_set_authorizer()] callback and that
@@ -10764,39 +10764,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10764
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
10765
** <dd>^The "double" variable pointed to by the V parameter will be set to the
10766
** query planner's estimate for the average number of rows output from each
10767
-** iteration of the X-th loop. If the query planner's estimates was accurate,
10767
+** iteration of the X-th loop. If the query planner's estimate was accurate,
10768
** then this value will approximate the quotient NVISIT/NLOOP and the
10769
** product of this value for all prior loops with the same SELECTID will
10770
-** be the NLOOP value for the current loop.
10770
+** be the NLOOP value for the current loop.</dd>
10771
**
10772
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
10773
** <dd>^The "const char *" variable pointed to by the V parameter will be set
10774
** to a zero-terminated UTF-8 string containing the name of the index or table
10775
-** used for the X-th loop.
10775
+** used for the X-th loop.</dd>
10776
**
10777
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
10778
** <dd>^The "const char *" variable pointed to by the V parameter will be set
10779
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10780
-** description for the X-th loop.
10780
+** description for the X-th loop.</dd>
10781
**
10782
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
10783
** <dd>^The "int" variable pointed to by the V parameter will be set to the
10784
** id for the X-th query plan element. The id value is unique within the
10785
** statement. The select-id is the same value as is output in the first
10786
-** column of an [EXPLAIN QUERY PLAN] query.
10786
+** column of an [EXPLAIN QUERY PLAN] query.</dd>
10787
**
10788
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10789
** <dd>The "int" variable pointed to by the V parameter will be set to the
10790
-** the id of the parent of the current query element, if applicable, or
10790
+** id of the parent of the current query element, if applicable, or
10791
** to zero if the query element has no parent. This is the same value as
10792
-** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10792
+** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
10793
**
10794
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10795
** <dd>The sqlite3_int64 output value is set to the number of cycles,
10796
** according to the processor time-stamp counter, that elapsed while the
10797
** query element was being processed. This value is not available for
10798
** all query elements - if it is unavailable the output variable is
10799
-** set to -1.
10799
+** set to -1.</dd>
10800
** </dl>
10801
*/
10802
#define SQLITE_SCANSTAT_NLOOP 0
@@ -10837,8 +10837,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10837
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10838
**
10839
** Parameter "idx" identifies the specific query element to retrieve statistics
10840
-** for. Query elements are numbered starting from zero. A value of -1 may be
10841
-** to query for statistics regarding the entire query. ^If idx is out of range
10840
+** for. Query elements are numbered starting from zero. A value of -1 may
10841
+** retrieve statistics for the entire query. ^If idx is out of range
10842
** - less than -1 or greater than or equal to the total number of query
10843
** elements used to implement the statement - a non-zero value is returned and
10844
** the variable that pOut points to is unchanged.
@@ -10995,8 +10995,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
10995
** triggers; and so forth.
10996
**
10997
** When the [sqlite3_blob_write()] API is used to update a blob column,
10998
-** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10999
-** in this case the new values are not available. In this case, when a
10998
+** the pre-update hook is invoked with SQLITE_DELETE, because
10999
+** the new values are not yet available. In this case, when a
11000
** callback made with op==SQLITE_DELETE is actually a write using the
11001
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
11002
** the index of the column being written. In other cases, where the
@@ -11249,7 +11249,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
11249
** For an ordinary on-disk database file, the serialization is just a
11250
** copy of the disk file. For an in-memory database or a "TEMP" database,
11251
** the serialization is the same sequence of bytes which would be written
11252
-** to disk if that database where backed up to disk.
11252
+** to disk if that database were backed up to disk.
11253
**
11254
** The usual case is that sqlite3_serialize() copies the serialization of
11255
** the database into memory obtained from [sqlite3_malloc64()] and returns
@@ -11258,7 +11258,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
11258
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
11259
** are made, and the sqlite3_serialize() function will return a pointer
11260
** to the contiguous memory representation of the database that SQLite
11261
-** is currently using for that database, or NULL if the no such contiguous
11261
+** is currently using for that database, or NULL if no such contiguous
11262
** memory representation of the database exists. A contiguous memory
11263
** representation of the database will usually only exist if there has
11264
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
@@ -11329,7 +11329,7 @@ SQLITE_API unsigned char *sqlite3_serialize(
11329
** database is currently in a read transaction or is involved in a backup
11330
** operation.
11331
**
11332
-** It is not possible to deserialized into the TEMP database. If the
11332
+** It is not possible to deserialize into the TEMP database. If the
11333
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
11334
** function returns SQLITE_ERROR.
11335
**
@@ -11351,7 +11351,7 @@ SQLITE_API int sqlite3_deserialize(
11351
sqlite3 *db, /* The database connection */
11352
const char *zSchema, /* Which DB to reopen with the deserialization */
11353
unsigned char *pData, /* The serialized database content */
11354
- sqlite3_int64 szDb, /* Number bytes in the deserialization */
11354
+ sqlite3_int64 szDb, /* Number of bytes in the deserialization */
11355
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
11356
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
11357
);
@@ -11359,7 +11359,7 @@ SQLITE_API int sqlite3_deserialize(
11359
/*
11360
** CAPI3REF: Flags for sqlite3_deserialize()
11361
**
11362
-** The following are allowed values for 6th argument (the F argument) to
11362
+** The following are allowed values for the 6th argument (the F argument) to
11363
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
11364
**
11365
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
@@ -19176,7 +19176,6 @@ struct Index {
19176
unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */
19177
unsigned bNoQuery:1; /* Do not use this index to optimize queries */
19178
unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */
19179
- unsigned bIdxRowid:1; /* One or more of the index keys is the ROWID */
19179
unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
19180
unsigned bHasExpr:1; /* Index contains an expression, either a literal
19181
** expression, or a reference to a VIRTUAL column */
@@ -19449,6 +19448,7 @@ struct Expr {
19448
Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL
19449
** for a column of an index on an expression */
19450
Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */
19451
+ int nReg; /* TK_NULLS: Number of registers to NULL out */
19452
struct { /* TK_IN, TK_SELECT, and TK_EXISTS */
19453
int iAddr; /* Subroutine entry address */
19454
int regReturn; /* Register used to hold return address */
@@ -21483,6 +21483,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Table*, Column*, int)
21483
SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int);
21484
SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int);
21485
SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(Parse*, Expr*, int);
21486
+SQLITE_PRIVATE void sqlite3ExprNullRegisterRange(Parse*, int, int);
21487
SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
21488
SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int);
21489
SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8);
@@ -111496,7 +111497,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
111497
return pLeft;
111498
}else{
111499
u32 f = pLeft->flags | pRight->flags;
111499
- if( (f&(EP_OuterON|EP_InnerON|EP_IsFalse))==EP_IsFalse
111500
+ if( (f&(EP_OuterON|EP_InnerON|EP_IsFalse|EP_HasFunc))==EP_IsFalse
111501
&& !IN_RENAME_OBJECT
111502
){
111503
sqlite3ExprDeferredDelete(pParse, pLeft);
@@ -115250,6 +115251,12 @@ expr_code_doover:
115251
sqlite3VdbeLoadString(v, target, pExpr->u.zToken);
115252
return target;
115253
}
115254
+ case TK_NULLS: {
115255
+ /* Set a range of registers to NULL. pExpr->y.nReg registers starting
115256
+ ** with target */
115257
+ sqlite3VdbeAddOp3(v, OP_Null, 0, target, target + pExpr->y.nReg - 1);
115258
+ return target;
115259
+ }
115260
default: {
115261
/* Make NULL the default case so that if a bug causes an illegal
115262
** Expr node to be passed into this function, it will be handled
@@ -115934,6 +115941,25 @@ SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce(
115941
return regDest;
115942
}
115943
115944
+/*
115945
+** Make arrangements to invoke OP_Null on a range of registers
115946
+** during initialization.
115947
+*/
115948
+SQLITE_PRIVATE SQLITE_NOINLINE void sqlite3ExprNullRegisterRange(
115949
+ Parse *pParse, /* Parsing context */
115950
+ int iReg, /* First register to set to NULL */
115951
+ int nReg /* Number of sequential registers to NULL out */
115952
+){
115953
+ u8 okConstFactor = pParse->okConstFactor;
115954
+ Expr t;
115955
+ memset(&t, 0, sizeof(t));
115956
+ t.op = TK_NULLS;
115957
+ t.y.nReg = nReg;
115958
+ pParse->okConstFactor = 1;
115959
+ sqlite3ExprCodeRunJustOnce(pParse, &t, iReg);
115960
+ pParse->okConstFactor = okConstFactor;
115961
+}
115962
+
115963
/*
115964
** Generate code to evaluate an expression and store the results
115965
** into a register. Return the register number where the results
@@ -127204,7 +127230,6 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
127230
assert( j<=0x7fff );
127231
if( j<0 ){
127232
j = pTab->iPKey;
127207
- pIndex->bIdxRowid = 1;
127233
}else{
127234
if( pTab->aCol[j].notNull==0 ){
127235
pIndex->uniqNotNull = 0;
@@ -153185,6 +153210,7 @@ SQLITE_PRIVATE int sqlite3Select(
153210
sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag);
153211
VdbeComment((v, "clear abort flag"));
153212
sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1);
153213
+ sqlite3ExprNullRegisterRange(pParse, iAMem, pGroupBy->nExpr);
153214
153215
/* Begin a loop that will extract all source rows in GROUP BY order.
153216
** This might involve two separate loops with an OP_Sort in between, or
@@ -160181,7 +160207,9 @@ static Expr *removeUnindexableInClauseTerms(
160207
int iField;
160208
assert( (pLoop->aLTerm[i]->eOperator & (WO_OR|WO_AND))==0 );
160209
iField = pLoop->aLTerm[i]->u.x.iField - 1;
160184
- if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */
160210
+ if( NEVER(pOrigRhs->a[iField].pExpr==0) ){
160211
+ continue; /* Duplicate PK column */
160212
+ }
160213
pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr);
160214
pOrigRhs->a[iField].pExpr = 0;
160215
if( pRhs ) pRhs->a[pRhs->nExpr-1].u.x.iOrderByCol = iField+1;
@@ -160278,7 +160306,7 @@ static SQLITE_NOINLINE void codeINTerm(
160306
return;
160307
}
160308
}
160281
- for(i=iEq;i<pLoop->nLTerm; i++){
160309
+ for(i=iEq; i<pLoop->nLTerm; i++){
160310
assert( pLoop->aLTerm[i]!=0 );
160311
if( pLoop->aLTerm[i]->pExpr==pX ) nEq++;
160312
}
@@ -160287,22 +160315,13 @@ static SQLITE_NOINLINE void codeINTerm(
160315
if( !ExprUseXSelect(pX) || pX->x.pSelect->pEList->nExpr==1 ){
160316
eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab);
160317
}else{
160290
- Expr *pExpr = pTerm->pExpr;
160291
- if( pExpr->iTable==0 || !ExprHasProperty(pExpr, EP_Subrtn) ){
160292
- sqlite3 *db = pParse->db;
160293
- pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
160294
- if( !db->mallocFailed ){
160295
- aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq);
160296
- eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap,&iTab);
160297
- pExpr->iTable = iTab;
160298
- }
160299
- sqlite3ExprDelete(db, pX);
160300
- }else{
160301
- int n = sqlite3ExprVectorSize(pX->pLeft);
160302
- aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*MAX(nEq,n));
160303
- eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap, &iTab);
160318
+ sqlite3 *db = pParse->db;
160319
+ Expr *pXMod = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX);
160320
+ if( !db->mallocFailed ){
160321
+ aiMap = (int*)sqlite3DbMallocZero(db, sizeof(int)*nEq);
160322
+ eType = sqlite3FindInIndex(pParse, pXMod, IN_INDEX_LOOP, 0, aiMap, &iTab);
160323
}
160305
- pX = pExpr;
160324
+ sqlite3ExprDelete(db, pXMod);
160325
}
160326
160327
if( eType==IN_INDEX_INDEX_DESC ){
@@ -160332,7 +160351,7 @@ static SQLITE_NOINLINE void codeINTerm(
160351
if( pIn ){
160352
int iMap = 0; /* Index in aiMap[] */
160353
pIn += i;
160335
- for(i=iEq;i<pLoop->nLTerm; i++){
160354
+ for(i=iEq; i<pLoop->nLTerm; i++){
160355
if( pLoop->aLTerm[i]->pExpr==pX ){
160356
int iOut = iTarget + i - iEq;
160357
if( eType==IN_INDEX_ROWID ){
@@ -167690,6 +167709,7 @@ static int whereLoopAddBtreeIndex(
167709
if( ExprUseXSelect(pExpr) ){
167710
/* "x IN (SELECT ...)": TUNING: the SELECT returns 25 rows */
167711
int i;
167712
+ int bRedundant = 0;
167713
nIn = 46; assert( 46==sqlite3LogEst(25) );
167714
167715
/* The expression may actually be of the form (x, y) IN (SELECT...).
@@ -167698,7 +167718,20 @@ static int whereLoopAddBtreeIndex(
167718
** for each such term. The following loop checks that pTerm is the
167719
** first such term in use, and sets nIn back to 0 if it is not. */
167720
for(i=0; i<pNew->nLTerm-1; i++){
167701
- if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0;
167721
+ if( pNew->aLTerm[i] && pNew->aLTerm[i]->pExpr==pExpr ){
167722
+ nIn = 0;
167723
+ if( pNew->aLTerm[i]->u.x.iField == pTerm->u.x.iField ){
167724
+ /* Detect when two or more columns of an index match the same
167725
+ ** column of a vector IN operater, and avoid adding the column
167726
+ ** to the WhereLoop more than once. See tag-20250707-01
167727
+ ** in test/rowvalue.test */
167728
+ bRedundant = 1;
167729
+ }
167730
+ }
167731
+ }
167732
+ if( bRedundant ){
167733
+ pNew->nLTerm--;
167734
+ continue;
167735
}
167736
}else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){
167737
/* "x IN (value, value, ...)" */
@@ -167930,7 +167963,7 @@ static int whereLoopAddBtreeIndex(
167963
if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
167964
&& pNew->u.btree.nEq<pProbe->nColumn
167965
&& (pNew->u.btree.nEq<pProbe->nKeyCol ||
167933
- (pProbe->idxType!=SQLITE_IDXTYPE_PRIMARYKEY && !pProbe->bIdxRowid))
167966
+ pProbe->idxType!=SQLITE_IDXTYPE_PRIMARYKEY)
167967
){
167968
if( pNew->u.btree.nEq>3 ){
167969
sqlite3ProgressCheck(pParse);
@@ -168473,6 +168506,7 @@ static int whereLoopAddBtree(
168506
pNew->u.btree.nEq = 0;
168507
pNew->u.btree.nBtm = 0;
168508
pNew->u.btree.nTop = 0;
168509
+ pNew->u.btree.nDistinctCol = 0;
168510
pNew->nSkip = 0;
168511
pNew->nLTerm = 0;
168512
pNew->iSortIdx = 0;
@@ -169541,8 +169575,6 @@ static i8 wherePathSatisfiesOrderBy(
169575
obSat = obDone;
169576
}
169577
break;
169544
- }else if( wctrlFlags & WHERE_DISTINCTBY ){
169545
- pLoop->u.btree.nDistinctCol = 0;
169578
}
169579
iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor;
169580
@@ -179921,12 +179953,21 @@ static YYACTIONTYPE yy_reduce(
179953
** expr1 IN ()
179954
** expr1 NOT IN ()
179955
**
179924
- ** simplify to constants 0 (false) and 1 (true), respectively,
179925
- ** regardless of the value of expr1.
179956
+ ** simplify to constants 0 (false) and 1 (true), respectively.
179957
+ **
179958
+ ** Except, do not apply this optimization if expr1 contains a function
179959
+ ** because that function might be an aggregate (we don't know yet whether
179960
+ ** it is or not) and if it is an aggregate, that could change the meaning
179961
+ ** of the whole query.
179962
*/
179927
- sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy590);
179928
- yymsp[-4].minor.yy590 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy502 ? "true" : "false");
179929
- if( yymsp[-4].minor.yy590 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy590);
179963
+ Expr *pB = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy502 ? "true" : "false");
179964
+ if( pB ) sqlite3ExprIdToTrueFalse(pB);
179965
+ if( !ExprHasProperty(yymsp[-4].minor.yy590, EP_HasFunc) ){
179966
+ sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy590);
179967
+ yymsp[-4].minor.yy590 = pB;
179968
+ }else{
179969
+ yymsp[-4].minor.yy590 = sqlite3PExpr(pParse, yymsp[-3].minor.yy502 ? TK_OR : TK_AND, pB, yymsp[-4].minor.yy590);
179970
+ }
179971
}else{
179972
Expr *pRHS = yymsp[-1].minor.yy402->a[0].pExpr;
179973
if( yymsp[-1].minor.yy402->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy590->op!=TK_VECTOR ){
@@ -181532,7 +181573,7 @@ static int getToken(const unsigned char **pz){
181573
int t; /* Token type to return */
181574
do {
181575
z += sqlite3GetToken(z, &t);
181535
- }while( t==TK_SPACE );
181576
+ }while( t==TK_SPACE || t==TK_COMMENT );
181577
if( t==TK_ID
181578
|| t==TK_STRING
181579
|| t==TK_JOIN_KW
@@ -246187,9 +246228,9 @@ static void fts5SegIterSetNext(Fts5Index *p, Fts5SegIter *pIter){
246228
** leave an error in the Fts5Index object.
246229
*/
246230
static void fts5SegIterAllocTombstone(Fts5Index *p, Fts5SegIter *pIter){
246190
- const int nTomb = pIter->pSeg->nPgTombstone;
246231
+ const i64 nTomb = (i64)pIter->pSeg->nPgTombstone;
246232
if( nTomb>0 ){
246192
- int nByte = SZ_FTS5TOMBSTONEARRAY(nTomb+1);
246233
+ i64 nByte = SZ_FTS5TOMBSTONEARRAY(nTomb+1);
246234
Fts5TombstoneArray *pNew;
246235
pNew = (Fts5TombstoneArray*)sqlite3Fts5MallocZero(&p->rc, nByte);
246236
if( pNew ){
@@ -257290,7 +257331,7 @@ static void fts5SourceIdFunc(
257331
){
257332
assert( nArg==0 );
257333
UNUSED_PARAM2(nArg, apUnused);
257293
- sqlite3_result_text(pCtx, "fts5: 2025-06-28 14:00:48 2af157d77fb1304a74176eaee7fbc7c7e932d946bf25325e9c26c91db19e3079", -1, SQLITE_TRANSIENT);
257334
+ sqlite3_result_text(pCtx, "fts5: 2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3", -1, SQLITE_TRANSIENT);
257335
}
257336
257337
/*
src/database/sqlite/vendored/sqlite3.h
+45
-45
@@ -146,9 +146,9 @@ extern "C" {
146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147
** [sqlite_version()] and [sqlite_source_id()].
148
*/
149
-#define SQLITE_VERSION "3.50.2"
150
-#define SQLITE_VERSION_NUMBER 3050002
151
-#define SQLITE_SOURCE_ID "2025-06-28 14:00:48 2af157d77fb1304a74176eaee7fbc7c7e932d946bf25325e9c26c91db19e3079"
149
+#define SQLITE_VERSION "3.50.4"
150
+#define SQLITE_VERSION_NUMBER 3050004
151
+#define SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3"
152
153
/*
154
** CAPI3REF: Run-Time Library Version Numbers
@@ -9058,13 +9058,13 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
9058
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
9059
** <dd>^This is the number of sort operations that have occurred.
9060
** A non-zero value in this counter may indicate an opportunity to
9061
-** improvement performance through careful use of indices.</dd>
9061
+** improve performance through careful use of indices.</dd>
9062
**
9063
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
9064
** <dd>^This is the number of rows inserted into transient indices that
9065
** were created automatically in order to help joins run faster.
9066
** A non-zero value in this counter may indicate an opportunity to
9067
-** improvement performance by adding permanent indices that do not
9067
+** improve performance by adding permanent indices that do not
9068
** need to be reinitialized each time the statement is run.</dd>
9069
**
9070
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
@@ -9073,19 +9073,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
9073
** to 2147483647. The number of virtual machine operations can be
9074
** used as a proxy for the total work done by the prepared statement.
9075
** If the number of virtual machine operations exceeds 2147483647
9076
-** then the value returned by this statement status code is undefined.
9076
+** then the value returned by this statement status code is undefined.</dd>
9077
**
9078
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
9079
** <dd>^This is the number of times that the prepare statement has been
9080
** automatically regenerated due to schema changes or changes to
9081
-** [bound parameters] that might affect the query plan.
9081
+** [bound parameters] that might affect the query plan.</dd>
9082
**
9083
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
9084
** <dd>^This is the number of times that the prepared statement has
9085
** been run. A single "run" for the purposes of this counter is one
9086
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
9087
** The counter is incremented on the first [sqlite3_step()] call of each
9088
-** cycle.
9088
+** cycle.</dd>
9089
**
9090
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
9091
** [[SQLITE_STMTSTATUS_FILTER HIT]]
@@ -9095,7 +9095,7 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
9095
** step was bypassed because a Bloom filter returned not-found. The
9096
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
9097
** times that the Bloom filter returned a find, and thus the join step
9098
-** had to be processed as normal.
9098
+** had to be processed as normal.</dd>
9099
**
9100
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
9101
** <dd>^This is the approximate number of bytes of heap memory
@@ -9200,9 +9200,9 @@ struct sqlite3_pcache_page {
9200
** SQLite will typically create one cache instance for each open database file,
9201
** though this is not guaranteed. ^The
9202
** first parameter, szPage, is the size in bytes of the pages that must
9203
-** be allocated by the cache. ^szPage will always a power of two. ^The
9203
+** be allocated by the cache. ^szPage will always be a power of two. ^The
9204
** second parameter szExtra is a number of bytes of extra storage
9205
-** associated with each page cache entry. ^The szExtra parameter will
9205
+** associated with each page cache entry. ^The szExtra parameter will be
9206
** a number less than 250. SQLite will use the
9207
** extra szExtra bytes on each page to store metadata about the underlying
9208
** database page on disk. The value passed into szExtra depends
@@ -9210,17 +9210,17 @@ struct sqlite3_pcache_page {
9210
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
9211
** created will be used to cache database pages of a file stored on disk, or
9212
** false if it is used for an in-memory database. The cache implementation
9213
-** does not have to do anything special based with the value of bPurgeable;
9213
+** does not have to do anything special based upon the value of bPurgeable;
9214
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
9215
** never invoke xUnpin() except to deliberately delete a page.
9216
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
9217
** false will always have the "discard" flag set to true.
9218
-** ^Hence, a cache created with bPurgeable false will
9218
+** ^Hence, a cache created with bPurgeable set to false will
9219
** never contain any unpinned pages.
9220
**
9221
** [[the xCachesize() page cache method]]
9222
** ^(The xCachesize() method may be called at any time by SQLite to set the
9223
-** suggested maximum cache-size (number of pages stored by) the cache
9223
+** suggested maximum cache-size (number of pages stored) for the cache
9224
** instance passed as the first argument. This is the value configured using
9225
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
9226
** parameter, the implementation is not required to do anything with this
@@ -9247,12 +9247,12 @@ struct sqlite3_pcache_page {
9247
** implementation must return a pointer to the page buffer with its content
9248
** intact. If the requested page is not already in the cache, then the
9249
** cache implementation should use the value of the createFlag
9250
-** parameter to help it determined what action to take:
9250
+** parameter to help it determine what action to take:
9251
**
9252
** <table border=1 width=85% align=center>
9253
** <tr><th> createFlag <th> Behavior when page is not already in cache
9254
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9255
-** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
9255
+** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
9256
** Otherwise return NULL.
9257
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
9258
** NULL if allocating a new page is effectively impossible.
@@ -9269,7 +9269,7 @@ struct sqlite3_pcache_page {
9269
** as its second argument. If the third parameter, discard, is non-zero,
9270
** then the page must be evicted from the cache.
9271
** ^If the discard parameter is
9272
-** zero, then the page may be discarded or retained at the discretion of
9272
+** zero, then the page may be discarded or retained at the discretion of the
9273
** page cache implementation. ^The page cache implementation
9274
** may choose to evict unpinned pages at any time.
9275
**
@@ -9287,7 +9287,7 @@ struct sqlite3_pcache_page {
9287
** When SQLite calls the xTruncate() method, the cache must discard all
9288
** existing cache entries with page numbers (keys) greater than or equal
9289
** to the value of the iLimit parameter passed to xTruncate(). If any
9290
-** of these pages are pinned, they are implicitly unpinned, meaning that
9290
+** of these pages are pinned, they become implicitly unpinned, meaning that
9291
** they can be safely discarded.
9292
**
9293
** [[the xDestroy() page cache method]]
@@ -9586,7 +9586,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
9586
** application receives an SQLITE_LOCKED error, it may call the
9587
** sqlite3_unlock_notify() method with the blocked connection handle as
9588
** the first argument to register for a callback that will be invoked
9589
-** when the blocking connections current transaction is concluded. ^The
9589
+** when the blocking connection's current transaction is concluded. ^The
9590
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9591
** call that concludes the blocking connection's transaction.
9592
**
@@ -9606,7 +9606,7 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
9606
** blocked connection already has a registered unlock-notify callback,
9607
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
9608
** called with a NULL pointer as its second argument, then any existing
9609
-** unlock-notify callback is canceled. ^The blocked connections
9609
+** unlock-notify callback is canceled. ^The blocked connection's
9610
** unlock-notify callback may also be canceled by closing the blocked
9611
** connection using [sqlite3_close()].
9612
**
@@ -10004,7 +10004,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
10004
** support constraints. In this configuration (which is the default) if
10005
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
10006
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10007
-** specified as part of the users SQL statement, regardless of the actual
10007
+** specified as part of the user's SQL statement, regardless of the actual
10008
** ON CONFLICT mode specified.
10009
**
10010
** If X is non-zero, then the virtual table implementation guarantees
@@ -10038,7 +10038,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
10038
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
10039
** <dd>Calls of the form
10040
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10041
-** the [xConnect] or [xCreate] methods of a [virtual table] implementation
10041
+** [xConnect] or [xCreate] methods of a [virtual table] implementation
10042
** identify that virtual table as being safe to use from within triggers
10043
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
10044
** virtual table can do no serious harm even if it is controlled by a
@@ -10206,7 +10206,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
10206
** </table>
10207
**
10208
** ^For the purposes of comparing virtual table output values to see if the
10209
-** values are same value for sorting purposes, two NULL values are considered
10209
+** values are the same value for sorting purposes, two NULL values are considered
10210
** to be the same. In other words, the comparison operator is "IS"
10211
** (or "IS NOT DISTINCT FROM") and not "==".
10212
**
@@ -10216,7 +10216,7 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
10216
**
10217
** ^A virtual table implementation is always free to return rows in any order
10218
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10219
-** the "orderByConsumed" flag is unset, the query planner will add extra
10219
+** "orderByConsumed" flag is unset, the query planner will add extra
10220
** [bytecode] to ensure that the final results returned by the SQL query are
10221
** ordered correctly. The use of the "orderByConsumed" flag and the
10222
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
@@ -10313,7 +10313,7 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
10313
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
10314
** xFilter method which invokes these routines, and specifically
10315
** a parameter that was previously selected for all-at-once IN constraint
10316
-** processing use the [sqlite3_vtab_in()] interface in the
10316
+** processing using the [sqlite3_vtab_in()] interface in the
10317
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
10318
** an xFilter argument that was selected for all-at-once IN constraint
10319
** processing, then these routines return [SQLITE_ERROR].)^
@@ -10368,7 +10368,7 @@ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
10368
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
10369
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
10370
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10371
-** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
10371
+** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
10372
** something goes wrong.
10373
**
10374
** The sqlite3_vtab_rhs_value() interface is usually only successful if
@@ -10396,8 +10396,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10396
** KEYWORDS: {conflict resolution mode}
10397
**
10398
** These constants are returned by [sqlite3_vtab_on_conflict()] to
10399
-** inform a [virtual table] implementation what the [ON CONFLICT] mode
10400
-** is for the SQL statement being evaluated.
10399
+** inform a [virtual table] implementation of the [ON CONFLICT] mode
10400
+** for the SQL statement being evaluated.
10401
**
10402
** Note that the [SQLITE_IGNORE] constant is also used as a potential
10403
** return value from the [sqlite3_set_authorizer()] callback and that
@@ -10437,39 +10437,39 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10437
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
10438
** <dd>^The "double" variable pointed to by the V parameter will be set to the
10439
** query planner's estimate for the average number of rows output from each
10440
-** iteration of the X-th loop. If the query planner's estimates was accurate,
10440
+** iteration of the X-th loop. If the query planner's estimate was accurate,
10441
** then this value will approximate the quotient NVISIT/NLOOP and the
10442
** product of this value for all prior loops with the same SELECTID will
10443
-** be the NLOOP value for the current loop.
10443
+** be the NLOOP value for the current loop.</dd>
10444
**
10445
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
10446
** <dd>^The "const char *" variable pointed to by the V parameter will be set
10447
** to a zero-terminated UTF-8 string containing the name of the index or table
10448
-** used for the X-th loop.
10448
+** used for the X-th loop.</dd>
10449
**
10450
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
10451
** <dd>^The "const char *" variable pointed to by the V parameter will be set
10452
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10453
-** description for the X-th loop.
10453
+** description for the X-th loop.</dd>
10454
**
10455
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
10456
** <dd>^The "int" variable pointed to by the V parameter will be set to the
10457
** id for the X-th query plan element. The id value is unique within the
10458
** statement. The select-id is the same value as is output in the first
10459
-** column of an [EXPLAIN QUERY PLAN] query.
10459
+** column of an [EXPLAIN QUERY PLAN] query.</dd>
10460
**
10461
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10462
** <dd>The "int" variable pointed to by the V parameter will be set to the
10463
-** the id of the parent of the current query element, if applicable, or
10463
+** id of the parent of the current query element, if applicable, or
10464
** to zero if the query element has no parent. This is the same value as
10465
-** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10465
+** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
10466
**
10467
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10468
** <dd>The sqlite3_int64 output value is set to the number of cycles,
10469
** according to the processor time-stamp counter, that elapsed while the
10470
** query element was being processed. This value is not available for
10471
** all query elements - if it is unavailable the output variable is
10472
-** set to -1.
10472
+** set to -1.</dd>
10473
** </dl>
10474
*/
10475
#define SQLITE_SCANSTAT_NLOOP 0
@@ -10510,8 +10510,8 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
10510
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10511
**
10512
** Parameter "idx" identifies the specific query element to retrieve statistics
10513
-** for. Query elements are numbered starting from zero. A value of -1 may be
10514
-** to query for statistics regarding the entire query. ^If idx is out of range
10513
+** for. Query elements are numbered starting from zero. A value of -1 may
10514
+** retrieve statistics for the entire query. ^If idx is out of range
10515
** - less than -1 or greater than or equal to the total number of query
10516
** elements used to implement the statement - a non-zero value is returned and
10517
** the variable that pOut points to is unchanged.
@@ -10668,8 +10668,8 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
10668
** triggers; and so forth.
10669
**
10670
** When the [sqlite3_blob_write()] API is used to update a blob column,
10671
-** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10672
-** in this case the new values are not available. In this case, when a
10671
+** the pre-update hook is invoked with SQLITE_DELETE, because
10672
+** the new values are not yet available. In this case, when a
10673
** callback made with op==SQLITE_DELETE is actually a write using the
10674
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10675
** the index of the column being written. In other cases, where the
@@ -10922,7 +10922,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
10922
** For an ordinary on-disk database file, the serialization is just a
10923
** copy of the disk file. For an in-memory database or a "TEMP" database,
10924
** the serialization is the same sequence of bytes which would be written
10925
-** to disk if that database where backed up to disk.
10925
+** to disk if that database were backed up to disk.
10926
**
10927
** The usual case is that sqlite3_serialize() copies the serialization of
10928
** the database into memory obtained from [sqlite3_malloc64()] and returns
@@ -10931,7 +10931,7 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
10931
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
10932
** are made, and the sqlite3_serialize() function will return a pointer
10933
** to the contiguous memory representation of the database that SQLite
10934
-** is currently using for that database, or NULL if the no such contiguous
10934
+** is currently using for that database, or NULL if no such contiguous
10935
** memory representation of the database exists. A contiguous memory
10936
** representation of the database will usually only exist if there has
10937
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
@@ -11002,7 +11002,7 @@ SQLITE_API unsigned char *sqlite3_serialize(
11002
** database is currently in a read transaction or is involved in a backup
11003
** operation.
11004
**
11005
-** It is not possible to deserialized into the TEMP database. If the
11005
+** It is not possible to deserialize into the TEMP database. If the
11006
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
11007
** function returns SQLITE_ERROR.
11008
**
@@ -11024,7 +11024,7 @@ SQLITE_API int sqlite3_deserialize(
11024
sqlite3 *db, /* The database connection */
11025
const char *zSchema, /* Which DB to reopen with the deserialization */
11026
unsigned char *pData, /* The serialized database content */
11027
- sqlite3_int64 szDb, /* Number bytes in the deserialization */
11027
+ sqlite3_int64 szDb, /* Number of bytes in the deserialization */
11028
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
11029
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
11030
);
@@ -11032,7 +11032,7 @@ SQLITE_API int sqlite3_deserialize(
11032
/*
11033
** CAPI3REF: Flags for sqlite3_deserialize()
11034
**
11035
-** The following are allowed values for 6th argument (the F argument) to
11035
+** The following are allowed values for the 6th argument (the F argument) to
11036
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
11037
**
11038
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization