Re: Is this bad design ?

From: ben brugman <ben_at_niethier.nl>
Date: Thu, 11 Mar 2004 13:11:12 +0100
Message-ID: <40505760$0$6571$4d4ebb8e_at_read.news.nl.uu.net>


"Fabian Buettner" <green_at_tzi.de> wrote in message news:40503C62.2020700_at_tzi.de...
> If you refer to the solution I proposed:
>
> Change a mother (mid) to invalid:
> DELETE FROM ValidMother WHERE mother_id = mid
> -- delete will fail if this mother has children (as intended)
>
> Change a mother (mid) to valid:
> INSERT INTO ValidMother(mother_id) VALUES (mid)
> WHERE NOT EXISTS( SELECT * FROM ValidMother WHERE mother_id = mid)
> -- the where not exists part can be dropped if you ensure that mid was
> -- invalid before

My reaction was on Bob mail:

ben : >
ben : > But then the application has to be changed.

Bob : > No, it doesn't. A simple view serves the application well.

You show that the application has to be changed. Then the way you execute the change, there can be no other constraints on the mother. (See my summary just placed at the end of this thread). (I failed by making the example as simple as possible to appriciate that I ommited some essential information. My appologies for that.)

ben brugman

>
>
>
> Tables where:
> Mother( mother_id primary key, etc_fields )
> -- all mothers
>
> ValidMother( mother_id primary key + foreign key ref Mother(mother_id))
> -- "valid mother" ids
>
> Child( mother_id foreign key ref. ValidMother(mother_id), more_fields)
>
> Fabian
>
> ben brugman wrote:
> >>>But then the application has to be changed.
> >>
> >>No, it doesn't. A simple view serves the application well.
> >>
> >>
> >
> >
> > If a view is used (I assume a union over both tables),
> > how does the application change the data from
> > valid to non-valid and vice versa ?
> >
> > ben
> >
> >
>
Received on Thu Mar 11 2004 - 13:11:12 CET

Original text of this message