pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: D0 <jnielsen@aero-graphics.com>
To: pgsql-sql@postgresql.org
Subject: Triggers in 7.0.x and SQL syntax.
Date: Thu, 24 May 2001 15:19:15 -0400
Message-ID: <3B0D5EB3.8A26FF5D@aero-graphics.com> (raw)


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.



Message-ID: <3B0D5EB3.8A26FF5D@aero-graphics.com>
Permalink:  ../3B0D5EB3.8A26FF5D@aero-graphics.com/
Also on:    postgresql.org/message-id/3B0D5EB3.8A26FF5D@aero-graphics.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jnielsen@aero-graphics.com
  Subject: Re: Triggers in 7.0.x and SQL syntax.
  In-Reply-To: <3B0D5EB3.8A26FF5D@aero-graphics.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox