Bug #672: timestamp() converts timezone in wrong direction - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #672: timestamp() converts timezone in wrong direction
Date
Msg-id 20020522155435.59C08475E71@postgresql.org
Whole thread Raw
Responses Re: Bug #672: timestamp() converts timezone in wrong direction
List pgsql-bugs
Simon Kirby (sim@netnation.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
timestamp() converts timezone in wrong direction

Long Description
timestamp() and extracting epoch from dates is totally broken:

db=# select "timestamp"(0);
      timestamp
---------------------
 1970-01-01 08:00:00
(1 row)

This should be the same as "perl -le 'print scalar localtime(0)'", which
prints:

Wed Dec 31 16:00:00 1969

db=# select extract(epoch from "timestamp"(0));
 date_part
-----------
     28800
(1 row)

timestamps should never be stored with timezones because that would
remove the ability to describe times which overlap in daylight savings
transitions.  It looks like timestamp() is converting in the wrong
direction, and extract() is as well.

Sample Code


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug #671: server corrupt
Next
From: Tom Lane
Date:
Subject: Re: Bug #671: server corrupt