From 827532695ea0015610cc05bb3ba14bad6fb553e9 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Mon, 17 Nov 2014 21:39:48 -0500 Subject: [PATCH] Complete trigger definition. --- scripts/gen_trigger.shl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/gen_trigger.shl b/scripts/gen_trigger.shl index f02a73a..1746278 100755 --- a/scripts/gen_trigger.shl +++ b/scripts/gen_trigger.shl @@ -32,8 +32,15 @@ do done printf "\tELSE\n" -printf "\t\tRAISE EXCEPTION 'Date out of range. Fix the %s_ins() trigger!\n" $table -printf "\tEND IF\n" +printf "\t\tRAISE EXCEPTION 'Date out of range. Fix the %s_ins() trigger!';\n" $table +printf "\tEND IF;\n" printf "\tRETURN NULL;\n" printf "END\n" +printf "\$\$\n" +printf "LANGUAGE plpgsql;\n\n" + +printf "DROP TRIGGER IF EXISTS %s_ins_trg ON xonstat.games;\n" $table +printf "CREATE TRIGGER %s_ins_trg\n" $table +printf "BEFORE INSERT on xonstat.%s\n" $table +printf "FOR EACH ROW EXECUTE PROCEDURE %s_ins();\n" $table -- 2.39.2