Please pardon me if this is a repost--my messing with procmail has
messed up a few things. Anyhow...
It's fairly common to have a situation like
"A foo may have one or more bars," as in
CREATE TABLE foo (
foo_id SERIAL PRIMARY KEY
CREATE TABLE bar (
bar_id SERIAL PRIMARY KEY
CREATE TABLE foo_bar (
foo_id INTEGER NOT NULL REFERENCES foo(foo_id) ON DELETE RESTRICT
, bar_id INTEGER NOT NULL REFERENCES bar(bar_id) ON DELETE RESTRICT
What I'd like to do is a more general:
For integers 0 <= m <= n <= infinity,
At the end of any transaction involving foo (including INSERT), a foo
must have between m and n bars.
Is there a standard way to approach this?
TIA for any pointers :)
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 cell: +1 415 235 3778
sfpug by date
|Next:||From: Josh Berkus||Date: 2003-10-01 05:38:48|
|Subject: Re: Best practices?|
|Previous:||From: David Fetter||Date: 2003-09-30 17:03:57|
|Subject: Best practices?|