Subject | Re: [firebird-support] Foreign key problem |
---|---|
Author | Vlad Horsun |
Post date | 2007-01-18T07:28:05Z |
> When one transaction locks (updates) row in Master table,Only if they not changed FK fields, right ?
> then other transactions
> - can Update related rows in Detail table, but
> - can't Insert new Detail rows (referencing pk of locked row)Engine can't perform reliable check of old and new values of
> Why ?
>
>
> The error message is also peculiar:
> Statement failed, SQLCODE = -901
> lock conflict on no wait transaction
> -violation of FOREIGN KEY constraint "INTEG_3" on table "DETAIL"
> -Foreign key reference target does not exist
>
> The master row existed(was committed) before these transactions
> started, so the row/pk is normally visible.
PK fields in Master table. Master transaction can change master row
many times in several different savepoints so check for old values in
on-disk backversion is not enough, especially if master and detail
transactions runs in different processes of classic server. So engine
not allow to create new details referenced to active master to preserve
referential integrity
Regards,
Vlad