mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-16 23:02:26 +03:00
Use the affinity and collation sequence associated with the parent key when finding child table rows to apply a foreign key action to.
FossilOrigin-Name: 9a4b7ec2928307e88783223903c842accaff7ccf
This commit is contained in:
@@ -952,13 +952,16 @@ static Trigger *fkActionTrigger(
|
||||
tToCol.n = sqlite3Strlen30(tToCol.z);
|
||||
tFromCol.n = sqlite3Strlen30(tFromCol.z);
|
||||
|
||||
/* Create the expression "zFromCol = OLD.zToCol" */
|
||||
/* Create the expression "OLD.zToCol = zFromCol". It is important
|
||||
** that the "OLD.zToCol" term is on the LHS of the = operator, so
|
||||
** that the affinity and collation sequence associated with the
|
||||
** parent table are used for the comparison. */
|
||||
pEq = sqlite3PExpr(pParse, TK_EQ,
|
||||
sqlite3PExpr(pParse, TK_ID, 0, 0, &tFromCol),
|
||||
sqlite3PExpr(pParse, TK_DOT,
|
||||
sqlite3PExpr(pParse, TK_ID, 0, 0, &tOld),
|
||||
sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol)
|
||||
, 0)
|
||||
, 0),
|
||||
sqlite3PExpr(pParse, TK_ID, 0, 0, &tFromCol)
|
||||
, 0);
|
||||
pWhere = sqlite3ExprAnd(db, pWhere, pEq);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user