Why does a user receive a "permission denied" error when trying to update their user password in PostgreSQL?

Viewed 217

I have several users of our PostgreSQL (12) database who are not superusers. From the docs, it would appear that any "ordinary" user should be able to set their password to something new, via:

ALTER ROLE [user] WITH ENCRYPTED PASSWORD '[new password]' VALID UNTIL '2021-11-30'

However, when a non-superuser tries this, they receive a "permission denied" error.

For context, we would like to have database users update their passwords once every 3 months, for security purposes.

1 Answers

A regular user can not set the valid until option.

And if you think about it, it wouldn't make sense, as the user then could choose a much longer period.

Related