I read answers about granting sequences in PostgreSQL. Generally, they say to grant both SELECT, USAGE. I wonder if I can grant only USAGE. Which one is best practice in granting sequences and why?
Quote from the manual
SELECT privilege
For sequences, this privilege also allows the use of the
currvalfunction.
USAGE privilege
For sequences, this privilege allows the use of the
currvalandnextvalfunctions.
(emphasis mine)
So the answer is: if you want to allow the usage of nextval() you will have to grant the USAGE privilege. If you grant USAGE, the SELECT privilege is not needed.
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