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 HaganderMe: http://www.hagander.net/Work:http://www.redpill-linpro.com/