Slim
Slim

Reputation: 6187

Can't grant all privileges on schema public to a user in postgresql

I tried to give all privileges to user in order to access the table pg_largeobject in public schema:

GRANT ALL PRIVILEGES ON SCHEMA PUBLIC TO my_user ;

even using this:

GRANT ALL PRIVILEGES ON TABLE PG_LARGEOBJECT TO my_user;

returns this error:

ERROR:  permission denied for schema public

How can I give privileges to this user or I should connect to database with postgres which has superuser privileges?

Upvotes: 1

Views: 3587

Answers (2)

Laurenz Albe
Laurenz Albe

Reputation: 246493

You have to be a superuser to grant permissions on pg_largeobjects.

But you should never do that.

There is no need to modify that system catalog directly, and doing so will jeopardize the integrity of your PostgreSQL database.

To delete a large object, use

SELECT lo_unlink(4711);

Here 4711 is the OID of the large object you want to delete.

Upvotes: 1

pifor
pifor

Reputation: 7882

You can only grant privileges on objects if you have been granted these privileges with GRANT option or you are granting these privileges as superuser.

Upvotes: 1

Related Questions