On 06/09/2013 09:28 AM, Tom Lane wrote:

Even aside from that, the proposed change seems like a bad idea because
it introduces an unnecessary call of GetCurrentTimestamp() in the common
case where there's no valuntil limit.  On some platforms that call is
pretty slow.

And that would explain why we don't do something like this:

index f01d904..4935c9f 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -145,12 +145,10 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
                /*
* Password OK, now check to be sure we are not past rolvaliduntil
                 */
-               if (isnull)
+               if (isnull || vuntil > GetCurrentTimestamp())
                        retval = STATUS_OK;
-               else if (vuntil < GetCurrentTimestamp())
-                       retval = STATUS_ERROR;
                else
-                       retval = STATUS_OK;
+                       retval = STATUS_ERROR;
        }


Right. Ty for the feedback, I know it was just a little bit of code but it just looked off and I appreciate the explanation.

JD




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to