From: Ant Zucaro Date: Tue, 18 Nov 2014 02:39:48 +0000 (-0500) Subject: Complete trigger definition. X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonstatdb.git;a=commitdiff_plain;h=827532695ea0015610cc05bb3ba14bad6fb553e9 Complete trigger definition. --- 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