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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Looking for a doc section that presents the overload selection rules
Date: 2021-10-22 17:48:12
Message-ID: 2723042.1634924892@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bryn Llewellyn <bryn(at)yugabyte(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-10-22 17:51:13 Re: Looking for a doc section that presents the overload selection rules
Previous Message Bryn Llewellyn 2021-10-22 17:26:38 Re: Looking for a doc section that presents the overload selection rules