| From: | "Euler Taveira" <euler(at)eulerto(dot)com> |
|---|---|
| To: | "Gilles Darold" <gilles(at)darold(dot)net>, japin <japinli(at)hotmail(dot)com> |
| Cc: | "Yuefei Shi" <shiyuefei1004(at)gmail(dot)com>, songjinzhou <tsinghualucky912(at)foxmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "liu xiaohui" <liuxh(dot)zj(dot)cn(at)gmail(dot)com>, "Steven Niu" <niushiji(at)gmail(dot)com> |
| Subject: | Re: Pasword expiration warning |
| Date: | 2026-01-28 12:44:55 |
| Message-ID: | f04d4dc5-c7a7-4987-bc20-4b97f45ab92d@app.fastmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-01-28 12:54:32 | Re: [PATCH] Add max_logical_replication_slots GUC |
| Previous Message | Ahmed Et-tanany | 2026-01-28 12:42:58 | Re: [PATCH] Add max_logical_replication_slots GUC |