aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
Commit message (Collapse)AuthorAge
...
* Fix a corner-case for the logic that cause an insert of a NULL into andrh2019-01-17
| | | | | | INTEGER PRIMARY KEY column to be converted into a valid integer key, when the NULL results from a CASE expression that lacks an ELSE clause. FossilOrigin-Name: 9a425051e7ba59e797636f5cf32b5f6efafdb21c8d5300e099b8008b829c1439
* Fix an off-by-one error on a Goto in the code generator, that onlydrh2019-01-12
| | | | | | causes problems for a REPLACE on an INTEGER PRIMARY KEY in non-debug builds. Test case in TH3. FossilOrigin-Name: e35eb8776ed539afe1d5db099470ab1124d8dd2db73ee5db7c811f8df9a9576e
* For SQLITE_ENABLE_PREUPDATE_HOOK builds, disable the optimization for adan2019-01-07
| | | | | | | | REPLACE command on a WITHOUT ROWID table with no indexes, triggers or foreign key constraints that causes SQLite to clobber any existing row without separately checking for it. This optimization causes SQLite to omit the expected pre-update-hook callbacks. FossilOrigin-Name: 6281ef974c0ac7a7133c9e1e04c09fdbd627c019c6ff3227293548caf8283864
* Give a meaningful error on an attempt to use UPSERT on a virtual table,drh2019-01-04
| | | | | rather than simply not working. FossilOrigin-Name: fa98748f956cff95fcfda3a513cea4df27aa573ae795a6855c40bfeca661d0b2
* A new implementation of sqlite3VdbeMakeLabel() is faster and makes fewerdrh2018-12-29
| | | | | | | | | memory allocations by deferring memory allocation until sqlite3VdbeResolveLabel() is called, at which point the code generator has a better idea of how big the relocation table needs to be. The sqlite3VdbeMakeLabel() routine now takes a Parse* parameter instead of Vdbe*. FossilOrigin-Name: 4a0929ac76d8aa5dd65eac3b83d6bbf41e505e01d175ca0fb2b19ba02d439415
* Do not all REPLACE to sneak a NULL value into a NOT NULL column. Detect thatdrh2018-12-22
| | | | | situation and ABORT instead. Fix for ticket [e6f1f2e34dceeb1ed61531c7e98]. FossilOrigin-Name: db8d1d12f5c1673404b2afb5426d5ea3afe3b69d01f8f2bc47ffdf70684fdf24
* Very slightly smaller and faster.drh2018-12-01
| | | FossilOrigin-Name: 27798f17f567ad065f8a99effcb287bc241df7b450330ef890d192c70528e62b
* Deploy the sqlite3Strlen30NN() function (argument guaranteed to be non-NULL) fordrh2018-10-31
| | | | | a small performance improvement. FossilOrigin-Name: 4a6ad5190b62020d97a7de02c801544f20b7b98145ceff14af1f2834d3057f9c
* Optimization: when doing an UPDATE on a table with indexes on an expression,drh2018-09-15
| | | | | | do not update the expression indexes if they do not refer to any of the columns of the table being updated. FossilOrigin-Name: a71b101635ed28a4c99734dabb20bd65ef1018c1d63ac143b7321cdb0fafa5d7
* Fix UPSERT so that it checks the target-constraint first and fires thedrh2018-08-14
| | | | | | | DO UPDATE if that constraint is violated regardless of whether or not other constraints are in violation. This aligns SQLite behavior with what PostgreSQL does. Fix for ticket [908f001483982c43cdb476dfb590a1a]. FossilOrigin-Name: 529fb55e3d00472f13446117527b0896827b11e870b581af7fe7cbb7392ef3cd
* Completely remove the column cache logic, which has been a persistent sourcedrh2018-08-03
| | | | | | | of bugs for many years. We recent enhancements to the performance of the OP_Column opcode, the removing the column cache actually makes speed-check.sh run faster. It also saves about 1,800 bytes of code space. FossilOrigin-Name: 3f5f60cd7529330209027fdae8129cca420cec1050eae50a7750d0b715b56972
* On an UPSERT when the order of constraint checks is rearranged, make suredrh2018-07-11
| | | | | | that the affinity transformations on the inserted content occur before any of the constraint checks. Fix for ticket [79cad5e4b2e219dd197242e9e5f4e]. FossilOrigin-Name: d120c45f3dc79f67afed0e44e5133569f784bc6792b15f5d79529deac2d13072
* Fix the column cache invalidation logic in the code for ROWID uniquenessdrh2018-06-11
| | | | | | constraint checking in the INSERT command. This fixes ticket [c2432ef9089ee73bd]. FossilOrigin-Name: 0b485a571c805a5bc431a231a196ff6034342c6548d92b09c52814dd57c89c75
* Do not require a statement journal in cases where REPLACE conflict handling isdan2018-05-28
| | | | | | used to insert a single row, so long as the REPLACE operation cannot fire any triggers or foreign key actions. FossilOrigin-Name: 469a62ca33081854e54f3af6d93ab5a350484b149c8c8c4ee8be0ae5418382d9
* When compiling with SQLITE_DEBUG, add run-time checks to ensure that nodrh2018-05-28
| | | | | | statement aborts unless either there have been no writes or else there is a statement journal. FossilOrigin-Name: 5a4542dbcf17a9f7fed600897555c271e1651fd50eb41d0b126725b486e1d14c
* Verify that the sqlite_sequence table exists and is in approximately thedrh2018-05-23
| | | | | | correct format prior to using it to process an autoincrement table. Fix for ticket [d8dc2b3a58cd5dc2918a1d4a]. FossilOrigin-Name: e199e859ace4f8381c6380175206e7a276e3f2228fadbbca9341bca8d2fc445d
* Add test cases for UPSERT. And a fix for a "REPLACE INTO ... ON CONFLICT"dan2018-04-20
| | | | | | statement where the new row conflicts with both the IPK and the ON CONFLICT indexes. FossilOrigin-Name: d8eb9f8d9b61400c7e12f01ef5c233257b03532221f7c7a8386f7ac2db439626
* Enhance UPSERT so that the UPDATE uses the same set of cursors as the INSERT.drh2018-04-20
| | | FossilOrigin-Name: c37f39d18d41ae5ba6c4561d87cbbf71f3b6896b86cc5cff9cdf046b02dc521a
* Fix the handling of "PRAGMA count_changes=ON" with UPSERT. Also improveddrh2018-04-19
| | | | | | the implementation of count_changes in other places, without changing the behavior. FossilOrigin-Name: c6f71115eb933c2aee295bc31e5139112463c28e15a3b3ea242fd9bac168aed9
* Fix a problem in the new upsert implemention, discovered by OSSFuzz.drh2018-04-19
| | | FossilOrigin-Name: b6d5ea59fe83716f464e408b7eef0310c6d30b3493e3f966362db2e30b36e821
* Add new testcase() macros and fix a bug that was revealed when trying todrh2018-04-18
| | | | | cover all the new test cases. FossilOrigin-Name: 266a99f7c068aadbd08157d1d495a428109ad7a32d872f8026e8db0f89c40f91
* Fixes to the logic for constraint check reordering during upsert.drh2018-04-17
| | | | | | Improved comments on constraint check bytecode. Add an assert that prevents the same label from being resolved more than once. FossilOrigin-Name: 1ddbb0ff5586ef5ca987e4309979f24f95eea883ed68937094a2db2d61e75657
* Simplification to the upsert logic.drh2018-04-17
| | | FossilOrigin-Name: f36d07a5b24cc48e3daa8b18dd34c50d9025c6c0ba019926610538b54f7b66ec
* Add some more simple test cases for UPSERT. And a minor fix.dan2018-04-17
| | | FossilOrigin-Name: 27cd3b2fb2ad0cf2b36741bd1057cb7973954d40456e9db158261a38b049d2b5
* Add support for the "excluded.*" names in the UPDATE clause of an upsert.drh2018-04-16
| | | FossilOrigin-Name: 0203f34faae07fbea0bff2d23b81fb37df8854cded4cdadac5a034132a096b6d
* Make sure constraint checks occur in the correct order, even in thedrh2018-04-14
| | | | | presence of upserts. FossilOrigin-Name: 07fb30c3de7ff396ae2ce8a0d20352b56f17a5db0af99a921c7bfe9bd4018115
* First cut at logic to perform DO UPDATE for rowid tables.drh2018-04-13
| | | FossilOrigin-Name: a9080bc8b8c5f3b399eb1819bb5009581f178d85bb2b2cca7bc16a7b81b06863
* Add infrastructure for doing an UPDATE as part of an UPSERT. Still no actualdrh2018-04-13
| | | | | UPDATE code, however. FossilOrigin-Name: 6d3017f92bce3e50a91fab2f605e2af8b913b1b374adbfd977299eb042683de8
* Merge the preupdate hook change from trunk.drh2018-04-13
|\ | | | | FossilOrigin-Name: 7353caabb31803ccff83fe188c4ee65e75c883de2beea79cbe17375a4a98d9ac
| * Remove an always-true branch from the preupdate hook logic.drh2018-04-13
| | | | | | FossilOrigin-Name: 0ab4518811b23bdb57feba55014cef07de66028f8fcbf8cf0831a712b2954b91
* | Get the ON CONFLICT DO NOTHING form of upsert working by mapping itdrh2018-04-13
| | | | | | | | | | into INSERT OR IGNORE. FossilOrigin-Name: d07f05e98bb9ce0f9b46db159d9df161b7499d6face6a5299ecd2d00a94fb8d0
* | Back off of the extended upsert syntax that allows multiple ON CONFLICTdrh2018-04-13
| | | | | | | | | | | | clauses. The syntax now is exactly as in PostgreSQL and MySQL. Add support for WHERE clauses on the conflict-target phrase, for partial indexes. FossilOrigin-Name: 2c1b1987d8de1efa8ed7e1f199710e32ff20edf8ceec570514fc63bb1ef264e0
* | Begin adding upsert logic. This is an incremental check-in.drh2018-04-13
| | | | | | FossilOrigin-Name: 809696434097e62e8ef486c7478b5eb62c0cf1342522a5584939fade82821410
* | Add the Upsert object for holding upsert clause information.drh2018-04-12
| | | | | | FossilOrigin-Name: d83eaed539b274c2abd650d07522f491865d4917acbb64d05d01b3ba5c3cd446
* | More complete parsing of UPSERT, including UPSERT within a trigger.drh2018-04-07
|/ | | | | | The sqlite3Insert() logic to actually perform the UPSERT is not yet implemented, however. FossilOrigin-Name: 5cc2a5a315a2f26b392811de45b3dc352873a173c2c6c65f37ce2e5f88a71cd2
* Avoid writing the sqlite_sequence table when it has not actually changed.drh2018-03-16
| | | FossilOrigin-Name: 3e3849a9d1a06673e6c713a42194f5da339fbf6533fa418c38f63d09bc045867
* In the constraint resolution logic, be careful not to cache column values drh2018-01-02
| | | | | | in registers whose initialization might be bypassed by an OP_NoConflict opcode. Fix for ticket [dc3f932f5a147771] reported by OSSFuzz. FossilOrigin-Name: 2846458af5d029a8e4fdcc8f50873a44e57897bbfe6aee8a23a01ffc34c5579f
* In the parse tree, combine LIMIT and OFFSET into a single expression rooteddrh2017-11-14
| | | | | | on a TK_LIMIT node, for a small code size reduction and performance increase, and a reduction in code complexity. FossilOrigin-Name: 3925facd942c9df663f9b29b1e6f94f6be14af8c2b99eb691bfc836b4c220826
* Remove unnecessary NEVER() and ALWAYS() conditionals.drh2017-10-31
| | | FossilOrigin-Name: 1c80c75d4be2f3d44fb18bb4c07eccac2aba79b688215a741317dfc47dc7c2ce
* Remove an unused variable from sqlite3Insert() and fix harmlessdrh2017-10-03
| | | | | compiler warnings associated with -DSQLITE_MUTATION_TEST. FossilOrigin-Name: 7be760e907274131bcd4acfaff9e72c9c59a05e7d411db3d9afe690fe0d64b4b
* Split the OP_Last opcode into OP_Last and OP_SeekEnd. Use OP_SeekEnd todrh2017-08-01
| | | | | position a cursor prior to appending. Ticket [cb91bf4290c211d]. FossilOrigin-Name: 3e02474c7bbe16891a7cfc8771cf72f64cd2c0692779037982d7d307512a4f23
* Add the new sqlite3.mDbFlags field. Factor out bits of sqlite3.flags thatdrh2017-07-26
| | | | | do not interact with PRAGMA statements into sqlite3.mDbFlags. FossilOrigin-Name: 3808a00f06d372cc531da039d97bd974e4a6576a30cf63bf562f83f186b313b3
* Combine the Parse.ckBase and Parse.iSelfTab fields into just Parse.iSelfTab.drh2017-07-20
| | | | | | | This fixes a problem with date/time functions in check-constraints. Add some test cases for date/time functions in index expressions and check constraints. FossilOrigin-Name: 22eda0985ecd1f456c073e6ad735a8417f3ff1fb6aaad1640e1cec01e50c51d8
* Consider the values bound to SQL variables when determining whether or not adan2017-06-24
| | | | | partial index may be used. FossilOrigin-Name: 7b59c353b805c64689b4ae9df347705acbb5f116346ad77af8ce087da7893747
* Initialize a variable to zero to prevent an (incorrect) compiler warning ofdrh2017-06-03
| | | | | it potentially being uninitialized. FossilOrigin-Name: 65182ce041b30cd0193b958eca975b720fe5200a868baba1e633e49433d86813
* Remove a completely unnecessary memset() from the INSERT code generator.drh2017-05-31
| | | FossilOrigin-Name: 7d58836b9db1293a3a6581af4358b7c91a588efd5c9b2df384803f3855ff87a8
* Remove an invalid assert() statement failing when VACUUMing a database thatdan2017-03-23
| | | | | contains an index on a column explicitly declared "COLLATE BINARY". FossilOrigin-Name: 9f2e04d3c3526b5ff60d941aa6d5446f602cab37cb93972937f39eefabd6868d
* Always use the IsVirtual() macro to determine if a Table object is a virtualdrh2017-02-16
| | | | | table. Slightly smaller and faster code. FossilOrigin-Name: 6affb1c89d87288cad87dde5a533832cdf06b8aa
* Enable the SQLITE_ENABLE_NULL_TRIM option for WITHOUT ROWID tables.drh2017-02-14
| | | FossilOrigin-Name: 54836270c9c0bfa5910f7ad74ec238b9d7ddee5f
* Experimental change to invoke the preupdate hook when WITHOUT ROWID tables aredan2017-01-30
| | | | | written. FossilOrigin-Name: 856f8604c59c8fdd9bfb7d86fc0e212f091ab49a