diff options
author | drh <drh@noemail.net> | 2019-10-17 14:21:07 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-10-17 14:21:07 +0000 |
commit | 676fa25a0f7737d7e233a840a5c2d7dffdccb75a (patch) | |
tree | 6a610cdf55912a3f36f84fa04d6308bc760ce814 /src/insert.c | |
parent | ab3c5f26ab72222c4ab0fdcee559b3e3a7c0d53b (diff) | |
download | sqlite-676fa25a0f7737d7e233a840a5c2d7dffdccb75a.tar.gz sqlite-676fa25a0f7737d7e233a840a5c2d7dffdccb75a.zip |
Bug fixes so that "make test" once against runs with no errors.
FossilOrigin-Name: 7bfe0f679d8951b3e925bdf549efa0f8d6b514eddeaca69cbfddbd9476cfff5f
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/insert.c b/src/insert.c index 20b5d9a91..1c628c670 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1009,6 +1009,7 @@ void sqlite3Insert( iRegStore = regRowid+1; for(i=0; i<pTab->nCol; i++, iRegStore++){ int k; + u32 colFlags; assert( i>=nHidden ); assert( iRegStore==sqlite3ColumnOfTable(pTab,i)+regRowid+1 ); if( i==pTab->iPKey ){ @@ -1020,16 +1021,18 @@ void sqlite3Insert( sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); continue; } - if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ){ + if( ((colFlags = pTab->aCol[i].colFlags) & COLFLAG_NOINSERT)!=0 ){ nHidden++; - if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ){ + if( (colFlags & COLFLAG_VIRTUAL)!=0 ){ /* Virtual columns are no stored */ iRegStore--; - }else{ - /* Hidden and stored columns get the default value */ + continue; + }else if( (colFlags & COLFLAG_STORED)!=0 || pColumn==0 ){ + /* Stored columns get the default value. Also hidden columns + ** that are not explicitly named in the INSERT */ sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + continue; } - continue; } if( pColumn ){ for(j=0; j<pColumn->nId && pColumn->a[j].idx!=i; j++){} |