fun with referential integrity

Chris Pressey cpressey@REDACTED
Thu Mar 13 18:51:18 CET 2003

On Thu, 13 Mar 2003 18:26:47 +0100 (MET)
Ulf Wiger <etxuwig@REDACTED> wrote:

> On Thu, 13 Mar 2003, Vladimir Sekissov wrote:
> >Good day,
> >
> >etxuwig> .... or should I make it easier on myself and simply disallow
> >etxuwig> cyclical dependencies? This seems like a fairly limiting
> >etxuwig> restriction. How do the real pros do it? Does anyone know?
> >
> >For my opinion cyclical references are a bad thing. I
> >usually model bidirectional relationships using another
> >table D with composite primary key and foreign keys to B
> >and C.
> Reading "A Guide to the SQL Standard", by C.J. Date, notes
> that "certain combinations of (1) referential structures
> (...), (2)  referential action specifications, and (3)
> actual data values in the database can together lead to
> cetrain conflict situations and can potentially cause
> unpredictable behaviour." It then moves on to explain that
> these combinations are described elsewhere, and that it's up
> to the DBMS to detect and disallow any dependencies that
> would cause unpredictable behaviour. My interpretation is
> that this must be done at runtime.
> Unfortunately, the cited references are difficult to get for
> free...

My overall impression is that a really good data model avoids cyclical
dependencies, but a really robust RDBM package would deal with the case
when the data model turns out to be not so good (for whatever reason :)

Anectodal: when I was toying with "records with active values", all was
well for simple acyclical cases (change the width of a rectangle, the
perimeter is automatically updated, OK) but for more sophisticated
examples (one field imperial & the other metric & automatically updating
each other - cyclic) I had to add a visited list.  I don't know if there's
a strong parallel between that and a typical database layout, but it
seemed worth mentioning.

> /Uffe


More information about the erlang-questions mailing list