Re: updating table field whenever other table field changes - Mailing list pgsql-general

From Stephan Szabo
Subject Re: updating table field whenever other table field changes
Date
Msg-id 20030403105228.V81447-100000@megazone23.bigpanda.com
Whole thread Raw
In response to updating table field whenever other table field changes  (tech7890@yahoo.com (Andrew))
List 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.


pgsql-general by date:

Previous
From: Jason Hihn
Date:
Subject: Single Byte values
Next
From: Tom Lane
Date:
Subject: Re: 'DROP INDEX' kills stored rpocedures