pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Miguel Carvalho <miguel@ipatimup.pt>
To: pgsql-general@postgresql.org
Subject: Trigger issue, bug? on 7.2.1
Date: Tue, 18 Mar 2003 13:46:36 -0000 (WET)
Message-ID: <2108.213.13.176.13.1047995196.squirrel@www.ipatimup.pt> (raw)

Hi, we are having some trouble we a trigger.

Or version is:  PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC
2.96, running on RH72.

Suppose this SQL query:

UPDATE table set state=1 where id=30;

Theres a trigger on the table ON UPDATE BEFORE

The trigger code is something like this:

IF NEW.state = 1 THEN
    RAISE NOTICE ''Trigger: % -> some administrative information '',
TG_NAME; NEW.state=2;
END IF;

IF NEW.state = 2 THEN
    RAISE NOTICE ''Trigger: % -> some administrative information
'',TG_NAME; DELETE FROM table where id = OLD.id;
END IF;

The trigger code will force another trigger fire because of the changes
in the record. I'm i right?

The trouble is that the trigger isnt firing, the trigger only gets
executed only once.

If i do a select on the table the state field contains the value 2 not
1, so i'm shure the trigger as runned.

Is this a trigger issue or i'm i doing something wrong?

Please fell free to ask more information if needed.

Miguel Carvalho






view thread (5+ messages)  latest in thread

Message-ID: <2108.213.13.176.13.1047995196.squirrel@www.ipatimup.pt>
Permalink:  ../2108.213.13.176.13.1047995196.squirrel@www.ipatimup.pt/
Also on:    postgresql.org/message-id/2108.213.13.176.13.1047995196.squirrel@www.ipatimup.pt

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: miguel@ipatimup.pt, pgsql-general@postgresql.org
  Subject: Re: Trigger issue, bug? on 7.2.1
  In-Reply-To: <2108.213.13.176.13.1047995196.squirrel@www.ipatimup.pt>

* 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