pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bryn Llewellyn <bryn@yugabyte.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Looking for a doc section that presents the overload selection rules
Date: Fri, 22 Oct 2021 13:48:12 -0400
Message-ID: <2723042.1634924892@sss.pgh.pa.us> (raw)
In-Reply-To: <476BE5DC-8D86-422B-9463-C41696271A22@yugabyte.com>
References: <4F35D95E-4974-44FC-AA4B-3F1E94580B82@yugabyte.com>
	<b9d87b72-aaf2-1d6a-951a-d67f866fbd66@aklaver.com>
	<F71D1FD3-F0A9-48F1-B8F2-9018D6D0DF31@yugabyte.com>
	<4f7a9fe8-ea27-e4a3-34ac-f05fcfb7f5c3@aklaver.com>
	<B4E55133-926B-4A0D-8E17-C0EE984531E7@yugabyte.com>
	<36e3e2a5-cf09-61e2-3f12-3ea6d17e3ccd@aklaver.com>
	<476BE5DC-8D86-422B-9463-C41696271A22@yugabyte.com>

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





view thread (15+ messages)  latest in thread

Message-ID: <2723042.1634924892@sss.pgh.pa.us>
Permalink:  ../2723042.1634924892@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2723042.1634924892@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bryn@yugabyte.com, adrian.klaver@aklaver.com, david.g.johnston@gmail.com
  Subject: Re: Looking for a doc section that presents the overload selection rules
  In-Reply-To: <2723042.1634924892@sss.pgh.pa.us>
  References: <4F35D95E-4974-44FC-AA4B-3F1E94580B82@yugabyte.com> <b9d87b72-aaf2-1d6a-951a-d67f866fbd66@aklaver.com> <F71D1FD3-F0A9-48F1-B8F2-9018D6D0DF31@yugabyte.com> <4f7a9fe8-ea27-e4a3-34ac-f05fcfb7f5c3@aklaver.com> <B4E55133-926B-4A0D-8E17-C0EE984531E7@yugabyte.com> <36e3e2a5-cf09-61e2-3f12-3ea6d17e3ccd@aklaver.com> <476BE5DC-8D86-422B-9463-C41696271A22@yugabyte.com> <2723042.1634924892@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox