无法从 plperlu 函数中打开文件
我正在尝试从 plperlu 函数内写入文件,但收到“权限被拒绝”错误。
ERROR: error from Perl function "[$name]": could not open the file: Permission denied at line 46.
我可以使用 perl 脚本写入文件,该脚本本质上做同样的事情。我有读写权限,并且我还正确配置了 pg_hba.conf 文件。并知道可能是什么导致了这个问题?
I'm trying to write to a file from within a plperlu function and I'm getting Permission Denied errors.
ERROR: error from Perl function "[$name]": could not open the file: Permission denied at line 46.
I can write to a file using a perl script that essentially does the same thing. I have read-write permissions and I've also configured the pg_hba.conf file correctly. And idea what might be causing the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能拥有必要的权限,但 PostgreSQL 服务器可能没有像您一样运行。您的 plperlu 代码将在具有服务器权限的服务器上下文中运行。一种快速简单的检查方法是将文件路径更改为
/tmp
中的某个内容,然后查看它是否有效;如果是这样,那么您只需将文件写入 PostgreSQL 服务器具有写入权限的位置即可。You may have the necessary permissions but the PostgreSQL server probably isn't running as you. Your plperlu code will be running in the server's context with the server's permissions. A quick and easy way to check would be to change the file path to something in
/tmp
and see if it works; if it does then you just need to write your file somewhere that the PostgreSQL server has write access to.