Sure... it's possible. You could just write a trigger on the state table to check the county table.
If you need help with triggers, here is a couple of links to review:
If you still need help, I suggest that you take a stab at it and then post back what you have.
Hope this helps.
--- On Fri, 3/27/09, Carol Cheung <cacheung(at)consumercontact(dot)com> wrote:
> From: Carol Cheung <cacheung(at)consumercontact(dot)com>
> Subject: [NOVICE] prevent an update from occurring under certain conditions
> To: pgsql-novice(at)postgresql(dot)org
> Date: Friday, March 27, 2009, 8:58 AM
> I'm not sure where to look for information about how to
> accomplish this:
> id | state_name | active
> 1 | Washington | t
> 2 | Illinois | t
> id | county_name | active | state_id
> 1 | King | t | 1
> 2 | Jefferson | t | 1
> I want to prevent an update to set a state's active to
> false if there are any counties in that state that are
> active (county.active = true and county.state_id = state.id)
> Is this possible?
> Thanks in advance for your help.
> -- Sent via pgsql-novice mailing list
> To make changes to your subscription:
In response to
pgsql-novice by date
|Next:||From: David Saracini||Date: 2009-03-27 18:51:07|
|Subject: Meaning of "$$"|
|Previous:||From: Carol Cheung||Date: 2009-03-27 15:58:47|
|Subject: prevent an update from occurring under certain conditions|