pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Perdue <tim@perdue.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Rule/currval() issue
Date: Wed, 14 Mar 2001 12:13:35 -0600
Message-ID: <20010314121335.S670@mail.perdue.net> (raw)
In-Reply-To: <28311.984593358@sss.pgh.pa.us>
References: <20010314115015.R670@mail.perdue.net>
	<28311.984593358@sss.pgh.pa.us>

On Wed, Mar 14, 2001 at 01:09:18PM -0500, Tom Lane wrote:
> 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.

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



view thread (7+ messages)  latest in thread

Message-ID: <20010314121335.S670@mail.perdue.net>
Permalink:  ../20010314121335.S670@mail.perdue.net/
Also on:    postgresql.org/message-id/20010314121335.S670@mail.perdue.net

 · 

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: tim@perdue.net, tgl@sss.pgh.pa.us
  Subject: Re: Rule/currval() issue
  In-Reply-To: <20010314121335.S670@mail.perdue.net>
  References: <20010314115015.R670@mail.perdue.net> <28311.984593358@sss.pgh.pa.us> <20010314121335.S670@mail.perdue.net>

* 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