Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdyeS-0007Yc-U9 for pgsql-general@arkaria.postgresql.org; Fri, 22 Oct 2021 17:48:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdyeR-0003oj-C9 for pgsql-general@arkaria.postgresql.org; Fri, 22 Oct 2021 17:48:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdyeR-0003oa-2H for pgsql-general@lists.postgresql.org; Fri, 22 Oct 2021 17:48:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdyeO-0002St-Ob for pgsql-general@lists.postgresql.org; Fri, 22 Oct 2021 17:48:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19MHmC3W2723043; Fri, 22 Oct 2021 13:48:12 -0400 From: Tom Lane To: Bryn Llewellyn cc: Adrian Klaver , "David G. Johnston" , pgsql-general list Subject: Re: Looking for a doc section that presents the overload selection rules In-reply-to: <476BE5DC-8D86-422B-9463-C41696271A22@yugabyte.com> References: <4F35D95E-4974-44FC-AA4B-3F1E94580B82@yugabyte.com> <4f7a9fe8-ea27-e4a3-34ac-f05fcfb7f5c3@aklaver.com> <36e3e2a5-cf09-61e2-3f12-3ea6d17e3ccd@aklaver.com> <476BE5DC-8D86-422B-9463-C41696271A22@yugabyte.com> Comments: In-reply-to Bryn Llewellyn message dated "Fri, 22 Oct 2021 10:26:38 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2723041.1634924892.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 22 Oct 2021 13:48:12 -0400 Message-ID: <2723042.1634924892@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bryn Llewellyn 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