Postgres pg_background_launch权限被拒绝

时间:2018-05-15 09:06:57

标签: postgresql

我试图通过使用pg_background扩展在Postgres中实现自治事务。虽然已安装,但我无法调用函数pg_background_launch。

命令CREATE EXTENSION pg_background返回错误错误:扩展名“pg_background”已存在,所以我知道它已经存在。

但是当我运行查询SELECT pg_background_launch('SELECT 1');时,它会返回错误错误:拒绝功能pg_background_launch的权限

任何想法,我错过了什么?需要授予一些特权吗?在此处的文档https://github.com/vibhorkum/pg_background中,创建扩展后没有其他任何操作。

1 个答案:

答案 0 :(得分:0)

您需要创建扩展的用户才能将功能访问权授予其他用户:

GRANT ALL ON FUNCTION public.pg_background_launch(sql text, queue_size integer) to some_user;
GRANT ALL ON FUNCTION public.pg_background_result(pid integer) to some_user;
GRANT ALL ON FUNCTION public.pg_background_detach(pid integer) to some_user;
相关问题