Answer the question
In order to leave comments, you need to log in
Creating a function and trigger in Postgres?
Hello everyone, I created a function and a trigger:
CREATE OR REPLACE FUNCTION todos_notify_func() RETURNS TRIGGER AS $$
DECLARE
BEGIN
PERFORM pg_notify('users','my message text');
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER todos_notify_trig AFTER UPDATE ON users
FOR EACH ROW EXECUTE PROCEDURE todos_notify_func();
UPDATE users SET username='pls' WHERE id = 1;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question