BUG #6126: CC parameter in to_char() behaves incorrectly

From: "Artem Andreev" <artem(at)oktetlabs(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6126: CC parameter in to_char() behaves incorrectly
Date: 2011-07-21 08:40:11
Message-ID: 201107210840.p6L8eBeA041492@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: 6126
Logged by: Artem Andreev
Email address: artem(at)oktetlabs(dot)ru
PostgreSQL version: 9.0.4
Operating system: Debian 6.0
Description: CC parameter in to_char() behaves incorrectly
Details:

CC parameter in to_char() behaves incorrectly with BC dates:

1st century BC:

select to_char('0002-01-01 00:00:00 BC' :: timestamp, 'CC');
====>
to_char
---------
01

2nd century BC:

select to_char('0101-01-01 00:00:00 BC' :: timestamp, 'CC');
=====>
to_char
---------
00

3rd century BC:
iliran=> select to_char('0301-01-01 00:00:00 BC' :: timestamp, 'CC');
to_char
---------
-2

In all these cases EXTRACT(CENTURY FROM ...) yields the expected result

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2011-07-21 12:43:15 Re: BUG #6086: Segmentation fault
Previous Message Craig Ringer 2011-07-21 03:20:54 Re: BUG #6119: Postgres ODBC Install.msi