BUG #6219: date_part() function producting incorrect year

From: "Eric Vollnogel" <edvollnogel(at)dstsystems(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6219: date_part() function producting incorrect year
Date: 2011-09-21 21:17:31
Message-ID: 201109212117.p8LLHVwW007284@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 6219
Logged by: Eric Vollnogel
Email address: edvollnogel(at)dstsystems(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2011-09-21 21:17:48 Re: Broken selectivity with special inet operators
Previous Message Tom Lane 2011-09-21 20:56:17 Re: Broken selectivity with special inet operators