pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5966: extract(epoch..) function error
2+ messages / 2 participants
[nested] [flat]

* BUG #5966: extract(epoch..) function error
@ 2011-04-06 23:17  Ricardo Solanilla <info@abaco-tandil.com.ar>
  0 siblings, 1 reply; 2+ messages in thread

From: Ricardo Solanilla @ 2011-04-06 23:17 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5966
Logged by:          Ricardo Solanilla
Email address:      info@abaco-tandil.com.ar
PostgreSQL version: 8.3.0  b.1400
Operating system:   windows nt
Description:        extract(epoch..) function error
Details: 

-- try this

select (extract(epoch from (date('2011-03-20'))) - extract(epoch from
(date('2011-03-19')))) / 3600

-- it must be 24 (hours), only occurs in march 19,2011
-- in v. 8.0 work fine!!



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #5966: extract(epoch..) function error
@ 2011-04-20 09:45  Joshua Tolley <eggyknap@gmail.com>
  parent: Ricardo Solanilla <info@abaco-tandil.com.ar>
  0 siblings, 0 replies; 2+ messages in thread

From: Joshua Tolley @ 2011-04-20 09:45 UTC (permalink / raw)
  To: Ricardo Solanilla <info@abaco-tandil.com.ar>; +Cc: pgsql-bugs

On Wed, Apr 06, 2011 at 11:17:42PM +0000, Ricardo Solanilla wrote:
> -- try this
> 
> select (extract(epoch from (date('2011-03-20'))) - extract(epoch from
> (date('2011-03-19')))) / 3600
> 
> -- it must be 24 (hours), only occurs in march 19,2011
> -- in v. 8.0 work fine!!

Are you sure this isn't just daylight saving time coming into play? I get
this, using US/Mountain time, which is explainable because DST started on
2011-03-13. The specific date where this happens will vary by your time zone
of choice, as different places start daylight saving time on different dates.

5432 josh@josh*# select extract(epoch from '2011-03-13'::date) - extract(epoch
from '2011-03-12'::date);
 ?column?
----------
    86400
(1 row)

5432 josh@josh*# select extract(epoch from '2011-03-14'::date) - extract(epoch
from '2011-03-13'::date);
 ?column?
----------
    82800
(1 row)

5432 josh@josh*# select extract(epoch from '2011-03-15'::date) - extract(epoch
from '2011-03-14'::date);
 ?column?
----------
    86400
(1 row)

If I set my timezone to US/Arizona, where daylight saving time is not used at
all, I get the behavior you expected:

5432 josh@josh*# set timezone to "US/Arizona";
SET
5432 josh@josh*# select extract(epoch from '2011-03-13'::date) - extract(epoch
from '2011-03-12'::date);
 ?column? 
----------
    86400
(1 row)

5432 josh@josh*# select extract(epoch from '2011-03-14'::date) - extract(epoch
from '2011-03-13'::date);
 ?column? 
----------
    86400
(1 row)

5432 josh@josh*# select extract(epoch from '2011-03-15'::date) - extract(epoch
from '2011-03-14'::date);
 ?column? 
----------
    86400
(1 row)

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Attachments:

  signature.asc (application/pgp-signature, 196B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-04-20 09:45 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06 23:17 BUG #5966: extract(epoch..) function error Ricardo Solanilla <info@abaco-tandil.com.ar>
2011-04-20 09:45 ` Joshua Tolley <eggyknap@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox