Triggers in 7.0.x and SQL syntax.

From: D0 <jnielsen(at)aero-graphics(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Triggers in 7.0.x and SQL syntax.
Date: 2001-05-24 19:19:15
Message-ID: 3B0D5EB3.8A26FF5D@aero-graphics.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Well, after dinking around for serveral hours I decided to beg for help
on here about triggers and look like an idiot all in one slew.

I have two tables. A and B. Whenever A has a row inserted I want to
grab that newly created primary key from it's row in table A and insert
it into a field in table B.

I have tried creating single triggers and triggers that call functions.
I even messed with rules a bit. All resulted in either "something"
happening but not seeing a change in data or flat out syntax or code
errors.

I was attempting to use: select last_value from A_A_id_seq; to get
the latest primary key. This seems to work ok on it's own.

Question is how do I incorporate that into a trigger or something
equivalent? Also, what if I have tables C and D that need to be update
the same as B is. Do I make more triggers or simply have the function
called by the trigger or the trigger itself update all three tables?

Thanks.

Browse pgsql-sql by date

  From Date Subject
Next Message postgresql 2001-05-24 20:44:28 ports in use question
Previous Message Mark 2001-05-24 18:45:53 photos and OID's