to_timestamp docs - Mailing list pgsql-hackers

From Bruce Momjian
Subject to_timestamp docs
Date
Msg-id 20190501133856.wqtxb4ls3qjlb3wv@momjian.us
Whole thread Raw
Responses Re: to_timestamp docs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I don't think the changes made in PG 12 are documented accurately.  It
currently says:

    to_timestamp and to_date matches any single separator in the input
    string or is skipped

However, I think it is more accurate to say _multiple_ whitespace can
also be matched by a single separator:

    SELECT to_timestamp('%1976','_YYYY');
          to_timestamp
    ------------------------
     1976-01-01 00:00:00-05
    
    SELECT to_timestamp('%%1976','_YYYY');
    ERROR:  invalid value "%197" for "YYYY"
    DETAIL:  Value must be an integer.
    
    -- two spaces
-->    SELECT to_timestamp('  1976','_YYYY');
          to_timestamp
    ------------------------
     1976-01-01 00:00:00-05

-->    SELECT to_timestamp(E'\t\t\t1976','_YYYY');
          to_timestamp
    ------------------------
     1976-01-01 00:00:00-05

Proposed patch attached.

-- 
  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 +

Attachment

pgsql-hackers by date:

Previous
From: Alexander Kukushkin
Date:
Subject: Re: walsender vs. XLogBackgroundFlush during shutdown
Next
From: Tom Lane
Date:
Subject: Re: to_timestamp docs