-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PostgreSQL 10 Administration Cookbook

A user needs to have access to a table in order to perform any action on it.
Make sure that you have the appropriate roles defined, and that privileges are revoked from the PUBLIC
role.
Grant access to the schema containing the table, as follows:
GRANT USAGE ON SCHEMA someschema TO somerole; GRANT SELECT, INSERT, UPDATE, DELETE ON someschema.sometable TO somerole; GRANT somerole TO someuser, otheruser;
This sequence of commands first grants a role full access to all objects in that schema, then gives viewing (SELECT
) and modifying (INSERT
, UPDATE
, and DELETE
) rights on that table to the role, and finally grants membership in that role to two database users.
There is no requirement in PostgreSQL to have some privileges in order to have others. This means that you may well have write-only tables, where you are allowed to insert but you can't select. This can be used to implement a mail-queue-like functionality...