Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-bugs by date

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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group