1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

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
This commit is contained in:
drh
2017-08-10 15:19:39 +00:00
parent 6fa9375c01
commit e3740f272b
6 changed files with 61 additions and 21 deletions

View File

@@ -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;