Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AAB9D47680C for ; Thu, 30 Jan 2003 03:19:59 -0500 (EST) Received: from manica.mvweb.de (unknown [212.184.88.123]) by postgresql.org (Postfix) with SMTP id 7E095476443 for ; Thu, 30 Jan 2003 03:18:09 -0500 (EST) Received: (qmail 28203 invoked from network); 30 Jan 2003 08:25:03 -0000 Received: from mvwebsn-dmz.mvweb.de (HELO mvweb.de) (212.184.88.121) by manica.mvweb.de with SMTP; 30 Jan 2003 08:25:03 -0000 Message-ID: <3E38E038.7040807@mvweb.de> Date: Thu, 30 Jan 2003 09:20:08 +0100 From: Tony Simbine User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 X-Accept-Language: de, pt, en MIME-Version: 1.0 To: Wei Weng Cc: pgsql-sql@postgresql.org Subject: Re: help: triggers References: <3E37D737.90902@mvweb.de> <004501c2c7ae$e09ce210$5301a8c0@monet> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/493 X-Sequence-Number: 11358 Wei Weng wrote: > It would be better if you could provide the source of that trigger and involved > table schemas? > CREATE SEQUENCE "iobjects_id_seq" start 1 increment 1 maxvalue 9223372036854775807 minvalue 1 cache 1; GRANT ALL on "iobjects_id_seq" to "jantos"; CREATE TABLE "iobjects" ( "id" integer DEFAULT nextval('"iobjects_id_seq"'::text) NOT NULL, "status" character varying(10) DEFAULT 'Activo' NOT NULL, "local" character varying(80) NOT NULL, "fig_1" character varying(80), "fig_2" character varying(80), "fig_3" character varying(80), "introduzido" timestamp with time zone DEFAULT now() NOT NULL, "actual" timestamp with time zone DEFAULT now() NOT NULL, "tempo" integer DEFAULT 0 NOT NULL, "deleted" character(1) DEFAULT '0', Constraint "pk_iobjects" Primary Key ("id") ); GRANT ALL on "iobjects" to "jantos"; > > Wei > > ----- Original Message ----- > From: "Tony Simbine" > To: > Sent: Wednesday, January 29, 2003 8:29 AM > Subject: [SQL] help: triggers > > > >>hello, >> >>I'm trying to update a columm on a table with a trigger >>but it don't work on PostgreSQL 7.2 (i686-pc-linux-gnu, compiled by GCC >>2.96). >> >>when I update a row the trigger does nothing. >>what can I do? >> >>thanks in advance >> >>tony >> >> >>here is my trigger: >> >>######################################################## >>CREATE FUNCTION update_my_objekt() RETURNS OPAQUE AS ' >>BEGIN >> RAISE NOTICE ''My Trigger is updating the table''; >> IF OLD.status=''Activo'' THEN >> NEW.tempo := 10; >> NEW.actual := now(); >> END IF; >> RETURN NEW; >>END; >>' LANGUAGE 'plpgsql'; >> >> >>CREATE TRIGGER update_online BEFORE UPDATE ON iobjects >> FOR EACH ROW EXECUTE PROCEDURE update_my_objekt(); >> >>########################################################## >> >>