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
The following privileges are valid for sequences: SELECT: Execute functions CURRVAL and NEXTVAL on the specified sequences. ALTER: Modify a sequence's DDL with ALTER SEQUENCE.
GRANT CREATE ANY SEQUENCE, ALTER ANY SEQUENCE, DROP ANY SEQUENCE, SELECT ANY SEQUENCE TO my_user; The owner of a sequence has full privileges on the sequence. Another user can be given access to the sequence by granting the SELECT object privilege.
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).
This will be very useful in the future:
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema_name TO your_user; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA schema_name TO your_user; GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA schema_name TO your_user;
The accepted answer dont worked for me on 9.1. The below sentence did work:
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO user;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With