pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Creager, Robert S <CreagRS@LOUISVILLE.STORTEK.COM>
To: 'SQL - PGSQL' <pgsql-sql@postgresql.org>
Subject: RE: Rule/currval() issue
Date: Wed, 14 Mar 2001 11:41:33 -0700
Message-ID: <10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com> (raw)


Tom,

You indicate trigger, rather than rule.  Going by Momjian's book, he
indicates that rules are "...ideal for when the action affects other
tables."  Can you clarify why you would use a trigger for this?  I'm asking
because I have no clue how to use rules or triggers, but need one or the
other to modify a second table on inserts/deletes to the first table.  I'd
like to make the best choice first if possible.

Thanks,
Rob

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Wednesday, March 14, 2001 11:09 AM
> To: Tim Perdue
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Rule/currval() issue 
> 
> 
> Tim Perdue <tim@perdue.net> writes:
> > This is related to the plpgsql project I was working on 
> this morning. I'm
> > trying to create a rule, so that when a row is inserted 
> into a certain table,
> > we also create a row over in a "counter table". The problem 
> lies in getting
> > the primary key value (from the sequence) so it can be 
> inserted in that
> > related table.
> 
> You probably should be using a trigger, not a rule at all.
> 
> 			regards, tom lane
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to 
> majordomo@postgresql.org)
> 



view thread (7+ messages)  latest in thread

Message-ID: <10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com>
Permalink:  ../10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com/
Also on:    postgresql.org/message-id/10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: CreagRS@LOUISVILLE.STORTEK.COM
  Subject: Re: Rule/currval() issue
  In-Reply-To: <10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com>
  References: <10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.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