pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eric Vollnogel <edvollnogel@dstsystems.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6219: date_part() function producting incorrect year
Date: Wed, 21 Sep 2011 21:17:31 GMT
Message-ID: <201109212117.p8LLHVwW007284@wwwmaster.postgresql.org> (raw)


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



view thread (2+ messages)  latest in thread

Message-ID: <201109212117.p8LLHVwW007284@wwwmaster.postgresql.org>
Permalink:  ../201109212117.p8LLHVwW007284@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201109212117.p8LLHVwW007284@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: edvollnogel@dstsystems.com
  Subject: Re: BUG #6219: date_part() function producting incorrect year
  In-Reply-To: <201109212117.p8LLHVwW007284@wwwmaster.postgresql.org>
  References: <201109212117.p8LLHVwW007284@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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