Use create role to set the password expiration interval for a new role.
This example creates the new role intern_role with the password “temp244”, and sets the password expiration interval for intern_role to 7 days:
create role intern_role with passwd "temp244", passwd expiration 7
The password for intern_role expires after 7 days from the time of day you created the role, or 2 days from when the password was last changed.
See create role in the Reference Manual: Commands.