Created
October 3, 2010 15:36
-
-
Save taotetek/608670 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION notify_trigger() RETURNS trigger AS $$ | |
DECLARE | |
BEGIN | |
PERFORM pg_notify('watchers', TG_TABLE_NAME || ',id,' || NEW.id ); | |
RETURN new; | |
END; | |
$$ LANGUAGE plpgsql; | |
CREATE TRIGGER watched_table_trigger AFTER INSERT ON watched_table | |
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment