Re: small patch to crypt.c

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: small patch to crypt.c
Date: 2013-06-09 06:02:37
Message-ID: 20130609060237.GQ7200@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Joshua D. Drake (jd(at)commandprompt(dot)com) wrote:
> Well I was more referring to the default is:
>
> check if null, if true return ok
> check if valuntil < today, if true return error
> else return ok
>
> To me we don't need the null check. However, when I tested it,
> without the null check you can't login. So now I am curious about
> what is going on.

Erm, but what is valuntil set to when it's null? I'd expect it to be
zero because it hasn't been changed since:

TimestampTz vuntil = 0;

Using your pseudo-code, you end up with:

check if 0 < today, if true return error
else return ok

Which is why you end up always getting an error when you get rid of the
explicit isnull check. Looking at it too quickly, I had assumed that
the test was inverted and that your patch worked most of the time but
didn't account for GetCurrentTimestamp() going negative.

Regardless, setting vuntil to some magic value that really means "it's
actually NULL", which is what you'd need to do in order to get rid of
that explicit check for null, doesn't strike me as a good idea. When a
value is null, we shouldn't be looking at the data at all.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2013-06-09 06:03:50 Re: Hard limit on WAL space used (because PANIC sucks)
Previous Message Joshua D. Drake 2013-06-09 05:54:58 Re: small patch to crypt.c