________________________________
发件人: Gilles Darold <[email protected]>
发送时间: 2026年1月8日 14:04
收件人: Japin Li <[email protected]>; songjinzhou <[email protected]>
抄送: Gilles Darold <[email protected]>; PostgreSQL Hackers 
<[email protected]>; Andrew Dunstan <[email protected]>; Bossart, 
Nathan <[email protected]>; Tom Lane <[email protected]>
主题: Re: Pasword expiration warning

Le 08/01/2026 à 04:37, Japin Li a écrit :
> On Thu, 08 Jan 2026 at 10:57, "songjinzhou" <[email protected]> 
> wrote:
>> Hi, Gilles Darold
>>
>> First of all, thank you for your reply. This is indeed not a simple
>> countdown. I did think it would be abrupt for users to see "0 days". I
>> checked v4, and I think it's fine. (PS: Should we add relevant
>> explanations to the SGML?) Thank you.
>>
> I'd like to hear more opinions on this.
>
Here is a new version of the patch that adds the documentation for the
new GUC, fix the warning message (days(s) instead of days) and handle
the 'Infinity' value for the VALID UNTIL clause.


--
Gilles Darold
http://hexacluster.ai/



Dear Gilles,

Thank you for submitting the v5 patch to add the password_expire_warning GUC.
The feature is useful and the implementation is mostly solid.
I reviewed the patch with a particular focus on the comments and documentation,
and I noticed several inconsistencies between the comments, the documentation,
and the actual code that could confuse future maintainers or users.

Here are the main issues I found:

1. /doc/src/sgml/config.sgml
There is an unrelated change in config.sgml around the password_encryption 
parameter:
the closing parenthesis of the <type> tag was split onto its own line, 
resulting in an isolated ")".

This appears to be an accidental editing artifact and is not required for the 
new feature.
It should be reverted to keep the documentation formatting consistent with the 
rest of the file.

2. Comments referring to "days" while the internal variable uses seconds:

src/backend/libpq/crypt.c:
/* Emit a warning 7 days before password expiration */

These hard-code "7 days" may be no longer accurate once the value becomes 
configurable.
Better comments would be:

/* Threshold (in seconds) before password expiration to emit a warning at login 
(0 = disabled; default 7 days) */

3. Minor typo/grammar in src/include/libpq/libpq-be.h
In the comment for warning_message:
"... at enf of InitPostgres(). ... it is use to show the password expiration 
warning."
Should be: "at the end of InitPostgres()" and "it is used to show".

Overall the implementation works correctly, but aligning all comments and 
documentation with the actual units (seconds internally, days for users) would 
greatly improve clarity.

Best regards,
Xiaohui Liu

Reply via email to