Re: to_date_valid()

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Euler Taveira <euler(at)timbira(dot)com(dot)br>, "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 03:39:22
Message-ID: f1178b58-041f-86cd-1c61-b1ee994dfbf9@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/07/16 15:19, Pavel Stehule wrote:
>
>
> 2016-07-04 4:25 GMT+02:00 Craig Ringer <craig(at)2ndquadrant(dot)com
> <mailto:craig(at)2ndquadrant(dot)com>>:
>
> On 3 July 2016 at 09:32, Euler Taveira <euler(at)timbira(dot)com(dot)br
> <mailto:euler(at)timbira(dot)com(dot)br>> wrote:
>
> On 02-07-2016 22 <tel:02-07-2016%2022>: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.
>
>
> personally I prefer first variant - this is same function with
> stronger check.
>
> The name to_date_valid sounds little bit strange - maybe
> to_date_strict should be better.
>
> Regards
>
> Pavel
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
>
Yeah, my feeling too, is that 'to_date_strict' would be better!

Cheers,
Gavin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-07-04 03:40:44 Re: primary_conninfo missing from pg_stat_wal_receiver
Previous Message Pavel Stehule 2016-07-04 03:19:21 Re: to_date_valid()