Board index » delphi » Tables with circular references in foreign key

Tables with circular references in foreign key

When migrating a base from Sybase to Interbase I face a problem of
circular reference in the design of the Sybase base
It seems that in Sybase one can define foreign key as controling the
data only when committing, so it is possible to have two tables, each
having a foreign key on the other.
How can we do in Interbase ? Is there a workaround ?

thanks

 

Re:Tables with circular references in foreign key


Quote
"Henry FRANQUET" <henryfranq...@rillcom.com> wrote in message

news:3C2C8B48.3598AFEA@rillcom.com...

Quote
> When migrating a base from Sybase to Interbase I face a problem of
> circular reference in the design of the Sybase base
> It seems that in Sybase one can define foreign key as controling the
> data only when committing, so it is possible to have two tables, each
> having a foreign key on the other.
> How can we do in Interbase ? Is there a workaround ?

There are fields in system tables that support the DEFERRED mechanism, but
the logic is not implemented.
IMHO, circular references are a curse that should be avoided where possible.
You can use a FK and a trigger but it doesn't guarantee accuracy in
multi-user environments, as your transaction may miss uncommited records by
other transactions (and newer committed changes than the your txn starting
time, depending on the isolation).
http://www.cvalde.com/document/declaRefIntegVsTrig.htm

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase? WebRing

Re:Tables with circular references in foreign key


Thanks Claudio, but I can't change the application, so I have choice between
     another application and interbase
or  this application and sybase ?

"Claudio Valderrama C." a crit :

Quote
> "Henry FRANQUET" <henryfranq...@rillcom.com> wrote in message
> news:3C2C8B48.3598AFEA@rillcom.com...
> > When migrating a base from Sybase to Interbase I face a problem of
> > circular reference in the design of the Sybase base
> > It seems that in Sybase one can define foreign key as controling the
> > data only when committing, so it is possible to have two tables, each
> > having a foreign key on the other.
> > How can we do in Interbase ? Is there a workaround ?

> There are fields in system tables that support the DEFERRED mechanism, but
> the logic is not implemented.
> IMHO, circular references are a curse that should be avoided where possible.
> You can use a FK and a trigger but it doesn't guarantee accuracy in
> multi-user environments, as your transaction may miss uncommited records by
> other transactions (and newer committed changes than the your txn starting
> time, depending on the isolation).
> http://www.cvalde.com/document/declaRefIntegVsTrig.htm

> C.
> --
> Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
> Independent developer
> Owner of the Interbase? WebRing

Other Threads