Subject Re: [firebird-support] Re: problem with transaction and inserting detail record
Author Helen Borrie
At 08:58 PM 4/09/2007, you wrote:
> > What problem? This is transaction isolation behaving exactly as it
> > should. It *would* be a problem if a separate transaction were able
> > to insert a detail record whose master record is yet uncommitted.
>Yes, this is that case.
>User for example:
> Bob lock record to edit (id pirmary for example 100)
>Difrent User Mark want to inset (to table detail) record with foreign
>key 100.
>Have You any ideas to solve this situation?

It's not a situation that wants a solution. A Foreign Key constraint
is *meant* to preserve referential integrity. Dirty reads are not
supported either - purposely to preserve consistency.

>But Main question is solve this problem:
>Bob show form and lock record id 100.
>If Mark want to edit record id 100 have message "record locked by
>Bob, you will show form in preview mode"
>This work fine.
>But, when Mark want to add to table detail some record have dead lock

Actually, it's not a deadlock - Firebird reports all lock conflicts
as deadlocks at the top level. It is a lock conflict. And it is
needed, to protect the referential integrity of the master and its
related details.

If you don't want referential integrity protection, don't use a foreign key.