Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an issue with child keys that are not INTEGER PRIMARY KEY referencing INTEGER PRIMARY KEY in the parent. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | foreign-key-check |
Files: | files | file ages | folders |
SHA1: |
603b695bf094b9da905f877a13dcb134 |
User & Date: | drh 2012-12-17 18:05:54.523 |
Context
2012-12-17
| ||
18:43 | "PRAGMA foreign_key_check" with no argument checks the foreign keys on all tables. (check-in: 57d47423a6 user: drh tags: foreign-key-check) | |
18:05 | Fix an issue with child keys that are not INTEGER PRIMARY KEY referencing INTEGER PRIMARY KEY in the parent. (check-in: 603b695bf0 user: drh tags: foreign-key-check) | |
16:46 | Prototype for PRAGMA that checks all foreign key constraints on a table. (check-in: 01c980e9bb user: drh tags: foreign-key-check) | |
Changes
Changes to src/pragma.c.
︙ | ︙ | |||
1170 1171 1172 1173 1174 1175 1176 | assert( pParent!=0 ); pIdx = 0; aiCols = 0; x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols); assert( x==0 ); addrOk = sqlite3VdbeMakeLabel(v); if( pIdx==0 ){ | | > > | > | > > > > < | < | 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | assert( pParent!=0 ); pIdx = 0; aiCols = 0; x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols); assert( x==0 ); addrOk = sqlite3VdbeMakeLabel(v); if( pIdx==0 ){ int iKey = pFK->aCol[0].iFrom; if( iKey>=0 && iKey!=pTab->iPKey ){ sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow); sqlite3ColumnDefault(v, pTab, iKey, regRow); sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk); sqlite3VdbeAddOp2(v, OP_MustBeInt, regRow, sqlite3VdbeCurrentAddr(v)+3); }else{ sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow); } sqlite3VdbeAddOp3(v, OP_NotExists, i, 0, regRow); sqlite3VdbeAddOp2(v, OP_Goto, 0, addrOk); sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); }else{ for(j=0; j<pFK->nCol; j++){ sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, pFK->aCol[j].iFrom, regRow+j); sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); } sqlite3VdbeAddOp3(v, OP_MakeRecord, regRow, pFK->nCol, regKey); |
︙ | ︙ |