我正在使用pg_notify获取通知,如果我的表中有任何新的插入记录(通知) 我写了一个以下函数来执行通知:
CREATE FUNCTION notify_trigger() RETURNS trigger AS $$DECLARE
BEGIN
select pg_notify('watcher', 'id,' || NEW.id );
RETURN new;
END;
$$ LANGUAGE plpgsql;
以及在执行插入查询时触发此新创建的函数的触发器:
CREATE TRIGGER watched_table_trigger AFTER INSERT ON notificationsFOR EACH ROW EXECUTE PROCEDURE notify_trigger();
但是我正试图在“通知”表中插入一条记录:
ERROR: function pg_notify(unknown, text) does not exist
LINE 1: select pg_notify('watcher', 'id,' || $1 )
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.