SV: to_timestamp function

From: Gustavsson Mikael <mikael(dot)gustavsson(at)smhi(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: SV: to_timestamp function
Date: 2019-03-21 07:11:18
Message-ID: 89DE7C43D727C04CA77C8B7AB82533CD023DB858B6@WINVMSERV463.ad.smhi.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for fast reply!

I'll forward the answer to my developers.

kr
Mikael Gustavsson
________________________________________
Från: Tom Lane [tgl(at)sss(dot)pgh(dot)pa(dot)us]
Skickat: den 20 mars 2019 17:33
Till: Gustavsson Mikael
Kopia: pgsql-general(at)lists(dot)postgresql(dot)org
Ämne: Re: to_timestamp function

Gustavsson Mikael <mikael(dot)gustavsson(at)smhi(dot)se> writes:
> So my question is, is it intentional that to_timestamp is stricter than cast to timestamp?

Yes. The point of using that function at all is to be strict about the
input format, so being strict about the field values seems to make
sense along with that. An independent argument for it is mentioned in
the commit message (d3cd36a13):

Historically, something like to_date('2009-06-40','YYYY-MM-DD') would
return '2009-07-10' because there was no prohibition on out-of-range
month or day numbers. This has been widely panned, and it also turns
out that Oracle throws an error in such cases. Since these functions
are nominally Oracle-compatibility features, let's change that.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2019-03-21 12:35:36 Re: Performance of ByteA: ascii vs binary
Previous Message Noah Misch 2019-03-21 05:40:30 Re: LDAP on AIX build farm animals