diff options
author | drh <drh@noemail.net> | 2017-08-10 15:19:39 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-08-10 15:19:39 +0000 |
commit | e3740f272bf8fc7439d64e211c3093ff55a8c21c (patch) | |
tree | 74afd5b05b99cdc8f7d784fc277fe453e471c360 /src/vtab.c | |
parent | 6fa9375c019c66b237a33ede0dfafedde1d2f3ba (diff) | |
download | sqlite-e3740f272bf8fc7439d64e211c3093ff55a8c21c.tar.gz sqlite-e3740f272bf8fc7439d64e211c3093ff55a8c21c.zip |
Experimental changes that allow a WITHOUT ROWID virtual table to be writable
as long as it has only a single-column PRIMARY KEY.
FossilOrigin-Name: ab9ee4c1e64c09c7130e385a23d043d78bad95dff5509c7adc9b992350a4a537
Diffstat (limited to 'src/vtab.c')
-rw-r--r-- | src/vtab.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vtab.c b/src/vtab.c index e76bcf323..634dccc03 100644 --- a/src/vtab.c +++ b/src/vtab.c @@ -773,7 +773,13 @@ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ pNew->nCol = 0; pNew->aCol = 0; assert( pTab->pIndex==0 ); - if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){ + assert( HasRowid(pNew) || sqlite3PrimaryKeyIndex(pNew)!=0 ); + if( !HasRowid(pNew) + && pCtx->pVTable->pMod->pModule->xUpdate!=0 + && sqlite3PrimaryKeyIndex(pNew)->nKeyCol!=1 + ){ + /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0) + ** or else must have a single-column PRIMARY KEY */ rc = SQLITE_ERROR; } pIdx = pNew->pIndex; |