1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Fix the handling of NOT NULL constraint violations for generated columns in

a REPLACE statement.  Ticket [2399f5986134f79c]

FossilOrigin-Name: 77b1c90add514050fe62f22751362fecacd99f9775346cffc60e09c326e64e10
This commit is contained in:
drh
2019-11-06 14:49:43 +00:00
parent 06fc24555f
commit b1129c423f
4 changed files with 19 additions and 11 deletions

View File

@@ -1518,9 +1518,11 @@ void sqlite3GenerateConstraintChecks(
addr1 = sqlite3VdbeMakeLabel(pParse);
sqlite3VdbeAddOp2(v, OP_NotNull, iReg, addr1);
VdbeCoverage(v);
sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i);
sqlite3VdbeAddOp2(v, OP_NotNull, iReg, addr1);
VdbeCoverage(v);
if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ){
sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i);
sqlite3VdbeAddOp2(v, OP_NotNull, iReg, addr1);
VdbeCoverage(v);
}
onError = OE_Abort;
/* Fall through into the OE_Abort case to generate code that runs
** if both the input and the default value are NULL */