pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ang Chin Han <angch@pintoo.com>
To: Mark Volpe <volpe.mark@epamail.epa.gov>
Cc: pgsql-sql@postgresql.org
Subject: Re: Rules aren't doing what I expect
Date: Thu, 10 Aug 2000 10:18:20 +0800
Message-ID: <20000810101820.A8537@pintoo.com> (raw)
In-Reply-To: <399180FD.2ACF8B2D@epamail.epa.gov>
References: <399180FD.2ACF8B2D@epamail.epa.gov>

On Wed, Aug 09, 2000 at 12:04:13PM -0400, Mark Volpe wrote:

> I have a table with a trigger that can potentially modify a row before it gets
> inserted or updated:

[snip]

> I have another table that tracks changes in the first table with rules:

AFAIK, rules get rewritten first, before triggers are invoked,
so your rules are getting the values before your trigger changes them.

> The t1_log table doesn't show what was actually inserted into t1!
> Are there any changes I can make to the logic above so that t1_log can
> show the correct value?

Either somehow rewrite your trigger as a rule, or stick another
trigger to change the value before getting into your log table.
You might be able to reuse your trigger function, I think, just
point the trigger to that function. A bit inefficient, since it
gets called twice.



view thread (5+ messages)  latest in thread

Message-ID: <20000810101820.A8537@pintoo.com>
Permalink:  ../20000810101820.A8537@pintoo.com/
Also on:    postgresql.org/message-id/20000810101820.A8537@pintoo.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: angch@pintoo.com, volpe.mark@epamail.epa.gov
  Subject: Re: Rules aren't doing what I expect
  In-Reply-To: <20000810101820.A8537@pintoo.com>
  References: <399180FD.2ACF8B2D@epamail.epa.gov> <20000810101820.A8537@pintoo.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