public inbox for [email protected]  
help / color / mirror / Atom feed
From: Euler Taveira <[email protected]>
To: Gilles Darold <[email protected]>
To: japin <[email protected]>
Cc: Yuefei Shi <[email protected]>
Cc: songjinzhou <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: Bossart, Nathan <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: liu xiaohui <[email protected]>
Cc: Steven Niu <[email protected]>
Subject: Re: Pasword expiration warning
Date: Wed, 28 Jan 2026 09:44:55 -0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<MEAPR01MB3031D75330A64DD25A5B8A04B685A@MEAPR01MB3031.ausprd01.prod.outlook.com>
	<[email protected]>
	<MEAPR01MB30311B76AFD06D3CAEAEF9C7B685A@MEAPR01MB3031.ausprd01.prod.outlook.com>
	<[email protected]>
	<MEAPR01MB303185AAA6F5BF90759D5E86B685A@MEAPR01MB3031.ausprd01.prod.outlook.com>
	<[email protected]>
	<MEAPR01MB303142AEB3F47886C171194EB682A@MEAPR01MB3031.ausprd01.prod.outlook.com>
	<CAD43U4WHJm=UkxbfhxQRxQRxtdtu7AGj77uO2fF78THQWCaYTg@mail.gmail.com>
	<MEAPR01MB30319B858B3028CA38BEDC5EB682A@MEAPR01MB3031.ausprd01.prod.outlook.com>
	<MN2PR15MB30212CEFE2F8B93C398FBF60A782A@MN2PR15MB3021.namprd15.prod.outlook.com>
	<MEAPR01MB30319C7BB75B88028E1DB7E1B682A@MEAPR01MB3031.ausprd01.prod.outlook.com>
	<[email protected]>

On Fri, Jan 9, 2026, at 8:27 AM, Gilles Darold wrote:
>
> Here is a v11 version of the patch.
>

+           if (result <= (TimestampTz) password_expire_warning)
+           {
+               MyClientConnectionInfo.warning_message =
+                   psprintf(_("your password will expire in %d day(s)"),
+                            (int) (result / SECS_PER_DAY));
+           }

You should use ngettext() for plural forms. I don't think you need a string
into ClientConnectionInfo. Instead, you could store only the number of days.

+   /*
+    * Emit a warning message to the client when set, for example
+    * to warn the user that the password will expire.
+    */
+   if (MyClientConnectionInfo.warning_message)
+       ereport(WARNING, (errmsg("%s", MyClientConnectionInfo.warning_message)));
+

... and you construct the message directly in the ereport().


-- 
Euler Taveira
EDB   https://www.enterprisedb.com/






view thread (27+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Pasword expiration warning
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox