Subject Re: [firebird-support] Inserting rows with cyclic referential dependencies
Author Ann W. Harrison
lutterot wrote:
> Hello!
>
> I am using Firebird 1.5.2.4854 and encounter a problem when inserting
> rows into a database ...
>
> As far as I can see, Flamerobin executes the two inserts in the same
> transaction. Isn't it that constraints like ENTITYROLE_PARTNERFK have
> to be valid before and after, but not during transactions?

No that's not true. The SQL standard defined two enforcement methods
for constraints - immediate and deferred. Deferred constraints are
evaluated at the end of a transaction. Firebird doesn't implement
deferred constraints. Immediate constraints are supposed to be
evaluated at the end of each update verb. In fact, in Firebird,
constraints are evaluated as each row is modified. In the case of
an insert, those two events - row and verb - are the same.

You can populate your table by leaving the Partner field null on
insert and modifying it after you have stored the row with the desired
ID.

Regards,


Ann