aboutsummaryrefslogtreecommitdiff
path: root/src/trigger.c
Commit message (Collapse)AuthorAge
* Fix multiple problems with RETURNING on a DML statement against a view,drh2023-03-28
| | | | | | | | | | all inspired by [forum:/forumpost/dc3b92cfa0|forum post dc3b92cfa0]. (1) Do not allow a RETURNING clause to trick the code generator into thinking that the view being updated has an INSTEAD OF trigger. (2) Generate all result columns for a view in a DML statement. (3) The automatic covering index for a view should cover all result columns of the view. FossilOrigin-Name: c8bedef0d61731c29ae34de1594222d15b578f9e2cddbbd5b74fb3059644fe0f
* Fix assert() statements that would (incorrectly) fire if an IF NOT EXISTSdrh2023-03-17
| | | | | | trigger that already exists contained two or more RETURNING clauses. Tickets [89d259d45b855a0d] and [d15b3a4ea901ef0d]. FossilOrigin-Name: 648899e4ded72cac6cc24bccf7ebfc709ee7309a003452b21fd6ab0ba20c34b8
* Fix a possible NULL pointer dereference due to the sqlite3_interrupt()drh2023-03-08
| | | | | | enhancement at [bd8fa10e59f58886]. Reported by [forum:/forumpost/f5a2b1db87|forum post f5a2b1db87]. FossilOrigin-Name: 84417bbd144b2197c9930a520feb94b59053957c190be79f8deaaaebca68ecf1
* Ensure the RETURNING clause is honoured when a row of a temp table is ↵dan2022-11-28
| | | | | updated by an ON CONFLICT clause. FossilOrigin-Name: a2449bcc2c71d0f4c3289621fbf1cb97f0f407c9f7b5bf18245b7854a07c6cfa
* Replace the Parse.disableVtab field with Parse.prepFlags for increaseddrh2022-10-01
| | | | | generality, a small size reduction, and a small performance increase. FossilOrigin-Name: b7da0bcdf70e53ab1ec00a0694e17c7429e23bc6eb3f39b622d06a930aa2f6a3
* Enhance defensive mode so that it disallows CREATE TRIGGER statements if thedrh2022-09-27
| | | | | statements within the trigger attempt to write on a shadow table. FossilOrigin-Name: 3283bbd12a60f472ed03cb7c6209a605a3bf9f3d9083371e17840b56e8b3f559
* Fix further issues with ALTER TABLE and triggers that contain UPDATE..FROM ↵dan2022-05-27
| | | | | statements. FossilOrigin-Name: 53fbc269ddbabc4a97d297e881e5f9cd2bfbcd24af4af1b7cf9db412a3a51813
* Correct handling of outer joins in the FROM clause of an UPDATE statementdrh2022-05-26
| | | | | that occurs inside of a trigger. Follow-on to [98b3816bbaf539ea]. FossilOrigin-Name: 664a49fa813144b6fa5a7ae3f65af5412f150dd5def261c4d581d706b39f7846
* Organize the various flag bits of the ExprList_item object into a substructuredrh2022-05-02
| | | | | so that the whole lot can be copied all at once. Faster and smaller code. FossilOrigin-Name: 5341d4bbe9a943f9cdbbdea829e18f108e98972ebb706396c50fc62fcc6a6328
* Fix two unreachable branches introduced by the recentdrh2022-04-07
| | | | | sqlite3TriggersExist() optimization. FossilOrigin-Name: 1b5475d212cf9de0bff69eee8c607b4fcd8e04bf4df72171429e7609c4153951
* Optimization to sqlite3TriggersExist() saves over 700K CPU cycles.drh2022-04-07
| | | FossilOrigin-Name: 5043a3507e0781878e0e1bea5095a33273958820baead4af8fc2929e9d7c07ee
* Change a conditional into an assert() due to the change indrh2022-03-17
| | | | | [387ab17b8a0a4b87]. FossilOrigin-Name: 13b584869f40ea6aa2190dbac64709695ee8d72b27bc5afb8b39ab3763b9c46a
* Do not allocate new Trigger objects in the parser following a syntax error,drh2022-03-07
| | | | | | | to avoid violating invariants associated with Expr nodes. See [forum:/forumpost/2024e94071ef1531|forum thread 2024e94071ef1531] for more information. FossilOrigin-Name: 5e0ed49b3d739d292f5df3e498449ae8f4357cbb83394181fb34f98ed8372707
* Disable the sqlite3_error_offset() when the error occurs in a trigger ordrh2022-02-07
| | | | | view or some other bit of text that is not part of the original statement. FossilOrigin-Name: 0e909e34fa74e7b9b7954e4ed4c39dd293c1d413b58fda03607faab74aa382ad
* Add ALWAYS() macros. Change some existing ALWAYS() into assert(). Otherdrh2022-01-24
| | | | | code simplifications. FossilOrigin-Name: 4aa27b4fcd1ffd06c38357a87ba3f5776367570439c49652f0903873def0bb23
* Remove many redundant checks for sqlite3.mallocFailed now that any OOM shoulddrh2022-01-24
| | | | | cause Parse.nErr to be non-zero. FossilOrigin-Name: 1f7fa46126ea33ed30e93186aff3df51068aeb4be6f79a102bfe8c4e44941d71
* Make it so that any Parse object is always linked into the database conenctiondrh2022-01-24
| | | | | while it is active. Hence, an OOM will cause Parse.nErr to be set. FossilOrigin-Name: 6a45d8fe8bfbc11a5b86d25237e1f8bccfb0f22f3dcaf004ba797aeb57b365ec
* Ensure that any error encountered while coding a trigger program is ↵dan2022-01-24
| | | | | transfered to the main Parse structure before it is used with any other routine that might set the error code. FossilOrigin-Name: 4293656578811b500786335de7cc9ac0d6ccc6fb273b9419a86968a095404c43
* Fix an assert() failure that could follow an OOM when coding a RETURNING ↵dan2022-01-05
| | | | | trigger. dbsqlfuzz case 5d3e2438f15dc32b473d9f29413157857efa1212. FossilOrigin-Name: 7ae596dd4a73a09585c5dc9f4faf75d126d0733fc2fb32c1de64126a1088d967
* Improved handling of OOM errors in sqlite3ExpandReturning().drh2022-01-05
| | | | | dbsqlfuzz 1040b720f0bbc3bdcfe7336acffbf71517e3ef82. FossilOrigin-Name: 33c6b8e94bda12df13b4d2dd782b3120c3628596b86ef531d20b3100bf159b50
* Ensure that the affinity of columns is honored in the RETURNING clause.drh2021-12-29
| | | | | See [forum:/forumpost/e0c7574ab2|forum post e0c7574ab2] for the bug report. FossilOrigin-Name: 4711fb69547f4f17653ab116030c32fdcc2c836410349d1d025866ffc15704da
* Show the preferred schema table names in the output of "PRAGMA table_list".drh2021-11-04
| | | FossilOrigin-Name: 9147390d9885a37a62edc1058f313434627f1b59965c890877d2cb119e355c78
* Refactor field names in the Column object, zCnName and zCnColl, to make themdrh2021-08-02
| | | | | unique and thus easier to find amid all the other code. FossilOrigin-Name: 8b781dcaf68e0cf12a844708c82eee00193e340195cbca915d077e4846983bf3
* Refactor the Table object to reduce its memory footprint.drh2021-08-02
| | | FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f
* When generating data for a RETURNING clause, avoid assuming cursor number 0 ↵dan2021-06-28
| | | | | is available for use. FossilOrigin-Name: 4b2c59acce6ff1bb6c9c04c45c80945ae23a26588718cc20635d60f7497adabb
* Improved column name and column type determination for the RETURNING clause.drh2021-05-19
| | | FossilOrigin-Name: 699c33990a9438f28673ecf34f1e521d1af0b01c6ee30a608c0c91d2d593590e
* Further improvements to the handling of RETURNING clauses on changesdrh2021-04-27
| | | | | | to TEMP tables with triggers. dbsqlfuzz 683913e98f54fe4f14e8dd11a48011f73bdca58d FossilOrigin-Name: ff3538ae37a02f4f36a15cddd1245171e724aac9c84b2e576980fd3806302775
* RETURNING bug fix: Correctly deal with RETURNING statements on changes todrh2021-04-27
| | | | | | TEMP tables that also have triggers. dbsqlfuzz 78b9400770ef8cc7d9427dfba26f4fcf46ea7dc2 FossilOrigin-Name: d0b15eccbfe1e50c3daf7b2fd4769a52bba35d553b07e462ca3f5f22df6742fd
* Earlier detection and handling of OOM problems.drh2021-04-06
| | | | | dbsqlfuzz 39f2963ea5559aa3a16e24e0e3cb42aac85a7371. FossilOrigin-Name: 8d46df73132e46abb32b9dc129b6beb978d34dac3d372fb004ca283b0832d04c
* Avoid compile error when SQLITE_OMIT_VIRTUALTABLE defined.larrybr2021-04-04
| | | FossilOrigin-Name: 0ee0ef476ba9e17794c088a1347a136df3eb1ef864da884cfe81e3b2e94e9719
* Correctly capture the error when a RETURNING clause appears on an drh2021-04-02
| | | | | | attempt to UPDATE an eponymous virtual table. dbsqlfuzz 486f791cbe2dc45839310073e71367a1d8ad22dd. FossilOrigin-Name: 778a9a6e6f8d960fd55ac9be7eea20b1875a46192db85e63dddc61b632b30173
* Raise an error if a term of the form "TABLE.*" appears in the RETURNING clause,drh2021-03-30
| | | | | | as SQLite does not (yet) know how to handle that. Ticket [132994c8b1063bfb]. FossilOrigin-Name: 3039bcaff95bb5d096c80b5eefdaeda6abd1d1337e829f32fd28a968f663f481
* Improved labeling of EXPLAIN QUERY PLAN output. Many test failures due todrh2021-03-19
| | | | | the different output format. FossilOrigin-Name: 6f8faec0222a7ca07cc1a5ed16cc08d92c6e20bbcb34851b4eff9e624de53601
* Fix various issues with the changes on this branch. Add test cases for the same.dan2021-02-17
| | | FossilOrigin-Name: 10538ec6fc1642dfc2ca6cef06ce6cb9e124847b421ccf01f5842064fad379ab
* Fix harmless compiler warnings.drh2021-02-07
| | | FossilOrigin-Name: 5f8bf99579e6663fc701cdc94f685584a86398c4687e25e7e241de755398f17d
* Remove unreachable code. Fix a shift UB problem introduced yesterdaydrh2021-02-05
| | | | | and discovered by OSSFuzz. FossilOrigin-Name: 078dbff04a95a001bbd8690ab08038fbb5506899df8290991b53fd1122a4c30c
* Remove dead code. Fix RETURNING for INSERT into a virtual table.drh2021-02-04
| | | FossilOrigin-Name: dbfa38699c87ab4bf390666e411dda8d375c7b53b9b4fb131adacbf575867a72
* Fix an issue with RETURNING from UPSERT.drh2021-02-04
| | | FossilOrigin-Name: 757b74ba0fd64634a365bd73955181191767ad8816a33a362e32ece250299a51
* Snapshot. New design appears to work on a simple test case.drh2021-02-04
| | | FossilOrigin-Name: 8a65fbeecf3597e30853c5f0ccd9b8b46c508854fa521e58e0db279deebca7d4
* Preliminary changes for a new implementation of RETURNING that captures alldrh2021-02-04
| | | | | | | results in a buffer and plays them all back after the DML statement completes. This avoids problems with interleaved DML statements. This particular check-in is a non-functional work in progress. FossilOrigin-Name: 04b77d63216ce11b4e797946953bcde504fc005807c7a5ac757fbf47d78698dc
* Modify the SQLITE_DBCONFIG_ENABLE_TRIGGER setting so that it only disablesdrh2021-02-03
| | | | | | | | main-schema triggers and allows TEMP trigger to continue operating. This is safe, since only the application (not an attacker) can add TEMP triggers. It will also all us to disengage SQLITE_DBCONFIG_ENABLE_TRIGGER on Fossil databases since Fossil has no main-schema triggers but does use TEMP triggers. FossilOrigin-Name: a10c5a2503ff2998f6ee40f721aab8c9579052e535dc141bd57d10551eaea387
* Do not allow aggregates in a RETURNING clause. Fix a memory leak thatdrh2021-02-02
| | | | | occurs when window functions are used in a RETURNING clause. FossilOrigin-Name: 2e9bd94b9ad37c7e4123b7324f2fe42d3609a65af449eb8a0064057647709a73
* Report an error if RETURNING is used for DELETE or UPDATE of a virtual table.drh2021-02-02
| | | FossilOrigin-Name: bd5dee8425327fde0429043ce325b910f1b7951988d9a448a8eeeb713a46bc81
* Allow the RETURNING trigger to exist for virtual tables.drh2021-02-02
| | | FossilOrigin-Name: 2f244ab4a2ba2bdb608cf44ef02e00738ad58c10a76d9e4222dc843a17103d92
* Modify RETURNING so that it does not return changes implemented bydrh2021-02-01
| | | | | cascading foreign keys or by triggers. FossilOrigin-Name: 6e62470a737cbde7f3fdcd027b98eb0b3dd11d063c63501d3c18448e93f5959f
* Mark an unreachable branch as ALWAYS().drh2021-01-31
| | | FossilOrigin-Name: cb8b797a64f65fca01c5faaeb30cbe4a53b56b81e696d1b62a90362d7ef8f924
* When setting the number of result columns in a RETURNING trigger, be suredrh2021-01-31
| | | | | | to set that value in the top-level bytecode program, not in the immediate caller of the trigger. FossilOrigin-Name: 1f1ce7ceb9807d22efea496f33908040ee196a31cd192f27ec0fb3e23afb729c
* Improved comments on the new code.drh2021-01-30
| | | FossilOrigin-Name: a38f0c1d7c1d7635732ac370d8fbc7e6a2005378e4621da7bc4f51a2f99912d1
* Fix a memory deallocation problem that comes up when doing a RETURNING querydrh2021-01-30
| | | | | | on a corrupt database. I think I fixed this before, but it got unfixed with stale editor content. FossilOrigin-Name: 02b1415efb7d9849499afe4e9dbf7e470484bf144d6ca3d28fdc38fc0ac10afa
* Another attempt to get trigger selection correct for RETURNING triggers.drh2021-01-30
| | | FossilOrigin-Name: 1b8ed52275a54800df90682d694b482f55f26c6c4a420659f9a3b7bfc61e8abe