diff options
author | drh <drh@noemail.net> | 2015-04-10 12:04:57 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-04-10 12:04:57 +0000 |
commit | e918aaba981efb7ec5cca88ca8ae4d509ca84367 (patch) | |
tree | 0bce3db39d79297e8e64cbdc386e27286c7d6140 /src | |
parent | 75395ccd17f0558df937ada728ef44c6621769e4 (diff) | |
download | sqlite-e918aaba981efb7ec5cca88ca8ae4d509ca84367.tar.gz sqlite-e918aaba981efb7ec5cca88ca8ae4d509ca84367.zip |
Fix foreign key CASCADE for cases where the parent key is an INTEGER PRIMARY
KEY and the parent table contains other columns named "rowid", "_rowid_",
and "oid".
FossilOrigin-Name: ed3cbaab6ad49b0cb5b17e44def26c866919387a
Diffstat (limited to 'src')
-rw-r--r-- | src/fkey.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fkey.c b/src/fkey.c index fa148ba6a..3e4b752e8 100644 --- a/src/fkey.c +++ b/src/fkey.c @@ -1184,7 +1184,8 @@ static Trigger *fkActionTrigger( iFromCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom; assert( iFromCol>=0 ); - tToCol.z = pIdx ? pTab->aCol[pIdx->aiColumn[i]].zName : "oid"; + assert( pIdx!=0 || (pTab->iPKey>=0 && pTab->iPKey<pTab->nCol) ); + tToCol.z = pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName; tFromCol.z = pFKey->pFrom->aCol[iFromCol].zName; tToCol.n = sqlite3Strlen30(tToCol.z); |