eriezelagera

PostgreSQL Trigger

Mar 12th, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE FUNCTION notify_inbound_operator_calls_trigger() RETURNS trigger AS $$
  2. DECLARE
  3. BEGIN
  4.   PERFORM pg_notify('watchers', TG_TABLE_NAME || ',id,' || NEW.id );
  5.   RETURN new;
  6. END;
  7. $$ LANGUAGE plpgsql;
  8.  
  9. CREATE TRIGGER inbound_operator_calls_trigger AFTER INSERT OR UPDATE ON inbound_operator_calls
  10. FOR EACH ROW EXECUTE PROCEDURE notify_inbound_operator_calls_trigger();
Advertisement
Add Comment
Please, Sign In to add comment