Comment for UserMappingPasswordRequired in contrib/postgres_fdw

Etsuro Fujita <etsuro.fujita@gmail.com>

From: Etsuro Fujita <etsuro.fujita@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-02-18T20:23:26Z
Lists: pgsql-hackers

Attachments

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

Commits

  1. postgres_fdw: Fix thinko in comment for UserMappingPasswordRequired().