Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4SCiqA99714 for ; Mon, 28 May 2001 08:44:52 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4OLRoA42110 for ; Thu, 24 May 2001 17:27:50 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f4OLFZt42283 for pgsql-sql@postgresql.org; Thu, 24 May 2001 17:15:35 -0400 (EDT) (envelope-from news) From: D0 X-Newsgroups: comp.databases.postgresql.sql Subject: Triggers in 7.0.x and SQL syntax. Date: Thu, 24 May 2001 15:19:15 -0400 Organization: Aero-Graphics, Inc. Lines: 22 Message-ID: <3B0D5EB3.8A26FF5D@aero-graphics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.12-20 i686) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200105/293 X-Sequence-Number: 3121 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.