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

2021-10-22 Thread Peter J. Holzer
On 2021-10-22 10:26:38 -0700, Bryn Llewellyn wrote: > 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. I think to_date() is very muc

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

2021-10-22 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > > 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 cours

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

2021-10-22 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > >> Bryn wrote: >> >> There could, so easily, have been three “to_char()” overloads for these >> three data types… > > The argument about avoiding the implicit cast, and thus being easier for > newcomers to figure out, is the compelling one for me. But, fra

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

2021-10-22 Thread David G. Johnston
On Friday, October 22, 2021, Bryn Llewellyn wrote: > > 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. > Even if we added to_char(

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

2021-10-22 Thread Rob Sargent
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- TZH:TZM'); to_c

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

2021-10-22 Thread Adrian Klaver
On 10/22/21 10:26 AM, Bryn Llewellyn wrote: // I’ll make this my final turn on this thread. Yes, I accept that everything to do with the date-time story is tough stuff. And I do understand that this is, to a large extent, just a reflection of the fact that the terrain is inevitably affected

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

2021-10-22 Thread Tom Lane
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 da

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

2021-10-22 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > > Bryn wrote: > >>> adrian.kla...@aklaver.com wrote: >>> >>> Bryn wrote: > Adrian Klaver wrote: > ... >> You've lost me entirely here, I'm afraid. >> My question was simple: why is there no "to_char ( date, text ) → text" >> overload? > > Because th

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

2021-10-22 Thread Adrian Klaver
On 10/21/21 17:42, Bryn Llewellyn wrote: On 21-Oct-2021, at 17:15, Adrian Klaver wrote: On 10/21/21 15:45, Bryn Llewellyn wrote: /Adrian Klaver wrote:/ *Why is there no "date" overload of "to_char()"?* You've lost me entirely here, I'm afraid. My question was simple: why is there no "to

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

2021-10-21 Thread Bryn Llewellyn
> On 21-Oct-2021, at 17:15, Adrian Klaver wrote: > > On 10/21/21 15:45, Bryn Llewellyn wrote: >>> /Adrian Klaver wrote:/ >>> /Bryn wrote:/ > >> Thanks, too, to David Johnston for your reply. Yes, I see now that the >> "10.1. Overview" page that starts the "Type Conversion" chapter d

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

2021-10-21 Thread Adrian Klaver
On 10/21/21 15:45, Bryn Llewellyn wrote: /Adrian Klaver wrote:/ /Bryn wrote:/ Thanks, too, to David Johnston for your reply. Yes, I see now that the "10.1. Overview" page that starts the "Type Conversion" chapter does have lots of inflexions of the verb "prefer". And close to one of these

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

2021-10-21 Thread Bryn Llewellyn
> Adrian Klaver wrote: > >> Bryn wrote: >> >> I fear that I'm about to embarrass myself again. So I'll just ask for >> forgiveness in advance. Here's a simple test to get started. (All tests are >> done in a session where I set the timezone to 'UTC'.) >> >> drop function if exists f(text)

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

2021-10-21 Thread Adrian Klaver
On 10/21/21 12:52, Bryn Llewellyn wrote: I fear that I'm about to embarrass myself again. So I'll just ask for forgiveness in advance. Here's a simple test to get started. (All tests are done in a session where I set the timezone to 'UTC'.) *drop function if exists f(text)        cascade; **

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

2021-10-21 Thread David G. Johnston
On Thursday, October 21, 2021, Bryn Llewellyn wrote: > > This causes the 42883 error, "function f(date) does not exist". I might've > expected the system to have done an implicit conversion to "text" because > this conversion is supported, thus: > Yes, implicit casting to text is bad. > > For

Looking for a doc section that presents the overload selection rules

2021-10-21 Thread Bryn Llewellyn
I fear that I'm about to embarrass myself again. So I'll just ask for forgiveness in advance. Here's a simple test to get started. (All tests are done in a session where I set the timezone to 'UTC'.) drop function if exists f(text)cascade; drop function if exists f(timestamp) cascade;