42501: INSUFFICIENT PRIVILEGE ERROR while querying in Postgresql

后端 未结 4 1403
旧巷少年郎
旧巷少年郎 2021-01-17 09:41

I am trying to query a database table in postgresql, but every time I run the below query it gives me the INSUFFICIENT PRIVILEGE error. What possibly could be the reason for

4条回答
  •  死守一世寂寞
    2021-01-17 10:12

    The user running the query will need permissions to that table. You can grant them to that user with the GRANT statement. The below is an example that grants to PUBLIC

    GRANT SELECT ON tablename TO PUBLIC;
    

    Also I have seen SELinux cause isses and places such as here mention it. I am not exactly sure of the command to turn SELinux off but you can see if it is running by using

    selinuxenabled && echo enabled || echo disabled
    

提交回复
热议问题