Thread
Commits
-
postgres_fdw: Fix thinko in comment for UserMappingPasswordRequired().
- e72bde9017c0 14.23 landed
- cf370919a996 15.18 landed
- e0fd58a84199 16.14 landed
- 596a400df7a2 17.10 landed
- be37f270d764 18.4 landed
- e7b97a22383a 19 (unreleased) landed
-
Comment for UserMappingPasswordRequired in contrib/postgres_fdw
Etsuro Fujita <etsuro.fujita@gmail.com> — 2026-02-18T20:23:26Z
Hi, While working on something else, I noticed $SUBJECT: /* * Return true if the password_required is defined and false for this user * mapping, otherwise false. The mapping has been pre-validated. */ static bool UserMappingPasswordRequired(UserMapping *user) { ListCell *cell; foreach(cell, user->options) { DefElem *def = (DefElem *) lfirst(cell); if (strcmp(def->defname, "password_required") == 0) return defGetBoolean(def); } return true; } I think the former part of the comment should be: Return *false* if the password_required is defined and false for this user mapping, otherwise *true*. Patch attached. Best regards, Etsuro Fujita -
Re: Comment for UserMappingPasswordRequired in contrib/postgres_fdw
Andreas Karlsson <andreas@proxel.se> — 2026-02-18T20:30:06Z
On 2/18/26 9:23 PM, Etsuro Fujita wrote: > I think the former part of the comment should be: Return *false* if > the password_required is defined and false for this user mapping, > otherwise *true*. I feel the wording of the comment is pretty awkward both before and after your correctness fix. I am not a native speaker but shouldn't it be something like the below which explains better what is actually going on. /* * Checks the value of password_required, defaults to true * if not defined. The mapping has been pre-validated. */ Andreas
-
Re: Comment for UserMappingPasswordRequired in contrib/postgres_fdw
Etsuro Fujita <etsuro.fujita@gmail.com> — 2026-02-22T11:10:57Z
On Thu, Feb 19, 2026 at 5:30 AM Andreas Karlsson <andreas@proxel.se> wrote: > On 2/18/26 9:23 PM, Etsuro Fujita wrote: > > I think the former part of the comment should be: Return *false* if > > the password_required is defined and false for this user mapping, > > otherwise *true*. > I feel the wording of the comment is pretty awkward both before and > after your correctness fix. I am not a native speaker but shouldn't it > be something like the below which explains better what is actually going on. > > /* > * Checks the value of password_required, defaults to true > * if not defined. The mapping has been pre-validated. > */ I like your wording. I am not a native speaker either, though. This would be nitpicking, but I think it is better to clearly mention what the function returns. How about modifying it a bit, like this? /* * Check and return the value of password_required, if defined; otherwise, * return true, which is the default value of it. The mapping has been * pre-validated. */ Anyway, thanks for the comment! Best regards, Etsuro Fujita
-
Re: Comment for UserMappingPasswordRequired in contrib/postgres_fdw
Andreas Karlsson <andreas@proxel.se> — 2026-02-22T23:01:31Z
On 2/22/26 12:10 PM, Etsuro Fujita wrote: >> /* >> * Checks the value of password_required, defaults to true >> * if not defined. The mapping has been pre-validated. >> */ > > I like your wording. I am not a native speaker either, though. This > would be nitpicking, but I think it is better to clearly mention what > the function returns. How about modifying it a bit, like this? > > /* > * Check and return the value of password_required, if defined; otherwise, > * return true, which is the default value of it. The mapping has been > * pre-validated. > */ No strong opinion. I would be fine with either. I do not think saying that it returns is necessary since you can see that from the function definition but it does not really harm either. -- Andreas Karlsson Percona
-
Re: Comment for UserMappingPasswordRequired in contrib/postgres_fdw
Etsuro Fujita <etsuro.fujita@gmail.com> — 2026-02-23T09:36:38Z
On Mon, Feb 23, 2026 at 8:01 AM Andreas Karlsson <andreas@proxel.se> wrote: > On 2/22/26 12:10 PM, Etsuro Fujita wrote: > >> /* > >> * Checks the value of password_required, defaults to true > >> * if not defined. The mapping has been pre-validated. > >> */ > > > > I like your wording. I am not a native speaker either, though. This > > would be nitpicking, but I think it is better to clearly mention what > > the function returns. How about modifying it a bit, like this? > > > > /* > > * Check and return the value of password_required, if defined; otherwise, > > * return true, which is the default value of it. The mapping has been > > * pre-validated. > > */ > No strong opinion. I would be fine with either. I do not think saying > that it returns is necessary since you can see that from the function > definition but it does not really harm either. Ok. I like the modified version as it also keeps the existing comment to some extent, so I'd like to go with it. Updated patch attached. I will push and back-patch it to all supported versions if there are no objections from others. Thanks! Best regards, Etsuro Fujita
-
Re: Comment for UserMappingPasswordRequired in contrib/postgres_fdw
Etsuro Fujita <etsuro.fujita@gmail.com> — 2026-02-27T08:10:50Z
On Mon, Feb 23, 2026 at 6:36 PM Etsuro Fujita <etsuro.fujita@gmail.com> wrote: > On Mon, Feb 23, 2026 at 8:01 AM Andreas Karlsson <andreas@proxel.se> wrote: > > On 2/22/26 12:10 PM, Etsuro Fujita wrote: > > >> /* > > >> * Checks the value of password_required, defaults to true > > >> * if not defined. The mapping has been pre-validated. > > >> */ > > > > > > I like your wording. I am not a native speaker either, though. This > > > would be nitpicking, but I think it is better to clearly mention what > > > the function returns. How about modifying it a bit, like this? > > > > > > /* > > > * Check and return the value of password_required, if defined; otherwise, > > > * return true, which is the default value of it. The mapping has been > > > * pre-validated. > > > */ > > No strong opinion. I would be fine with either. I do not think saying > > that it returns is necessary since you can see that from the function > > definition but it does not really harm either. > > Ok. I like the modified version as it also keeps the existing comment > to some extent, so I'd like to go with it. Updated patch attached. I > will push and back-patch it to all supported versions if there are no > objections from others. Done. Best regards, Etsuro Fujita