Bug #672: timestamp() converts timezone in wrong direction

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #672: timestamp() converts timezone in wrong direction
Date: 2002-05-22 15:54:35
Message-ID: 20020522155435.59C08475E71@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Simon Kirby (sim(at)netnation(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-05-22 16:08:42 Re: Bug #671: server corrupt
Previous Message Oliver Elphick 2002-05-22 14:45:39 Re: [SQL] Bug with Daylight Savings Time & Interval