aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
AgeCommit message (Collapse)AuthorLines
12 daysDo not use the xfer optimization if there is an INDEXED BY clause attached ↵dan-0/+3
to the source table. Report [bugs:/info/2026-11-04T20:25:01Z | 2026-11-04T20:25:01Z]. FossilOrigin-Name: 668c6503e8868dc4fa642cc71ae50e6cd7b5d224eb6d89af5fb9f853669e4cdd
12 daysDo not use the xfer optimization if FKs are enabled and the target table is ↵dan-8/+10
the parent table in an FK constraint. Report [bugs:/info/2026-11-04T20:24:15Z | 2026-11-04T20:24:15Z]. FossilOrigin-Name: 0be7c6e810ea8db60fff16492a672f1300a02e525814803f802ed8191e22099c
13 daysEnsure a statement that uses REPLACE conflict handling uses a statement ↵dan-0/+8
journal if a later index is on an expression or is a partial index, in case evaluating that expression or WHERE clause raises an error after the conflicting row has been deleted. Report [bugs:/info/2026-11-04T20:23:28Z | 2026-11-04T20:23:28Z]. FossilOrigin-Name: 75757ed3a5fefb9d641f2d3b51c51907b00c3195dbb109a74be84158c21be57b
2026-11-09Ensure that affinities are applied to the excluded.* values in a DO UPDATE ↵dan-0/+6
clause associated with an IPK confict. Report [bugs:/info/2026-11-03T02:17:21Z | 2026-11-03T02:17:21Z]. FossilOrigin-Name: ed9e4654058a6bdd2825b3735a652049b53b78a1cc23be1a9e4085af3592d0ad
2026-11-09When a VALUES clause is part of a compound SELECT, do not ignore collation ↵dan-3/+29
sequences attached to rows or SELECTs to the right of the first VALUES row. Report [bugs:/info/2026-11-03T02:16:35Z | 2026-11-03T02:16:35Z]. FossilOrigin-Name: 4d8d52d6544fa45ad0da3d9cb749a896e8b5ba420c91072c31d570938ed8669d
2026-10-05Correctly rollback "OR REPLACE" changes following a "datatype mismatch" error.drh-0/+2
[bugs:/info/2026-10-05T07:15:40Z|Bug 2026-10-05T07:15:40Z]. FossilOrigin-Name: 028f3f96a0af9fc71f1c191bbd44e0b7c3884d0571931b2808e4cdd1bb2f5081
2026-08-26Split the sqlite3ColumnExpr() routine out into two routines, one that worksdrh-9/+9
as before and the second sqlite3ColumnExprAuth() to deal with the authenticator in places where that is needed. FossilOrigin-Name: 51a1149bdcbe142b8eb92c2b817d3973bf88aaa73859e0c475505aa201da920b
2026-08-26An attempt to make the authorizer effective at preventing the use ofdrh-9/+9
some functions within the DEFAULT clause of a table. FossilOrigin-Name: 321e41b09179acba59958bdd6b07e4b7d915b9c0dfca143e4914b3690692c201
2026-08-23Correctly enforce a UNIQUE constraint on a non-PRIMARY KEY column of a tabledrh-1/+1
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-18Correctly process an "x IS TRUE" expression that appears in the second or ↵dan-14/+2
later rows of a VALUES() clause. Possible fix for report [bugs:/info/2026-08-18T05:06:40Z 2026-08-18T05:06:40Z]. FossilOrigin-Name: 1be96edbd5f695e8a12620e4d74d2b7bc7fb277a956c4b5e5ee8274121920c7b
2026-07-18After a DELETE trigger is fired by REPLACE conflict handling, retest all ↵dan-53/+69
UNIQUE constraints to ensure that the row being inserted or updated does not conflict with one written by the DELETE trigger. Abort the statement if it does. Possible fix for forum post [forum:/info/2026-07-18T03:35:48Z | 2026-07-18T03:35:48Z]. FossilOrigin-Name: e2ab286bb713e1358ae9a1d50dc894362d0ea6f1a2e8467c587f42f0e483dd3a
2026-07-17Ensure that a write with REPLACE conflict resolution on an integer primary ↵dan-5/+9
key column is handled after any IGNORE or FAIL conflicts, even if there is also an explicit "ON CONFLICT" clause unrelated to the IPK. Forum post [forum:/info/2026-07-17T09:30:42Z | 2026-07-17T09:30:42Z]. FossilOrigin-Name: 1875249ab30fb110bc09963b592c8f48d2fb57066d770ad7e1da7e8bc8602977
2026-06-17Small parsing performance improvement by reducing the amount of thedrh-1/+7
Parse object that needs to be initialized. FossilOrigin-Name: 0901b7c2dfb87707fa159f24ada5abb0a2914043c6f0571de4ce55c80edb663b
2026-05-21Enhance the xfer-optimization to verify access to the source table usingdrh-0/+12
the authorizer, if an authorizer is registered. [bugs:/info/2026-05-21T03:31:22Z|Bug 2026-05-21T03:31:22Z]. FossilOrigin-Name: d1cdb817cafd03a4081b254a71672ba07e5b637994d3f2f925532f17af0a67dc
2026-05-11Fix the xfer-optimization such that if the destination table hasdrh-1/+39
constraints on the hidden rowid, the optimization is not attempted. [forum:/forumpost/6dcc95e3ca|Forum post 6dcc95e3ca]. FossilOrigin-Name: da9ca357fb24f39a4a3292ca447773c6233a3084721abfbd5665a45ee8a4bed4
2026-05-11Fix the xfer optimization so that it does not work if the destination isdrh-2/+13
a STRICT table that is incompatible with the source. [forum:/forumpost/4955d2235c22ef4e|Forum post 4955d2235c22ef4e]. FossilOrigin-Name: 5e916b2a8fd41ffc42c29bfc9b5333b7a579f37fe094bd0b6b00e2f176c4e3fe
2026-04-22Instead of adding a branch to OP_IdxInsert, use an extra OP_IfNull when ↵dan-1/+4
updating indexes on expressions. FossilOrigin-Name: 5112f96cb1428693614b91bcca78326fccf7289e395a920339676ceeba871e3f
2025-06-18Enforce judgmental typing on STORED generated columns for STRICTdrh-1/+4
tables. [forum:/forumpost/6caf195248a849e4|Forum post 6caf195248]. FossilOrigin-Name: 5e9279bff0482806f86657ae05ca3e916708d138bc3c3ceb3fbf454818649d44
2025-04-10Remove unnecessary "www." prefixes on domain names in URLs.drh-1/+1
FossilOrigin-Name: 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6
2025-02-21Detect when a UNIQUE or PRIMARY KEY on a WITHOUT ROWID table would needdrh-1/+1
to use more than SQLITE_LIMIT_COLUMN columns and raise an error. Also include some unrelated compiler warning fixes. FossilOrigin-Name: d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3
2025-02-08Use the sqlite3ColumnIndex() routine to look up a column in a table, ratherdrh-20/+14
than using a custom loop. Performance improvement, size reduction, and complexity decrease. FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
2025-02-06Fix a harmless typo in a comment.drh-1/+1
FossilOrigin-Name: ed82272904deb37640286448e03153316f828c629547a615a504af1d7ec5a278
2025-01-28Simplifh the IdList object to remove unnecessary fields. Performancedrh-11/+12
increases by about 0.8%. FossilOrigin-Name: a4625bb995dd5582d1f3cf0c2e54eb3f01f1cc1405811dda86ebd38b2b858994
2025-01-27Use hashing to accelerate column matching on INSERT statements. Code isdrh-1/+4
smaller and about 1.8% faster overall according to test/speedtest.tcl. FossilOrigin-Name: 8be956383e0344fb613ec2e56fce7b518f439ae34bf9ddb424de2bd9b31c9889
2024-08-20Tighter checking of access constraints on union members in SrcItem.drh-0/+1
Improved invariant checking. FossilOrigin-Name: fd72d3400a8fe5747f494eee81654698acee350bb95b9db269e87d857af03492
2024-08-20Memory issues fixes so that mdevtest now passes.drh-3/+5
FossilOrigin-Name: b249516f6a6650808e035ec219e762bf24dcb7c32a6235984b995d08d07d35d8
2024-08-19Refactor the SrcItem object so that information about subqueries is storeddrh-28/+43
in a separately allocated Subquery object. This reduces the memory requirements for SrcItem and makes the code run faster. It also provides an expansion path for subquery processing that does not burden simple queries. The current checking mostly works, but there are still issues that need to be tracked down and fixed. FossilOrigin-Name: 8ff5dda8448d7e1a533d7f27db2573ce68fa9956b9d9847ced45e83c1f06bab0
2024-08-17Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh-16/+17
how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
2024-08-08Do not let the number of terms on a VALUES clause be limited bydrh-0/+1
SQLITE_LIMIT_COMPOUND_SELECT, even if the VALUES clause contains elements that appear to be variables due to the use of double-quoted string literals. [https://issues.chromium.org/issues/358174302|Chromium issue 358174302]. FossilOrigin-Name: 670beb133eb203065a75022f0c6db7c605a4e0e22c8ef6d6b4724be2663ff3dc
2024-04-09The read-only CHECK-constraint optimization of [34ddf02d3d21151b] inhibits thedrh-1/+4
xfer optimization for tables with CHECK constraints. However, the xfer optimization is required for correct operation of VACUUM INTO on tables that contain generated columns. Fix this by ignoring CHECK constraints when qualifying the xfer optimization while running VACUUM. Problem reported by [forum:/forumpost/3ec177d68fe7fa2c|forum post 3ec177d68fe7fa2c]. FossilOrigin-Name: a6e26e778812c8409fca77183e24d3b70189c4d02fce10c7e74cd4ccc8c8ea97
2024-03-25The RAISE() operator is not a constant expression and cannot participate indrh-2/+4
the VALUE-as-coroutine optimization. dbsqlfuzz 74cf7c9904360322a6c917e4934b127543d1cd51 FossilOrigin-Name: 6a06dc73847716c88d65651d1bf0e002002303881df1389beac884d0032eae08
2024-03-18Fix harmless compiler (scan-build) warnings.drh-3/+3
FossilOrigin-Name: c86f9f2a15ffc726b7f0d9bba5a8c4dfdaeea6a297e0b591c554fff3d1fe6e1c
2024-03-18Allow the VALUES-as-coroutine optimization to be applied to later rows ofdrh-2/+7
a VALUES clause even if earlier rows do not qualify. FossilOrigin-Name: 9a47ea7f0f675f7bf4710901487ce34c7689e618cd1d8b9f94f0ff7ebc3f2841
2024-03-18Add assert() statements to validate access to the SrcItem.u1.nRow union member.drh-1/+1
FossilOrigin-Name: 21f616d9b948efca441f8d45d0a95f4c052ce8b6daec7fa582ad9a00b82ca570
2024-03-18Improvements to EXPLAIN QUERY PLAN output for multi-row VALUES claues.drh-0/+4
FossilOrigin-Name: ac6f095e13e43d66c06552c8b01f6bec3407c9d41a34c4cdb0be57b0b828ad0d
2024-03-18Ensure the database schema has been loaded and the database encoding gleaned ↵dan-0/+8
before beginning to code a multi-row VALUES clause. FossilOrigin-Name: 2ff476eb3d1f4a2146f4a48b57895a00a3ff5beb29afa679ae53ea58cac07c76
2024-03-17Add an ALWAYS on an unreachable branch.drh-1/+1
FossilOrigin-Name: 0dce6211690210e802545cbca9b3375e07075e117fad3f8c921879da7671d981
2024-03-16Enhance the sqlite3ExprIsConstant() function so that it recognizesdrh-9/+10
constant functions. So far the enhancement only applies to the multi-row VALUES clause, but it could possibly be applied in many other places. FossilOrigin-Name: c9e0488c6c0135932b6e76b0f3f3acd69ef65327e0a54daa59777f35da1aef26
2024-03-14Fix a problem with ALTER TABLE and correlated multi-row VALUES clauses.dan-0/+1
FossilOrigin-Name: d543c829ef74dbd64105bd757ca660e4f02e9ce562be4f1688a701fa535351c4
2024-03-14Fix a problem handling "INSERT INTO ... SELECT ... UNION VALUES(...), (...)" ↵dan-1/+4
and similar statements. FossilOrigin-Name: e8a2a8198a97046ff376bc5d38e4bc0a24fcac79f5a0dadb9d29d953a862a012
2024-03-14Avoid some OP_SCopy instructions in "INSERT INTO .. VALUES" statements that ↵dan-0/+15
insert more than one row in cases where the VALUES clause contains a value for all columns of the table. FossilOrigin-Name: 988f0ea70cd21b3194011e0cd1ddd4990a07669e0fd9c37afa48f69698ab7212
2024-03-13Change the way parse.y handles multi-row VALUES clauses to save a few cycles.dan-15/+75
FossilOrigin-Name: 88d5bc91a52675d2a83748b79ad50de0e9732b2afd23107627bdc604f744d275
2024-03-13Remove unreachable code from this branch.dan-35/+18
FossilOrigin-Name: 657c7b4f9df53e041a33cfad00ee2f507ac09c97a2ae61164bd189d660d167da
2024-03-13Fix some OOM handling problems on this branch.dan-19/+20
FossilOrigin-Name: 2085c7f12a3916ec883c31795e29f2e2b6641c30ecf748cce9bff7b13b061d1f
2024-03-13Ensure that if a multi-row VALUES cannot be coded while being parsed, the ↵dan-3/+6
SF_MultiValue flag is correctly set. FossilOrigin-Name: 94791824a6f04782aac6bc16c182685e2d6ebf5c688dc9f8d59e479c6fd5a40e
2024-03-13Avoid creating a co-routine incrementally for a VALUES clause that has ↵dan-0/+12
affinities other than NONE. FossilOrigin-Name: 4229b12b327b05561dcf49b8585a66467d17d4e998b14eff65eb886f2434b53c
2024-03-12Correctly initialize the SrcItem.iCursor field to -1 when creating a ↵dan-0/+1
co-routine from a multi-values VALUES clause. FossilOrigin-Name: c32953ff6d72910815eaff29ab1b790c412e1a741d02c03c5911dda0c08e5130
2024-03-11Attempt to reduce the memory used by VALUES clauses in as many statements as ↵dan-16/+121
possible, not just INSERT. This branch still has problems. FossilOrigin-Name: 17d1f7cfabc7593d0725051b0c7c9619a23a482265f30f15ab9493fef5caeeb0
2024-03-08Silently ignore redundant ON CONFLICT clauses in an UPSERT. Only the firstdrh-1/+1
ON CONFLICT for each index is active. Do not issue an error, since that might break legacy queries. But ignore the redundant ON CONFLICT clauses to prevent problems such as described in [forum:/forumpost/919c6579c8|forum post 919c6579c8]. FossilOrigin-Name: d0ea6b6ba64dba9d68c2b391ccf1171ea96fcdd7409dafdb2b697accb00246b8
2023-06-20Omit unnecessary calls to table locking routines in the common case whendrh-3/+5
there is no shared cache. FossilOrigin-Name: f94f3021cde1d46373ee8fc8e5028d7507a937240c59cf0d0d19ab22acbd3c41