markus markus - 5 months ago 22
SQL Question

GRANT SELECT privilege to ALL sequences using one statement

How can I grant the SELECT privilege on all sequences to a user using one statement? Somthing like:

GRANT SELECT ON <ALL SEQUENCES???> TO myUser

Answer

In PostgreSQL 9.x, you can grant permissions on all sequences in one schema to a role. The syntax is

GRANT SELECT
ON ALL SEQUENCES IN SCHEMA schema_name
    TO role_name

The role can be either a group role or a login role (user name).

Comments