42501: BEARING PRIVILEGE ERROR during query in Postgresql

I am trying to query the database table in postgresql, but every time I run the query below it gives me an INSUFFICIENT PRIVILEGE error. Perhaps the reason for this permission was the rejection of the error. In addition, I use the pgadmin tool on Windows to connect to a Linux database. Below is the request that I run

> > SELECT appid,hash > FROM app > WHERE appid=1; 

When executing the same request, I get below Error

 ERROR: permission denied for relation app ********** Error ********** ERROR: permission denied for relation app SQL state: 42501 
+8
source share
3 answers

The user making the request will need permissions for this table. You can provide them to this user with a GRANT expression. Below is an example providing PUBLIC

 GRANT SELECT ON tablename TO PUBLIC; 

I have also seen reasons for SELinux reasons and places such as here mention it. I'm not quite sure that the command will disable SELinux, but you can see if it works with

 selinuxenabled && echo enabled || echo disabled 
+11
source

It just means that you do not have permission to access the application table. Ask the root administrator or database administrator for permission to access the application table. if you are a root or have privilege, you can use the grant command to grant your permission to use all sql statements in a table or database
For instance:

  grant all privileges on database money to cashier; 

before you must be logged in as root or privileged user
for more information about this command see http://www.postgresql.org/docs/8.1/static/sql-grant.html

+1
source

If DB2 then goes to the DB2 console, select the appropriate database and select "Power" by right-clicking on the database, then add your corresponding DB2 user and provide the necessary access.

0
source

Source: https://habr.com/ru/post/1496642/


All Articles