Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B0124B5DC1B for ; Wed, 21 Sep 2011 18:17:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 57006-02 for ; Wed, 21 Sep 2011 21:17:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id D51DCB5DC01 for ; Wed, 21 Sep 2011 18:17:31 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p8LLHV68007285 for ; Wed, 21 Sep 2011 21:17:31 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p8LLHVwW007284; Wed, 21 Sep 2011 21:17:31 GMT (envelope-from www) Date: Wed, 21 Sep 2011 21:17:31 GMT Message-Id: <201109212117.p8LLHVwW007284@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6219: date_part() function producting incorrect year From: "Eric Vollnogel" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201109/146 X-Sequence-Number: 31163 The following bug has been logged online: Bug reference: 6219 Logged by: Eric Vollnogel Email address: edvollnogel@dstsystems.com PostgreSQL version: 9.0.4 64bit Operating system: Windows 7 SP 1 64bit Description: date_part() function producting incorrect year Details: The date_part('isoyear', some_column) function is not always returning the correct result. See below: Example 1: (date_part returns incorrect year) SQL: SELECT date_part('isoyear', observation_start), observation_start FROM service_point_observations WHERE observation_start >= '2011-01-01' AND observation_start < '2011-01-02' LIMIT 5; Output: 2010;"2011-01-01 00:00:00-06" 2010;"2011-01-01 00:00:00-06" 2010;"2011-01-01 00:00:00-06" 2010;"2011-01-01 00:00:00-06" 2010;"2011-01-01 00:00:00-06" Example 2: (date_part returns incorrect year) SQL: SELECT date_part('isoyear', observation_start), observation_start FROM service_point_observations WHERE observation_start >= '2011-01-02' AND observation_start < '2011-01-03' LIMIT 5; Output: 2010;"2011-01-02 00:00:00-06" 2010;"2011-01-02 00:00:00-06" 2010;"2011-01-02 00:00:00-06" 2010;"2011-01-02 00:00:00-06" 2010;"2011-01-02 00:00:00-06" Example 2: (date_part returns CORRECT year) SQL: SELECT date_part('isoyear', observation_start), observation_start FROM service_point_observations WHERE observation_start >= '2011-01-03' AND observation_start < '2011-01-04' LIMIT 5; Output: 2011;"2011-01-03 00:00:00-06" 2011;"2011-01-03 00:00:00-06" 2011;"2011-01-03 00:00:00-06" 2011;"2011-01-03 00:00:00-06" 2011;"2011-01-03 00:00:00-06" Thank you for your assistance, ERIC VOLLNOGEL