Re: BUG #16238: Function " to_char(timestamp, text) " doesn't work properly

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #16238: Function " to_char(timestamp, text) " doesn't work properly
Дата
Msg-id 22130.1580401622@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #16238: Function " to_char(timestamp, text) " doesn't work properly  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #16238: Function " to_char(timestamp, text) " doesn't workproperly  (Nick Memos <memnik@hotmail.com>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> As i noticed the problem is that the function "
> to_char(timestamp, text) "  doesn't work properly. For example this query "
> select to_char('2020-01-29'::date,'Day') " give me this result "Wednesday",
> but this query " select to_char('2020-01-31'::date,'Day') "  give me this
> result "Friday   ".
> So, i guess it is not right to have days with many spaces as a result and
> some days without any space.

No, that's behaving as expected and documented.  If you don't want
fixed-width output, use the FM prefix:

=# select to_char('2020-01-31'::date,'-Day-');
   to_char   
-------------
 -Friday   -
(1 row)

=# select to_char('2020-01-31'::date,'-FMDay-');
 to_char  
----------
 -Friday-
(1 row)

            regards, tom lane



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

Предыдущее
От: "Walker, Jared (Contractor)"
Дата:
Сообщение: RE: [EXTERNAL] Re: BUG #16131: pg_upgrade 9 -> 11.6 and a database ismissing
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Moderate Error in German help of pg_ctl