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(date…) having it produce output “despite what the template asks for” is going to be questionable. At least this way we are honest about what we are doing - if you don’t want non-date stuff in the output don’t have it in the template. Unless the behavior is going to differ from what you can get today adding a new function doesn’t have a benefit. It’s unclear whether having different behavior is desirable.
The argument about avoiding the implicit cast, and thus being easier for newcomers to figure out, is the compelling one for me. But, frankly, “it just works” applies here - I’ve seen little evidence that there is a meaningful usability issue in the community.
David J.