今天在写入PostgreSQL的dapp_namemap表格时,报"psycopg2.errors.InsufficientPrivilege: permission denied for table"错误,如图(1)所示。

    问题原因:当前用户hello对表格没有读写权限,如表格(1)所示。
    解决方法:使用超级用户,进入表格所在的数据库,然后对当前用户授予读写权限。
    详细如下:

名称 类型 权限
postgres 超级用户 全部权限
hello 普通用户 仅有登录权限,没有读写权限
hellodb 数据库
dapp_namemap 表格

表(1) helloy用户没有读写权限
    这里是以超级用户postgres授予hello用户,拥有对hellodb数据库下所有表格的读写权限为例进行说明。

1 超级用户登录指定数据库

    使用超级用户postgres,登录指定的数据库(根据自己的情况按需指定),本案例的DB是hellodb,注意,不要登录默认的数据库PG,否则就缘木求鱼了。如果登录了默认的数据库,就是默认数据库PG对hello用户的授权,而不是hellodb数据库对hello用户的授权。

psql -U postgres -d hellodb

2 授予hello用户读写权限

grant usage on schema public to hello;
grant all privileges on all tables in schema public to hello;
grant all privileges on all sequences in schema public to hello;
grant select,insert,update,delete on all tables in schema public to hello;
grant all on schema public to hello;

    如图(2)所示:

图(2) 登录指定的数据库,并授权

3 查询权限

    使用命令,查询hello的权限

select * from information_schema.table_privileges where grantee='hello';

    效果如下:

图(3) 授权成功

解决“psycopg2.errors.InsufficientPrivilege: permission denied for table”问题相关推荐

  1. 成功解决PermissionError: [Errno 13] Permission denied: ‘F:\\File\\data\\123.csv‘

    成功解决PermissionError: [Errno 13] Permission denied:'F:\\File\\data\\123.csv' 目录 解决问题 解决思路 解决方法 解决问题 s ...

  2. 成功解决PermissionError: [Errno 13] Permission denied: './data\\mnist\\train-images-idx3-ubyte'

    成功解决PermissionError: [Errno 13] Permission denied: './data\\mnist\\train-images-idx3-ubyte' 目录 解决问题 ...

  3. Docker: 解决Centos 7中Permission Denied的问题

    当用docker -v挂载volume后,会出现Permission Denied的问题,这有时是因为SeLinux导致的.解决方法如下: chcon -Rt svirt_sandbox_file_t ...

  4. 解决git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Pleas

    今天用idea提交代码到github上,push后报错 git@github.com: Permission denied (publickey). fatal: Could not read fro ...

  5. 解决git@github.com: Permission denied (publickey). Could not read from remote repository

    原因分析 Permission denied (publickey) 没有权限的publickey ,出现这错误一般是以下两种原因 客户端与服务端未生成 ssh key 客户端与服务端的ssh key ...

  6. ssh localhost报错解决:ubuntu@localhost: Permission denied (publickey).

    报错: ubuntu@localhost: Permission denied (publickey).解决: # /usr/sbin/sshd # cat ~/.ssh/id_rsa.pub > ...

  7. 解决git clone提示Permission denied publickey 问题

    http://bbs.gsmcn.cn/thread-2474-1-1.html 偶然编译中文recovery时候遇到了一个错误.后来尝试了一下.解决了,在这里记录分享一下 root@htcdev-V ...

  8. 解决 git@gitlab.com: Permission denied (publickey,gssapi-with-mic,password)

    设备信息 系统:win10 git 版本:git version 2.33.1.windows.1 OpenSSH_8.8p1, OpenSSL 1.1.1l 24 Aug 2021 问题描述 按照常 ...

  9. python里permission denied错误是什么_Python 3.6 解决 PermissionError: [Errno 13] Permission denied...

    出现该错误,首先尝试以管理员身份运行 cmd.exe 程序,然后关闭所有的与 python 相关的进程. open 打开一个文件夹(目录),而不是文件 这一错误一般发生在使用 open函数对文件打开, ...

最新文章

  1. 远程连接windows出现身份验证错误,提示由于CredSSP加密Oracle修正解决方案
  2. 用它5分钟以后,我放弃用了四年的 Flask
  3. SWIG和PInvoke学习(1)
  4. 度学习实践:如何使用Tensorflow实现快速风格迁移?
  5. 【最全干货】从SGD到NadaMax,十种机器学习优化算法原理及实现
  6. 昵图网服务器系统资源不足,Win7系统提示系统资源不足警告怎么办? - 爱绿豆...
  7. 乐高科技系列搭建指南 pdf_近30年十辆乐高科技系列摩托车回顾_积木
  8. django之创建第11个项目-页面整合
  9. java中的时间戳sssss,Java日期时间API系列35-----Jdk8中java.time包中的新的日期时间API类应用,微秒和纳秒等更精确的时间格式化和解析。...
  10. 大学计算机与应用软件,深圳大学
  11. 递归算法经典实例python-浅谈Python 递归算法指归
  12. 联想z510笔记本拆机
  13. 微型计算机公众号,《互联网周刊》编辑推荐的40个微信公众号
  14. win10文件名乱码但内容正常怎么办 win10文件名乱码怎么解决
  15. 【Java】算法之矩阵的加减乘除运算
  16. 首个搭载8MP摄像头的单SoC行泊一体方案来袭,已拿下多家车企定点
  17. Windows下使用taskkill 命令结束进程
  18. 狼人杀服务器修改,微信小程序版狼人杀+服务端系列(1)
  19. [ LeetCode ] #17. Letter Combinations of a Phone Number(电话按键组合字符 C++ Python)
  20. android 禁用dlsym_(转载)android下运行时动态链接dlopen()和dlsym()的实现

热门文章

  1. 讨人喜欢的27个原则,你也能想到的
  2. 我的世界最佳java_我的世界java版20W45A快照下载_我的世界java版20W45A最新快照版官方下载 v1.19.20.106651-菜鸟下载...
  3. mysql 拼接json
  4. Practical Common Lisp [个人翻译版]
  5. lol现在哪个服务器有无限火力,lol国服什么时候出的无限火力(无限火力详细开启时间)...
  6. 使用node.js和Socket创建实时通讯聊天室。
  7. 计算机会员登录系统,华林会员登录系统 会员登录系统.doc
  8. 大话西游2转区不显示服务器,大话西游2如何转区 大话西游2转区流程
  9. appserv 64位 php5.6,AppServ
  10. 5、复杂度来源:高可用