to_timestamp docs

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: to_timestamp docs
Date: 2019-05-01 13:38:56
Message-ID: 20190501133856.wqtxb4ls3qjlb3wv@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)momjian(dot)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 Content-Type Size
to_timestamp.diff text/x-diff 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-05-01 14:01:50 Re: to_timestamp docs
Previous Message Alexander Kukushkin 2019-05-01 12:13:10 Re: walsender vs. XLogBackgroundFlush during shutdown