Re: ParseDateTime in src/backend/utils/adt/datetime.c - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: ParseDateTime in src/backend/utils/adt/datetime.c
Date
Msg-id 20180525002423.GA2347@momjian.us
Whole thread Raw
In response to ParseDateTime in src/backend/utils/adt/datetime.c  (Vladimir Svedov <vodevsh@gmail.com>)
List pgsql-hackers
On Thu, May  3, 2018 at 12:21:45PM +0100, Vladimir Svedov wrote:
> Hi guys,
> https://stackoverflow.com/questions/50153122/
> how-come-this-postgres-query-is-working
> Above guys are surprised by "ignore other punctuation but use as delimiter"
> part.
> Do you think this should be mentioned in docs?
> E.g. https://www.postgresql.org/docs/current/static/functions-formatting.html
> docs have very thorough explanation on what is skipped and what parsed.
> 
> I believe at least interval '1^minute' equality to interval '1 minute' or other
> short comment would make it clear.
> 
> Sorry if Iwrote to a wrong list. Maybe I should write to 
> pgsql-docs@lists.postgresql.org instead? please point me If I should.

Hmm, that's interesting:

    SELECT interval '1^minute';
     interval
    ----------
     00:01:00

to_number() was just changed in Postgres 11 to properly ignore
puntuation:

        Prevent to_number() from consuming characters when the template
        separator does not match (Oliver Ford)

        Specifically, SELECT to_number('1234', '9,999') used to return 134.
        It will now return 1234.  L and TH now only consume characters
        that are not digits, positive/negative signs, decimal points,
        and commas.

so I think we are consistent in ignoring invalid input characters so I
would we would change it.

I am not sure adding documentation would really help much.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +


pgsql-hackers by date:

Previous
From: Mike Palmiotto
Date:
Subject: Re: contrib/sepgsql fails on Fedora 28
Next
From: Justin Pryzby
Date:
Subject: add default parallel query to v10 release notes? (Re: [PERFORM]performance drop after upgrade (9.6 > 10))