[英]Azure PostgreSQL Flexible Server Cron Job Permission Denied
I am trying to create and update a cron job on a Azure PostgreSQL Flex server.我正在尝试在 Azure PostgreSQL Flex 服务器上创建和更新 cron 作业。 I have pg_cron installed and I can create the job.
我已经安装了 pg_cron,我可以创建工作。 But I am unable to update it.
但我无法更新它。
select cron.schedule('0 9 * * 7', 'refresh materialized view sample_mv;');
The above works perfectly, I can see the job scheduled in the job table.以上工作完美,我可以看到作业表中安排的作业。 But when I try to run the below update statement, it fails with a "ERROR: permission denied for table job".
但是,当我尝试运行以下更新语句时,它会失败并显示“错误:表作业的权限被拒绝”。
update cron.job set database = 'newdb' where jobid='3';
Any advice or guidance would be greatly appreciated!任何建议或指导将不胜感激!
In Azure Database for PostgreSQL Flexible Server, if you try to update the cron.job you will get an error as it requires superuser privileges.在 PostgreSQL 灵活服务器的 Azure 数据库中,如果您尝试更新 cron.job,您将收到一个错误,因为它需要超级用户权限。 However, you can try to use a workaround to make pg_cron jobs work on other databases and manage to do it this way:
但是,您可以尝试使用一种变通方法使 pg_cron 作业在其他数据库上工作并设法这样做:
select cron.alter_job(job_id:=<your_job_id>,database:='<your_db_name>'); select cron.alter_job(job_id:=<your_job_id>,database:='<your_db_name>');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.