Re: to_date_valid()

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Euler Taveira <euler(at)timbira(dot)com(dot)br>
Cc: "Andreas 'ads' Scherbaum" <adsmail(at)wars-nicht(dot)de>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: to_date_valid()
Date: 2016-07-04 02:25:55
Message-ID: CAMsr+YHkfZ3KtRwrX+cYOLMXgUzFLTyfNnuNMB7KjOLhi6Mrig@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3 July 2016 at 09:32, Euler Taveira <euler(at)timbira(dot)com(dot)br> wrote:

> On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote:
> > The attached patch adds a new function "to_date_valid()" which will
> > validate the date and return an error if the input and output date do
> > not match. Tests included, documentation update as well.
> >
> Why don't you add a third parameter (say, validate = true | false)
> instead of creating another function? The new parameter could default to
> false to not break compatibility.
>

because

SELECT to_date('blah', 'pattern', true)

is less clear to read than

SELECT to_date_valid('blah', 'pattern')

and offers no advantage. It's likely faster to use a separate function too.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-07-04 03:02:14 Re: Parallel appendrel scans?
Previous Message Craig Ringer 2016-07-04 00:21:23 Re: Docs, backups, and MS VSS