Re: [GENERAL] ISO week dates - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [GENERAL] ISO week dates
Date
Msg-id 200702140246.l1E2k5Q26443@momjian.us
Whole thread Raw
In response to Re: [GENERAL] ISO week dates  ("Brendan Jurd" <direvus@gmail.com>)
Responses Re: [GENERAL] ISO week dates  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-patches
Brendan Jurd wrote:
> I'd also like to raise the topic of how conversion from text to ISO
> week dates should be handled, where the user has specified a bogus
> mixture of fields.  Existing code basically ignores these issues; for
> example, if a user were to call to_date('1998-01-01 2454050',
> 'YYYY-MM-DD J') the function returns 2006-01-01, a result of setting
> the year field from YYYY, then overwriting year, month and day with
> the values from the Julian date in J, then setting the month and day
> normally from MM and DD.
>
> 2006-01-01 is not a valid representation of either of the values the
> user specified.  Now you might say "ask a silly question, get a silly
> answer"; the user shouldn't send nonsense arguments to to_date and
> expect a sensible result.  But perhaps the right way to respond to a
> broken timestamp definition is to throw an error, rather than behave
> as though everything has gone to plan, and return something which is
> not correct.
>
> The same situation can arise if the user mixes ISO and Gregorian data;
> how should Postgres deal with something like to_date('2006-250',
> 'IYYY-DDD')?  The current behaviour in my patch is actually to assume
> that the user meant to say 'IYYY-IDDD', since "the 250th Gregorian day
> of the ISO year 2006" is total gibberish.  But perhaps it should be
> throwing an error message.

On these questions, we have to find out how Oracle handles it, but your
approach seems appropriate.

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] ISO week dates
Next
From: Bruce Momjian
Date:
Subject: Re: psql \lo_* quiet mode patch