1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-19 21:43:15 +03:00

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

@@ -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{