diff --git a/contrib/passwordcheck/expected/passwordcheck.out b/contrib/passwordcheck/expected/passwordcheck.out index ad1ac400ba..5d7a9496c9 100644 --- a/contrib/passwordcheck/expected/passwordcheck.out +++ b/contrib/passwordcheck/expected/passwordcheck.out @@ -5,7 +5,7 @@ CREATE USER regress_passwordcheck_user1; ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password'; -- error: too short ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt'; -ERROR: password is too short +ERROR: password is too short: 7 (< 8) -- ok SET passwordcheck.min_password_length = 6; ALTER USER regress_passwordcheck_user1 PASSWORD 'v_shrt'; diff --git a/contrib/passwordcheck/passwordcheck.c b/contrib/passwordcheck/passwordcheck.c index a0103806d0..5027fa35c8 100644 --- a/contrib/passwordcheck/passwordcheck.c +++ b/contrib/passwordcheck/passwordcheck.c @@ -97,7 +97,7 @@ check_password(const char *username, if (pwdlen < min_password_length) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("password is too short"))); + errmsg("password is too short: %d (< %d)", pwdlen, min_password_length))); /* check if the password contains the username */ if (strstr(password, username)) @@ -149,7 +149,7 @@ _PG_init(void) NULL, &min_password_length, 8, - 0, INT_MAX, + 2, INT_MAX, PGC_SUSET, GUC_UNIT_BYTE, NULL, NULL, NULL);