aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/update.c2
-rw-r--r--src/vdbe.c13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c
index 044875903..a6ad871eb 100644
--- a/src/update.c
+++ b/src/update.c
@@ -1032,7 +1032,7 @@ static void updateVirtualTable(
** the ephemeral table. */
sqlite3MultiWrite(pParse);
sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec);
-#ifdef SQLITE_DEBUG
+#if defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_NULL_TRIM)
/* Signal an assert() within OP_MakeRecord that it is allowed to
** accept no-change records with serial_type 10 */
sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC);
diff --git a/src/vdbe.c b/src/vdbe.c
index 2bb3f7b8c..98897d3f7 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -2922,6 +2922,17 @@ case OP_Affinity: {
** macros defined in sqliteInt.h.
**
** If P4 is NULL then all index fields have the affinity BLOB.
+**
+** The meaning of P5 depends on whether or not the SQLITE_ENABLE_NULL_TRIM
+** compile-time option is enabled:
+**
+** * If SQLITE_ENABLE_NULL_TRIM is enabled, then the P5 is the index
+** of the right-most table that can be null-trimmed.
+**
+** * If SQLITE_ENABLE_NULL_TRIM is omitted, then P5 has the value
+** OPFLAG_NOCHNG_MAGIC if the OP_MakeRecord opcode is allowed to
+** accept no-change records with serial_type 10. This value is
+** only used inside an assert() and does not affect the end result.
*/
case OP_MakeRecord: {
Mem *pRec; /* The new record */
@@ -3040,7 +3051,9 @@ case OP_MakeRecord: {
** Give such values a special internal-use-only serial-type of 10
** so that they can be passed through to xUpdate and have
** a true sqlite3_value_nochange(). */
+#ifndef SQLITE_ENABLE_NULL_TRIM
assert( pOp->p5==OPFLAG_NOCHNG_MAGIC || CORRUPT_DB );
+#endif
pRec->uTemp = 10;
}else{
pRec->uTemp = 0;