diff options
author | drh <drh@noemail.net> | 2017-02-14 20:00:16 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-02-14 20:00:16 +0000 |
commit | 7e4acf7b4428d7da85900c58f567d979719bfcf8 (patch) | |
tree | d00b49ca63136db8207d069476f38a69490881c7 /src/insert.c | |
parent | d2f92c26d58a12761a3a2d6cfdf17ad50a007932 (diff) | |
download | sqlite-7e4acf7b4428d7da85900c58f567d979719bfcf8.tar.gz sqlite-7e4acf7b4428d7da85900c58f567d979719bfcf8.zip |
Enable the SQLITE_ENABLE_NULL_TRIM option for WITHOUT ROWID tables.
FossilOrigin-Name: 54836270c9c0bfa5910f7ad74ec238b9d7ddee5f
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c index 894bfc2cc..897a048ac 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1527,6 +1527,9 @@ void sqlite3GenerateConstraintChecks( } sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); VdbeComment((v, "for %s", pIdx->zName)); +#ifdef SQLITE_ENABLE_NULL_TRIM + if( pIdx->idxType==2 ) sqlite3SetMakeRecordP5(v, pIdx->pTable); +#endif /* In an UPDATE operation, if this index is the PRIMARY KEY index ** of a WITHOUT ROWID table and there has been no change the @@ -1682,8 +1685,11 @@ void sqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){ ** version 2 and later (SQLite version 3.1.4, 2005-02-20). */ if( pTab->pSchema->file_format<2 ) return; - for(i=pTab->nCol; i>1 && pTab->aCol[i-1].pDflt==0; i--){} - sqlite3VdbeChangeP5(v, i); + for(i=pTab->nCol-1; i>0; i--){ + if( pTab->aCol[i].pDflt!=0 ) break; + if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break; + } + sqlite3VdbeChangeP5(v, i+1); } #endif |