Re: updating table field whenever other table field changes

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(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-03 18:57:44
Message-ID: 20030403105228.V81447-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 28 Mar 2003, 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.
>
> However if b.status_field changes its parent record, a.status_field,
> does not change.

How do the rows of a and b relate to each other?

> I also do not really understand CONSTRAINT TRIGGER and how it differs
> from a regular old TRIGGER. What do these internal TRIGGERS,
> particularly "RI_FKey_noaction_upd" do?

That's the implementation for the ON UPDATE NO ACTION of a foreign key.
Generally speaking you won't want to make CONSTRAINT TRIGGERS (it's meant
as an internal thing for doing the foreign keys) unless you want it to
be deferrable.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-04-03 19:01:20 Re: 'DROP INDEX' kills stored rpocedures
Previous Message Vlad Krupin 2003-04-03 18:55:34 Re: 'DROP INDEX' kills stored rpocedures