Re: insert throw error when year field len > 4 for timestamptz datatype

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Haribabu kommi <haribabu(dot)kommi(at)huawei(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: insert throw error when year field len > 4 for timestamptz datatype
Date: 2013-10-16 17:23:32
Message-ID: 20131016172332.GB18048@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 8, 2013 at 09:05:37AM -0400, Bruce Momjian wrote:
> On Tue, Oct 8, 2013 at 05:08:17PM +0530, Rushabh Lathia wrote:
> > This
> > might be a case where throwing an error is actually better than trying
> > to make sense of the input.
> >
> > I don't feel super-strongly about this, but I offer it as a question
> > for reflection.
> >
> >
> >
> > At the same time I do agree fixing this kind of issue in postgres datetime
> > module
> > is bit difficult without some assumption. Personally I feel patch do add some
> > value but not fully compatible with all kind of year field format.
> >
> > Bruce,
> >
> > Do you have any thought/suggestion ?
>
> I think Robert is asking the right question: Is it better to accept
> 5-digit years, or throw an error? Doing anything new with 6-digit years
> is going to break the much more common use of YMD or HMS.
>
> The timestamp data type only supports values to year 294276, so the full
> 6-digit range isn't even supported. ('DATE' does go higher.)
>
> The entire date/time processing allows imprecise input, so throwing an
> error on clear 5-digit years seems wrong. Basically, we have gone down
> the road of interpreting date/time input liberally, so throwing an error
> on a clear 5-digit year seems odd.
>
> On the other hand, this has never come up before because no one cared
> about 5-digit years, so you could argue that 5-digit years require
> precise specification, which would favor throwing an error.

Patch applied to support 5+ digit years in non-ISO timestamp/date
strings, where appropriate.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2013-10-16 17:25:22 Re: removing old ports and architectures
Previous Message Robert Haas 2013-10-16 17:04:23 Re: removing old ports and architectures