From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | Andrew <tech7890(at)Yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: updating table field whenever other table field changes |
Date: | 2003-04-04 01:29:03 |
Message-ID: | 3E8CDFDF.2486DCDF@Yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Andrew wrote:
>
> Hello postgresql.questions group!
>
> What do you think the best way to attack the following is:
> parent table a - [status_field]
>
> child table b - [status_field]
>
> I need trigger or similar to achieve the following:
> if a.status_field changes than all children of table a have their
> b.status_field change to the same value as a.
If b.status_field allways has to have a value that exists in
a.status_field (or maybe NULL if you allow it to), you want to define a
FOREIGN KEY constraint with the referential action ON UPDATE CASCADE.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
From | Date | Subject | |
---|---|---|---|
Next Message | Jeffrey D. Brower | 2003-04-04 02:43:27 | Re: [HACKERS] OSS database needed for testing |
Previous Message | Jan Wieck | 2003-04-04 01:24:12 | Re: Anyone know of a news group for mysql? |