pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gustavsson Mikael <mikael.gustavsson@smhi.se>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: to_timestamp function
Date: Wed, 20 Mar 2019 12:33:20 -0400
Message-ID: <10068.1553099600@sss.pgh.pa.us> (raw)
In-Reply-To: <89DE7C43D727C04CA77C8B7AB82533CD022B4935BF@WINVMSERV464.ad.smhi.se>
References: <89DE7C43D727C04CA77C8B7AB82533CD022B4935BF@WINVMSERV464.ad.smhi.se>

Gustavsson Mikael <mikael.gustavsson@smhi.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




view thread (3+ messages)

Message-ID: <10068.1553099600@sss.pgh.pa.us>
Permalink:  ../10068.1553099600@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10068.1553099600@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mikael.gustavsson@smhi.se
  Subject: Re: to_timestamp function
  In-Reply-To: <10068.1553099600@sss.pgh.pa.us>
  References: <89DE7C43D727C04CA77C8B7AB82533CD022B4935BF@WINVMSERV464.ad.smhi.se> <10068.1553099600@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox