From: | Tim Perdue <tim(at)perdue(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Rule/currval() issue |
Date: | 2001-03-14 18:13:35 |
Message-ID: | 20010314121335.S670@mail.perdue.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, Mar 14, 2001 at 01:09:18PM -0500, Tom Lane wrote:
> 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.
OK - so another rule like this one, is probably ill-advised as well? It seems
a lot easier than going into the triggers:
CREATE RULE forum_delete_agg AS
ON DELETE TO forum
DO UPDATE forum_agg_msg_count SET count=count-1
WHERE group_forum_id=old.group_forum_id;
Tim
--
Founder - PHPBuilder.com / Geocrawler.com
Lead Developer - SourceForge
VA Linux Systems
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-03-14 18:30:55 | Re: Rule/currval() issue |
Previous Message | Tom Lane | 2001-03-14 18:09:18 | Re: Rule/currval() issue |