aboutsummaryrefslogtreecommitdiff
path: root/src/fkey.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-11-01 17:31:27 +0000
committerdrh <drh@noemail.net>2019-11-01 17:31:27 +0000
commitbc4974c81bd4cda9900185a655b577f19a894e03 (patch)
tree5b992aa45dc7118f3d57166c5bb275bcd2db2b00 /src/fkey.c
parentf2b9d7c60502581bfd2908fbdb0dd00017d26cb0 (diff)
downloadsqlite-bc4974c81bd4cda9900185a655b577f19a894e03.tar.gz
sqlite-bc4974c81bd4cda9900185a655b577f19a894e03.zip
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
Diffstat (limited to 'src/fkey.c')
-rw-r--r--src/fkey.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/fkey.c b/src/fkey.c
index b1dc1b71d..ddee8f4bb 100644
--- a/src/fkey.c
+++ b/src/fkey.c
@@ -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{