aboutsummaryrefslogtreecommitdiff
path: root/src/vtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vtab.c')
-rw-r--r--src/vtab.c8
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;