Install PL/PgSQL in the schema etc.
authorSteinar H. Gunderson <sesse@samfundet.no>
Fri, 18 Feb 2005 18:35:33 +0000 (18:35 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Fri, 18 Feb 2005 18:35:33 +0000 (18:35 +0000)
16:00-19:30

sql/ccbs.sql

index 5125fdb..e73464c 100644 (file)
@@ -163,3 +163,19 @@ CREATE SCHEMA bigscreen;
 CREATE TABLE bigscreen.active_tournament (
        tournament INTEGER NOT NULL REFERENCES tournaments
 );
 CREATE TABLE bigscreen.active_tournament (
        tournament INTEGER NOT NULL REFERENCES tournaments
 );
+
+-- install PL/PgSQL
+CREATE FUNCTION plpgsql_call_handler() RETURNS opaque
+    AS '/usr/lib/postgresql/lib/plpgsql.so', 'plpgsql_call_handler'
+    LANGUAGE "C";
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
+
+-- NOTIFY active_tournament when anything has changed
+CREATE FUNCTION notify_active_tournament() RETURNS trigger
+AS '
+    DECLARE
+    BEGIN
+        NOTIFY bigscreen.active_tournament;
+    END;'
+LANGUAGE plpgsql;
+