Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F3C631337B68 for ; Wed, 20 Apr 2011 06:46:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 52259-08 for ; Wed, 20 Apr 2011 09:46:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pv0-f174.google.com (mail-pv0-f174.google.com [74.125.83.174]) by mail.postgresql.org (Postfix) with ESMTP id 25CF71337B82 for ; Wed, 20 Apr 2011 06:46:23 -0300 (ADT) Received: by pvg12 with SMTP id 12so293365pvg.19 for ; Wed, 20 Apr 2011 02:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:to:cc:subject:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=SrB7NAA/6kJuyVIryRrQUKGVoUjRNJY8qupaYHHAsso=; b=MbOFA4uPLYKib5U61uhYgbN1MyIVV6pXKVRA/zolWwVeGJ80plCpvU8PBfAR7KCz98 3AZL152xkOY/sUmL4CuOSTvM6DvPni7/9utJ2Tm6ouFQJE2vKqvqWIKoccdUVhPalesU LNxuBZl8+fkpNk9yFQgaoAcIk0XUCRBH3Ebnc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:cc:subject:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=aZbx8Kbkbp/smxUXWcS3pv+MIOfBq1EWuhosUACf0b+wX8LUt0v812hgK9cvxUqN/0 eEsj+Ftztg6oH0ueB9VUQeGm4bhBgDU8UuiQz9ORvfjyHAHjOMsfyUIEl6Dfgiqj97gF mN5u+BZdjct2meHplFUaxOcJ8/OtlbmBcK/Qc= Received: by 10.143.21.14 with SMTP id y14mr3983006wfi.126.1303292783670; Wed, 20 Apr 2011 02:46:23 -0700 (PDT) Received: from eddie (c-67-186-249-122.hsd1.ut.comcast.net [67.186.249.122]) by mx.google.com with ESMTPS id o1sm1022713wfl.21.2011.04.20.02.46.20 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Apr 2011 02:46:21 -0700 (PDT) Message-ID: <4daeab6d.01568f0a.16ac.41af@mx.google.com> Date: Wed, 20 Apr 2011 03:45:26 -0600 From: Joshua Tolley To: Ricardo Solanilla Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5966: extract(epoch..) function error References: <201104062317.p36NHgAR084504@wwwmaster.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ik0NlRzMGhMnxrMX" Content-Disposition: inline In-Reply-To: <201104062317.p36NHgAR084504@wwwmaster.postgresql.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201104/141 X-Sequence-Number: 30060 --ik0NlRzMGhMnxrMX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 06, 2011 at 11:17:42PM +0000, Ricardo Solanilla wrote: > -- try this >=20 > select (extract(epoch from (date('2011-03-20'))) - extract(epoch from > (date('2011-03-19')))) / 3600 >=20 > -- 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 date= s. 5432 josh@josh*# select extract(epoch from '2011-03-13'::date) - extract(ep= och =66rom '2011-03-12'::date); ?column? ---------- 86400 (1 row) 5432 josh@josh*# select extract(epoch from '2011-03-14'::date) - extract(ep= och =66rom '2011-03-13'::date); ?column? ---------- 82800 (1 row) 5432 josh@josh*# select extract(epoch from '2011-03-15'::date) - extract(ep= och =66rom '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(ep= och =66rom '2011-03-12'::date); ?column?=20 ---------- 86400 (1 row) 5432 josh@josh*# select extract(epoch from '2011-03-14'::date) - extract(ep= och =66rom '2011-03-13'::date); ?column?=20 ---------- 86400 (1 row) 5432 josh@josh*# select extract(epoch from '2011-03-15'::date) - extract(ep= och =66rom '2011-03-14'::date); ?column?=20 ---------- 86400 (1 row) -- Joshua Tolley / eggyknap End Point Corporation http://www.endpoint.com --ik0NlRzMGhMnxrMX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEUEARECAAYFAk2uqzYACgkQRiRfCGf1UMNjTwCfbyTL1ZBgKPCsMspzfFVeooIL kwAAl0huiCg/5AxOsyQHxU6K8NZyA8M= =Kzpx -----END PGP SIGNATURE----- --ik0NlRzMGhMnxrMX--