From: dguevara <dguevara@acceso.com.pe>
To: pgsql-admin@postgresql.org
Subject: Trigger from a function
Date: Mon, 18 Feb 2008 11:29:51 -0500
Message-ID: <20080218161525.M66419@acceso.com.pe> (raw)
Hello all,
I have a problem with a trigger which is executed when i make an UPDATE trought a simple query, but
not when the UPDATE is made in a store procedure.
Maybe i'm missing something in the declaration of the function and i would appreciate any help.
T
his is the function:
CREATE OR REPLACE FUNCTION X
RETURNS SETOF void AS
$BODY$
begin
update A;
end;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
The trigger:
CREATE TRIGGER Y
BEFORE INSERT OR UPDATE
ON A
FOR EACH ROW
EXECUTE PROCEDURE Z;
CREATE OR REPLACE FUNCTION Z
RETURNS "trigger" AS
$BODY$
begin
if (tg_op in ('INSERT', 'UPDATE', 'DELETE')) then
update A;
end if;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
Thanks in advance.
Danilo Guevara
Departamento de Sistemas
Acceso Crediticio SAC
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-admin@postgresql.org
Cc: dguevara@acceso.com.pe
Subject: Re: Trigger from a function
In-Reply-To: <20080218161525.M66419@acceso.com.pe>
* 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