Re: BUG #6424: Possible error in time to seconds conversion

From: "Bousche, Olaf" <O(dot)Bousche(at)krohne(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6424: Possible error in time to seconds conversion
Date: 2012-02-02 07:25:01
Message-ID: CCE2F52233740340BEC5A710A26AFABC0549FD4F@nld1exchange.nlkrohne.krohnegroup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you for the fast reply

I was not sure this was some spurious result messing up my calculations.
If it is by design and consistent it does not present any problems for
me.

For me the matter is closed.

Olaf

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, 01 February, 2012 17:00
To: Bousche, Olaf
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] BUG #6424: Possible error in time to seconds
conversion

o(dot)bousche(at)krohne(dot)com writes:
> Should the query

> select
> extract(epoch
> from cast('2012-01-01 14:30:1' as
> timestamp) -
> cast('1970-01-01 0:0:0' as
> timestamp))) -
> extract(epoch
> from (cast('2012-01-01 14:30:1' as
> timestamp)))

> return 0 instead of 3600?

Well, right now it's operating as designed, because extract(epoch,
timestamp without timezone) tries to rotate the timestamp from local
time to GMT so that "epoch 0" corresponds to midnight GMT 1970-01-01.
(I presume that you are in a GMT+1 timezone.)

Changing that behavior is one of the possible solutions to the problem
being discussed over here:
http://archives.postgresql.org/pgsql-general/2012-01/msg00649.php
but I don't believe we have any consensus yet about whether that would
be a good idea.

regards, tom lane

This message has been scanned for malware by Websense Hosted Email
Security.
====================================== DISCLAIMER ===================================
NOTE: The information transmitted in this email is for the person or entity to which it is addressed:
it may contain information that is confidential and/or legally privileged.
If you are not the intended recipient, please do not read, use, retransmit or disseminate this information.
Although this email and any attachments are believed to be free of any virus, it is the responsibility
of the recipient to ensure that they are virus free. No responsibility is accepted by the KROHNE Company
for any loss or damage arising from receipt of this message.
Furthermore, unless explicitly stated, this email is in no way a legally binding agreement.
The views represented in this email do not necessarily represent those of the corporation.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Schetinin 2012-02-02 09:17:33 Re: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
Previous Message Sachin Srivastava 2012-02-02 06:46:19 Re: BUG #6427: Installation stack builder error