aboutsummaryrefslogtreecommitdiff
path: root/src/insert.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-10-16 20:05:56 +0000
committerdrh <drh@noemail.net>2019-10-16 20:05:56 +0000
commitc27ea2ae8df4207e6b2479b46904c73d7cd1775f (patch)
tree4adc4abd49f11e21bbb8ecbbeb081a5ad90df11f /src/insert.c
parent7e508f1ee2d671976fd1dbe4a8fdbc840ba39b97 (diff)
downloadsqlite-c27ea2ae8df4207e6b2479b46904c73d7cd1775f.tar.gz
sqlite-c27ea2ae8df4207e6b2479b46904c73d7cd1775f.zip
ALTER TABLE is able to add a VIRTUAL column.
FossilOrigin-Name: 120c6b78cb51532f783014605f1107d40b2e4f54e3852fb1f8f167d0c0b78c69
Diffstat (limited to 'src/insert.c')
-rw-r--r--src/insert.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c
index f2ed9d9a3..22c48d7f3 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -532,6 +532,7 @@ void sqlite3Insert(
u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */
u8 bIdListInOrder; /* True if IDLIST is in table order */
ExprList *pList = 0; /* List of VALUES() to be inserted */
+ int iRegStore; /* Register in which to store next column */
/* Register allocations */
int regFromSelect = 0;/* Base register for data coming from SELECT */
@@ -1003,8 +1004,8 @@ void sqlite3Insert(
** with the first column.
*/
nHidden = 0;
- for(i=0; i<pTab->nCol; i++){
- int iRegStore = regRowid+1+i;
+ iRegStore = regRowid+1;
+ for(i=0; i<pTab->nCol; i++, iRegStore++){
if( i==pTab->iPKey ){
/* The value of the INTEGER PRIMARY KEY column is always a NULL.
** Whenever this column is read, the rowid will be substituted
@@ -1019,6 +1020,7 @@ void sqlite3Insert(
j = -1;
nHidden++;
if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ){
+ iRegStore--;
continue;
}
}else{