While thinking about possible solution, it was realized that PGADMIN is sending NULL for valid_until parameter and hence function is failing to execute. This is because the account for which I was trying to reset password has no expiry set. I then added an expiry date to the account and then tried to change password and function worked as expected and extended expiry date to current_date + 90 days. Thank you @adrian for your valuable input.