X-Original-To: pgsql-general@postgresql.org Received: from mail.ipatimup.pt (link.ipatimup.up.pt [193.137.37.4]) by postgresql.org (Postfix) with ESMTP id C56FB475A9E for ; Tue, 18 Mar 2003 08:38:09 -0500 (EST) Received: from ipatimup.pt (localhost [127.0.0.1]) by mail.ipatimup.pt (8.11.6/IPATIMUP) with SMTP id h2IDkad08493 for ; Tue, 18 Mar 2003 13:46:36 GMT X-RAV-AntiVirus: This e-mail has been scanned for viruses on host: mail.ipatimup.pt Received: from 213.13.176.13 (proxying for 10.20.110.138) (SquirrelMail authenticated user miguel) by www.ipatimup.pt with HTTP; Tue, 18 Mar 2003 13:46:36 -0000 (WET) Message-ID: <2108.213.13.176.13.1047995196.squirrel@www.ipatimup.pt> Date: Tue, 18 Mar 2003 13:46:36 -0000 (WET) Subject: Trigger issue, bug? on 7.2.1 From: "Miguel Carvalho" To: X-Priority: 3 Importance: Normal Reply-To: miguel@ipatimup.pt X-Mailer: SquirrelMail (version 1.2.X) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200303/844 X-Sequence-Number: 39336 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