to_timestamp docs

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема to_timestamp docs
Дата
Msg-id 20190501133856.wqtxb4ls3qjlb3wv@momjian.us
обсуждение исходный текст
Ответы Re: to_timestamp docs  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 +

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alexander Kukushkin
Дата:
Сообщение: Re: walsender vs. XLogBackgroundFlush during shutdown
Следующее
От: Tom Lane
Дата:
Сообщение: Re: to_timestamp docs