From: | "Creager, Robert S" <CreagRS(at)LOUISVILLE(dot)STORTEK(dot)COM> |
---|---|
To: | "'SQL - PGSQL'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | RE: Rule/currval() issue |
Date: | 2001-03-14 18:41:33 |
Message-ID: | 10FE17AD5F7ED31188CE002048406DE8514D00@lsv-msg06.stortek.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Wednesday, March 14, 2001 11:09 AM
> To: Tim Perdue
> Cc: pgsql-sql(at)postgresql(dot)org
> Subject: Re: [SQL] Rule/currval() issue
>
>
> Tim Perdue <tim(at)perdue(dot)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(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-03-14 20:08:33 | Re: Rule/currval() issue |
Previous Message | Tom Lane | 2001-03-14 18:30:55 | Re: Rule/currval() issue |