The SET DEFAULT and SET NULL conflict resolution actions for foreign key

constraints should cause an error when they appear on a generated column.

FossilOrigin-Name: b47513d2b32b61ba42c1e9b59287d28f6fee231e6c65de2a3aa19effbbaf1e7f
This commit is contained in:
drh 2019-11-01 17:31:27 +00:00
parent f2b9d7c605
commit bc4974c81b
3 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Fix\sa\spotential\suse-after-free\sbug\sthat\sfollows\san\sOOM\serror\sin\scode\nadded\stwo\sdays\sago\sby\scheck-in\s[84e02d773d60cffe].\s\sProblem\sdiscovered\nby\sOSSFuzz.
D 2019-11-01T16:37:53.191
C The\sSET\sDEFAULT\sand\sSET\sNULL\sconflict\sresolution\sactions\sfor\sforeign\skey\nconstraints\sshould\scause\san\serror\swhen\sthey\sappear\son\sa\sgenerated\scolumn.
D 2019-11-01T17:31:27.506
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -480,7 +480,7 @@ F src/dbstat.c c12833de69cb655751487d2c5a59607e36be1c58ba1f4bd536609909ad47b319
F src/delete.c fbe8a2978a35201624ecaaabdaf83917c101e31cf451a7be0cf06d9049fad54e
F src/expr.c a02db128337ca28c34fc3574a640f247881bc4d14c1debf5adc3ecf25dd74992
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 171e54112157be60ce75fa644a98a36088edd8ba9b2c6db7736268c738c45760
F src/fkey.c 89a727204b6bb0143d9ab7534a8846f21647cb9a3f50537ce149a1e82d01dce4
F src/func.c ed33e38cd642058182a31a3f518f2e34f4bbe53aa483335705c153c4d3e50b12
F src/global.c a1a8d698762ddd9a1543aac26c1e0029b20fcc3fcb56bfa41ec8cea2368f2798
F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
@ -1849,7 +1849,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 32df5edcfef2605009f45d6ef1b97c63a99df07c7b4e00dc70f93001cfb8d81f
R d43c58ef1fe087aa7eb409f8964655f5
P 0a2eb949f8a759e5745d9468c8183d3c0b4b30e0fa2a14b3062620eb9e1d5c1d
R 833ca282d33075c076d8697ea10dad1a
U drh
Z 51a0b480453b8134aa91c2e503e48e63
Z aaf384525ea1343453e8aadc28179232

View File

@ -1 +1 @@
0a2eb949f8a759e5745d9468c8183d3c0b4b30e0fa2a14b3062620eb9e1d5c1d
b47513d2b32b61ba42c1e9b59287d28f6fee231e6c65de2a3aa19effbbaf1e7f

View File

@ -1269,7 +1269,15 @@ static Trigger *fkActionTrigger(
sqlite3ExprAlloc(db, TK_ID, &tNew, 0),
sqlite3ExprAlloc(db, TK_ID, &tToCol, 0));
}else if( action==OE_SetDflt ){
Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt;
Column *pCol = pFKey->pFrom->aCol + iFromCol;
Expr *pDflt;
if( pCol->colFlags & COLFLAG_GENERATED ){
testcase( pCol->colFlags & COLFLAG_VIRTUAL );
testcase( pCol->colFlags & COLFLAG_STORED );
pDflt = 0;
}else{
pDflt = pCol->pDflt;
}
if( pDflt ){
pNew = sqlite3ExprDup(db, pDflt, 0);
}else{