Re: [SQL] Unable to convert null timestamp to date. Bug?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Edmar Wiggers" <edmar@brasmap.com>
Cc: pgsql-sql@postgresql.org, pgsql-bugs@postgresql.org
Date: 2000-12-08T01:01:51Z
Lists: pgsql-bugs
"Edmar Wiggers" <edmar@brasmap.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