Re: [SQL] Unable to convert null timestamp to date. Bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Edmar Wiggers" <edmar(at)brasmap(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [SQL] Unable to convert null timestamp to date. Bug?
Date: 2000-12-08 01:01:51
Message-ID: 28880.976237311@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

"Edmar Wiggers" <edmar(at)brasmap(dot)com> writes:
> select * from users where last_visit + 7 > now();
> ERROR: Unable to convert null timestamp to date

Yeah, someone who hadn't quite grokked the concept of NULL seems to have
written a lot of the date.c code :-(.

This is fixed for 7.1. If it's really bothering you in 7.0.*, see
src/backend/utils/adt/date.c, and change code like

if (!PointerIsValid(timestamp))
elog(ERROR, "Unable to convert null timestamp to date");

to

if (!PointerIsValid(timestamp))
return NULL;

in several places.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Trurl McByte 2000-12-08 07:57:43 Re: Re: [ADMIN] pg_dump backup problems with password authentication
Previous Message Edmar Wiggers 2000-12-07 23:08:09 Unable to convert null timestamp to date. Bug?

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Burton 2000-12-08 03:01:16 Re: trying to pattern match to a value contained in a column
Previous Message Ross J. Reedstrom 2000-12-07 23:32:24 Re: trying to pattern match to a value contained in a column