I want to create LISTE/NOTIFY pipeline with trigger_function that sent NOTIFY.
In my NOTIFY i want to get message with row id for any create/delete/update with row in table.
How can i write such notify trigger_function ?
So far I have next migration? witch create trigger without row id
CREATE OR REPLACE FUNCTION notify_my_table_update() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify('my_table_update','');
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS trigger_my_table_update ON my_table;
CREATE TRIGGER trigger_my_table_update
AFTER UPDATE OR DELETE OR INSERT OR TRUNCATE
ON my_table
EXECUTE PROCEDURE notify_my_table_update();