Skip to content

Instantly share code, notes, and snippets.

@petrushev
Created February 11, 2014 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrushev/8932942 to your computer and use it in GitHub Desktop.
Save petrushev/8932942 to your computer and use it in GitHub Desktop.
tickets notifications
CREATE OR REPLACE FUNCTION trigger_notify()
RETURNS trigger AS
$BODY$
BEGIN
IF NEW.state = 'pending' THEN
EXECUTE 'NOTIFY tickets_pending'||NEW.id::text;
RETURN NULL;
END IF;
END;
$BODY$
LANGUAGE plpgsql VOLATILE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment