Skip to content

Instantly share code, notes, and snippets.

@alexandre-jacquot-ptl
Last active May 23, 2021 16:18
Show Gist options
  • Save alexandre-jacquot-ptl/d65fa36f85806e50737ab606cdcc573d to your computer and use it in GitHub Desktop.
Save alexandre-jacquot-ptl/d65fa36f85806e50737ab606cdcc573d to your computer and use it in GitHub Desktop.
r2dbc item_saved_trigger.sql
CREATE FUNCTION notify_item_saved()
RETURNS TRIGGER
AS
BEGIN
PERFORM pg_notify('ITEM_SAVED', row_to_json(NEW)::text);
RETURN NULL;
END;
CREATE TRIGGER item_saved_trigger
AFTER INSERT OR UPDATE
ON item
FOR EACH ROW
EXECUTE PROCEDURE notify_item_saved();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment