Re: Trigger Question

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Terry Lee Tucker <terry(at)esc1(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger Question
Date: 2005-01-05 21:17:37
Message-ID: 20050105211737.GA26367@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Jan 05, 2005 at 03:25:08PM -0500, Terry Lee Tucker wrote:

> When I assign a value to a certain column in a table A, I want to be able to
> assign a value in table A to table B and then to assign a value in table B to
> table C.

What do you mean by "assign a value to a certain column"? Are you
updating an existing record in A? Inserting a new record into A?
Either?

What do you mean by "assign a value in table A to table B"? Do you
want to update an existing record in B with some value from the new
record in A? Or do you want to insert a new record into B based
on the new record in A? Or something else?

Perhaps an example would clarify the requirement: please show what
A, B, and C look like in their "before" state; then show the statement
that should execute the trigger (INSERT, UPDATE, etc.); then describe
what should happen in A, B and C; then show A, B, and C in their
"after" state.

> I was wanting to do this from the trigger level in an AFTER UPDATE
> trigger to ensure it gets done. I would like to be able to pass the serial
> keys of the associated records in table B and C to the AFTER UPDATE trigger
> so I could find the records in tables B and C and perform the updates.

This part isn't clear either. Where are the "serial keys of the
associated records in table B and C" being passed from? How are
those records identified? What updates are supposed to be peformed
in the AFTER UPDATE trigger?

As I mentioned above, an example might explain things better.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Terry Lee Tucker 2005-01-05 21:35:42 Re: Trigger Question
Previous Message Joshua D. Drake 2005-01-05 21:14:23 Re: Index on a view??