Re: to_date_valid()

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Andreas 'ads' Scherbaum <adsmail(at)wars-nicht(dot)de>, Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, 'Andreas Karlsson *EXTERN*' <andreas(at)proxel(dot)se>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Jaime Casanova <jaime(dot)casanova(at)2ndquadrant(dot)com>, Euler Taveira <euler(at)timbira(dot)com(dot)br>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: to_date_valid()
Date: 2016-09-22 01:35:15
Message-ID: bd34ca87-211c-e99a-5130-5872a53f4b12@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/9/16 4:48 AM, Andreas 'ads' Scherbaum wrote:
> ValidateDate() will tell you if it's a valid date. But not if the
> transformation was correct:
>
> postgres=# SELECT to_date('2011 12 18', 'YYYY MM DD');
> to_date
> ------------
> 2011-12-08
> (1 row)
>
> (with the patch from Artur)
>
>
> Any idea how to solve this problem?

I think we need to do overflow checking as we read the various values,
in do_to_timestamp() and functions called from it. This would be very
similar to overflow checking in input functions.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-09-22 02:23:27 Re: Hash Indexes
Previous Message Peter Eisentraut 2016-09-22 01:18:48 Re: System load consideration before spawning parallel workers