pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Artem Andreev <artem@oktetlabs.ru>
To: pgsql-bugs@postgresql.org
Subject: BUG #6126: CC parameter in to_char() behaves incorrectly
Date: Thu, 21 Jul 2011 08:40:11 GMT
Message-ID: <201107210840.p6L8eBeA041492@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      6126
Logged by:          Artem Andreev
Email address:      artem@oktetlabs.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



view thread (5+ messages)  latest in thread

Message-ID: <201107210840.p6L8eBeA041492@wwwmaster.postgresql.org>
Permalink:  ../201107210840.p6L8eBeA041492@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201107210840.p6L8eBeA041492@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: artem@oktetlabs.ru
  Subject: Re: BUG #6126: CC parameter in to_char() behaves incorrectly
  In-Reply-To: <201107210840.p6L8eBeA041492@wwwmaster.postgresql.org>
  References: <201107210840.p6L8eBeA041492@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