Search Postgresql Archives

Updating within Triggers

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

 



Hi trying to wtite a trigger to update summary fields in a seperate table to do this i am planning on using trigger. problem i have at the moment the update trigger doesnt seem to be fireing but the insert works.

Trigger

CREATE TRIGGER "setSummary" AFTER INSERT OR UPDATE
ON "parts" FOR EACH ROW
EXECUTE PROCEDURE "material"();

function
CREATE OR REPLACE FUNCTION "partSumm" () RETURNS trigger AS
$body$
begin
 update project
actualsummmatcost = (select sum(actualcost) from projects.material where material."fkproject" = new.fkproject;), actualsummmattotal = (select sum(actualcharge) from projects.material where material."fkprojet" = new.fkproject;),
 where project."primary" = new.fkproject;
 return new;
end;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux