Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 798B8B5DC01 for ; Thu, 21 Jul 2011 05:40:12 -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 89682-09 for ; Thu, 21 Jul 2011 08:40:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id D8C9EB5DBBF for ; Thu, 21 Jul 2011 05:40:11 -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 p6L8eBwg041498 for ; Thu, 21 Jul 2011 08:40:11 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p6L8eBeA041492; Thu, 21 Jul 2011 08:40:11 GMT (envelope-from www) Date: Thu, 21 Jul 2011 08:40:11 GMT Message-Id: <201107210840.p6L8eBeA041492@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6126: CC parameter in to_char() behaves incorrectly From: "Artem Andreev" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201107/155 X-Sequence-Number: 30767 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