Re: Pasword expiration warning

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Nathan Bossart <nathandbossart@gmail.com>, Gilles Darold <gilles@darold.net>
Cc: Zsolt Parragi <zsolt.parragi@percona.com>, Japin Li <japinli@hotmail.com>, Yuefei Shi <shiyuefei1004@gmail.com>, songjinzhou <tsinghualucky912@foxmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Andrew Dunstan <andrew@dunslane.net>, Tom Lane <tgl@sss.pgh.pa.us>, liu xiaohui <liuxh.zj.cn@gmail.com>, Steven Niu <niushiji@gmail.com>
Date: 2026-02-04T14:44:05Z
Lists: pgsql-hackers
On 03.02.26 16:28, Nathan Bossart wrote:
> +			detail = psprintf(_("The password for role \"%s\" will expire in "
> +								INT64_FORMAT " day(s), " INT64_FORMAT
> +								" hour(s), " INT64_FORMAT " minute(s)."),
> +							  role, days, hours, minutes);

You cannot use INT64_FORMAT inside translatable messages.  But you can 
use PRId64.

Using the type TimestampTz for what are essentially interval/duration 
quantities is a bit weird and confusing.  So maybe another placeholder 
would be more appropriate.

That said, I find writing plurals with "(s)" kind of lame.  It's not a 
good look.

It's a bit difficult to do this correctly when you have three separate 
values in one string.  I would consider for example just showing the 
number of days if the value is larger than one day, number hours if it's 
larger than one hour, else minutes.  I don't think you need 
minute-precision when the expiration time is several days out. 
Alternatively, just print the actual expiration timestamp.





Commits

  1. Add password expiration warnings.