Bug in tm2timestamp

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in tm2timestamp
Date: 2013-03-04 13:38:09
Message-ID: CABUevEx5zUO=KRUg06a9qnQ_e9EvTKscL6HxAM_L3xj71R7AQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

AFAICT, there's a bug in tm2timestamp(). You can't do this:

postgres=# select '1999-12-31T24:00:00'::timestamptz;
ERROR: timestamp out of range: "1999-12-31T24:00:00"

But that's a perfectly legal date. It works fine for any other year -
and AFAICT this is because of the POSTGRES_EPOCH_JDATE being
2000-01-01.

The check in 1693 and forward comes with *result=0 and date=-1 in this
case, which AFAICT is fine.

I'm not entirely sure what that check is guarding against (which may
be because I just came off a flight from canada and don't really have
the brain in full gear ATM). Perhaps it just needs an extra exclusion
for this special case?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2013-03-04 14:30:07 Re: Status of the startup process post end of recovery
Previous Message Euler Taveira 2013-03-04 13:37:32 Re: Materialized views WIP patch