Re: Unable to convert date to tm

Lists: pgsql-bugs
From: "Joerg Ludwig" <joerg(dot)ludwig(at)hvf-bs(dot)net>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Unable to convert date to tm
Date: 2002-09-12 22:47:56
Message-ID: 000001c25aae$70b22e50$0a00a8c0@thunder
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello,

I get an error if I try to convert a date before 1970 into a timestamp:

# SELECT (date '1970-01-01')::timestamp;
timestamptz
------------------------
1970-01-01 00:00:00+01
(1 row)

# SELECT (date '1969-12-31')::timestamp;
ERROR: Unable to convert date to tm

I get this error using the RPM postgresql-7.2.1-5 (Red Hat) and
postgresql-7.2.2-1PGDG.
(Btw: What does "tm" stand for?)

On another Linux machine (which should be configured quite similar)
using RPM postgresql-7.2.1-2PGDG there is no error - both SELECT
statements work as expected.

Thx in advance,
Joerg Ludwig


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joerg Ludwig" <joerg(dot)ludwig(at)hvf-bs(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Unable to convert date to tm
Date: 2002-09-16 13:30:41
Message-ID: 26163.1032183041@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Joerg Ludwig" <joerg(dot)ludwig(at)hvf-bs(dot)net> writes:
> # SELECT (date '1969-12-31')::timestamp;
> ERROR: Unable to convert date to tm

Let me guess --- 7.3 Red Hat installation?

This is brain damage in mktime() in recent glibc releases; they
arbitrarily decided to stop supporting pre-1970 dates.

We've patched around it for Postgres 7.3, but there's no fix available
for existing PG releases. Send complaints to the glibc folk.

regards, tom lane