From 7a52a8f829a9f50e054a0643826f73092749c0cf Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 15 Mar 2009 20:31:19 +0000 Subject: Clean up the code for to_timestamp's conversion of year plus ISO day number to date, as per bug #4702 and subsequent discussion. In particular, make it work for years specified using AD/BC or CC fields, and fix the test for "no year specified" so that it doesn't trigger inappropriately for 1 BC (which it was doing even in code paths that had nothing to do with to_timestamp). I also did some minor code beautification in the non-ISO-day-number code path. This area has been busted all along, but because the code has been rewritten repeatedly, it would be considerable trouble to back-patch. It's such a corner case that it doesn't seem worth the effort. --- src/backend/utils/adt/timestamp.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/backend/utils/adt/timestamp.c') diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 06eb044f0c5..2d1e7ff45ae 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.196 2009/01/01 17:23:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.197 2009/03/15 20:31:19 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3668,11 +3668,6 @@ isoweek2j(int year, int week) int day0, day4; - if (!year) - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot calculate week number without year information"))); - /* fourth day of current year */ day4 = date2j(year, 1, 4); -- cgit v1.2.3