Trigger from a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux