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 1mdz5d-0000Uu-03 for pgsql-general@arkaria.postgresql.org; Fri, 22 Oct 2021 18:16:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdz5b-00038r-Hd for pgsql-general@arkaria.postgresql.org; Fri, 22 Oct 2021 18:16:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdz5b-00038i-3w for pgsql-general@lists.postgresql.org; Fri, 22 Oct 2021 18:16:23 +0000 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mdz5U-0003Hk-HS for pgsql-general@lists.postgresql.org; Fri, 22 Oct 2021 18:16:21 +0000 Received: by mail-il1-x12e.google.com with SMTP id j10so1885798ilu.2 for ; Fri, 22 Oct 2021 11:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=l2cgHrDsNoBe9Y1zoXUOfh/sPIahBXK7R0PiiONT6rc=; b=O0jEs7X6/0bAC7fFm1XY3OBtorxDZ0Mfrp2dUHe2bMdAlwgDPRSjpFsai9qQIjPYo9 8iSRY/Uu/ptVAWBYmYLtNFtMLbh4y2AQ1yNCI46HiIBYw5ENjR3sqOXHdd6KqAnD5iaB FswtpwfcG+K5ngwGTHkvkAcgp+TE3FYE5f6uRwedFgiJcq+f3bDt34CdaywSQrBuGI5N p89ZLU3mYsB7qSRThdnCPJIXeKzIoj3MwJC1PyV6X/leKlXkzSD9afvJaOtZqfv8h8P1 LYILmq4q3BEzbiTv/MslaTHO6CACCERaGnqcmPiVqXENhA4+NNXi2BAgxWaDQOpEkh4G t2RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=l2cgHrDsNoBe9Y1zoXUOfh/sPIahBXK7R0PiiONT6rc=; b=nDwbS5sU6K10aovPsp1b+Umkd6Y7JcdwuaTEfDi9XVmUbCrUibnoNU3LLmJPoipVbb G+X9RRqO8yyRm6rtOTJxU/IxV0Q8o53nR8H3ClNC5RPBM0c9FahaaRAnnCEv2wLo528T +LUlOpZKS0GHl0X7loadzqRP2axqItzZwF9gugxlvMCQE2qpTsckaRtFK843yMlr0Xjp 4quiUd4utYUILxIGEyGa8TLjRXNI4JGJTke4oMSZ2lRpaQdk29557EvJ7kMFSV0L3vT1 tdiWx8axJ05CYUnHzBMFdRS88O8e8kpOsaoXH463gFefZ0J10owVBNQhp+rntzw7jqbb EIWw== X-Gm-Message-State: AOAM5302aSj5Ja4vQYgy1rLNjODWC2Ems0+aiIK76jsyrVG8yqvVL0Bs H55LFa8pA5RKCdJXyf0O6qHhJKRgSew= X-Google-Smtp-Source: ABdhPJzTq7uuZpudMKG0r63bM7tXrzzqnSeD4tpsIOni/2uYx1wuXybGKN+bwXxG1C+qTgWGkRAp/g== X-Received: by 2002:a92:cdaa:: with SMTP id g10mr954580ild.1.1634926575581; Fri, 22 Oct 2021 11:16:15 -0700 (PDT) Received: from [10.0.0.94] (c-73-63-59-118.hsd1.ut.comcast.net. [73.63.59.118]) by smtp.gmail.com with ESMTPSA id o2sm4502600iow.16.2021.10.22.11.16.14 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Oct 2021 11:16:15 -0700 (PDT) Subject: Re: Looking for a doc section that presents the overload selection rules To: pgsql-general@lists.postgresql.org 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> <2723042.1634924892@sss.pgh.pa.us> From: Rob Sargent Message-ID: Date: Fri, 22 Oct 2021 12:16:14 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <2723042.1634924892@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------2955B166D4C2DBC2B9A05BAB" Content-Language: en-CA List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------2955B166D4C2DBC2B9A05BAB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > 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 Going down that path I would be sorely tempted to default the format text to the style I typically want. create function to_char(dt date, fmt text default 'dd-Mon-yyyy TZH:TZM') returns text --------------2955B166D4C2DBC2B9A05BAB Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
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

Going down that path I would be sorely tempted to default the format text to the style I typically want.
create function to_char(dt date, fmt text default 'dd-Mon-yyyy TZH:TZM') returns text
--------------2955B166D4C2DBC2B9A05BAB--