From 360934c0f7cf9e2e0bf86272207b3b9cd878be26 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 12 Sep 2006 14:46:23 +0000 Subject: New sl-stack changes extensions Added parts notify trigger to pg-functions.sql git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@74 4979c152-3d1c-0410-bac9-87ea11338e46 --- sql/Pg-functions.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sql') diff --git a/sql/Pg-functions.sql b/sql/Pg-functions.sql index 4ae22270..4eea5011 100755 --- a/sql/Pg-functions.sql +++ b/sql/Pg-functions.sql @@ -252,3 +252,19 @@ END; ' language 'plpgsql'; -- end function -- +CREATE OR REPLACE FUNCTION trigger_parts_short() RETURNS TRIGGER +AS +' + +CREATE OR REPLACE FUNCTION trigger_parts_short() RETURNS TRIGGER +AS +BEGIN + IF NEW.onhand >= NEW.rop THEN + NOTIFY parts_short; + END IF; + RETURN NEW; +END; +' LANGUAGE PLPGSQL; + +CREATE TRIGGER parts_short AFTER UPDATE ON parts +FOR EACH ROW EXECUTE PROCEDURE trigger_parts_short(); -- cgit v1.2.3