Re: small patch to crypt.c

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: small patch to crypt.c
Дата
Msg-id 20130609060237.GQ7200@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: small patch to crypt.c  ("Joshua D. Drake" <jd@commandprompt.com>)
Ответы Re: small patch to crypt.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
* Joshua D. Drake (jd@commandprompt.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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: small patch to crypt.c
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Hard limit on WAL space used (because PANIC sucks)