Re: Looking for a doc section that presents the overload selection rules

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Looking for a doc section that presents the overload selection rules
Дата
Msg-id 2723042.1634924892@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Looking for a doc section that presents the overload selection rules  (Bryn Llewellyn <bryn@yugabyte.com>)
Ответы Re: Looking for a doc section that presents the overload selection rules  (Rob Sargent <robjsargent@gmail.com>)
Re: Looking for a doc section that presents the overload selection rules  (Bryn Llewellyn <bryn@yugabyte.com>)
Список pgsql-general
Bryn Llewellyn <bryn@yugabyte.com> writes:
> There could, so easily, have been three “to_char()” overloads for these
> three data types that honored the spirit of the “::text” typecast by
> rendering only what’s meaningful, despite what the template asks for.

You can, of course, trivially make that so in your own database.

=# create function to_char(date, text) returns text
language sql stable strict parallel safe
as 'select pg_catalog.to_char($1::timestamp without time zone, $2)';

=# select to_char(current_date, 'dd-Mon-yyyy TZH:TZM');
      to_char       
--------------------
 22-Oct-2021 +00:00
(1 row)

Regardless of whether the original choice not to have this variant
was intentional or an oversight, I'd be pretty loath to change it now
because of backwards compatibility.  But Postgres is adaptable.

            regards, tom lane



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

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: Re: Looking for a doc section that presents the overload selection rules
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Looking for a doc section that presents the overload selection rules