Re: to_date() and to_timestamp() with negative years

2021-11-04 Thread Adrian Klaver
On 11/4/21 10:29 AM, Bryn Llewellyn wrote: /adrian.kla...@aklaver.com wrote:/ Not sure how this can be handled in a totally predictable way given the unpredictable ways in which datetime strings are formatted? The only thing I can say it is it points out tha

Re: to_date() and to_timestamp() with negative years

2021-11-04 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > > Not sure how this can be handled in a totally predictable way given the > unpredictable ways in which datetime strings are formatted? > > The only thing I can say it is it points out that when working with datetimes > settling on a standard format is your

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Adrian Klaver
On 11/3/21 19:12, Bryn Llewellyn wrote: /adrian.kla...@aklaver.com wrote:/ Back to the point about separators, the "Current" doc has this bullet: « A separator (a space or non-letter/non-digit character) in the template string of to_timestamp and to_date m

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Bryn Llewellyn
> adrian.kla...@aklaver.com wrote: > > On 11/3/21 17:00, Adrian Klaver wrote: >> On 11/3/21 15:56, Bryn Llewellyn wrote: t...@sss.pgh.pa.us wrote: > >>> And you have to have some kind of separator between the years substring and >>> the adjacent one(s) even to succeed with years that

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Adrian Klaver
On 11/3/21 17:00, Adrian Klaver wrote: On 11/3/21 15:56, Bryn Llewellyn wrote: t...@sss.pgh.pa.us wrote: And you have to have some kind of separator between the years substring and the adjacent one(s) even to succeed with years that have more than four digits. Another usage note stresses th

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Adrian Klaver
On 11/3/21 15:56, Bryn Llewellyn wrote: t...@sss.pgh.pa.us wrote: Adrian Klaver writes: Haven't had time to work through what the above is actually doing. I think the first two are explained by 489c9c340: Also, arrange for the combination of a negative year and an explicit "BC" mark

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > > Adrian Klaver writes: >> Haven't had time to work through what the above is actually doing. > > I think the first two are explained by 489c9c340: > >Also, arrange for the combination of a negative year and an >explicit "BC" marker to cancel out and produc

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Tom Lane
Adrian Klaver writes: > Haven't had time to work through what the above is actually doing. I think the first two are explained by 489c9c340: Also, arrange for the combination of a negative year and an explicit "BC" marker to cancel out and produce AD. This is how the negative-centur

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Adrian Klaver
On 11/3/21 1:39 PM, Bryn Llewellyn wrote: /adrian.kla...@aklaver.com wrote:/ /Bryn wrote:/ In what PG version did you run your test? I'm not surprised that grandfathered-in "solution" that I described will never go away—despite its questionable conceptual

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Bryn Llewellyn
adrian.kla...@aklaver.com wrote: > Bryn wrote: > >>> t...@sss.pgh.pa.us wrote: >>> >>> Bryn Llewellyn writes: Is there any chance that you might be bold and simply make negative "year" values illegal in "to_date()" and "to_timestamp()" — just as they already are in "make_timest

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Adrian Klaver
On 11/3/21 11:18, Bryn Llewellyn wrote: t...@sss.pgh.pa.us wrote: Bryn Llewellyn writes: Is there any chance that you might be bold and simply make negative "year" values illegal in "to_date()" and "to_timestamp()" — just as they already are in "make_timestamp()", "make_timestamptz()", and th

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > > Bryn Llewellyn writes: >> Is there any chance that you might be bold and simply make negative "year" >> values illegal in "to_date()" and "to_timestamp()" — just as they already >> are in "make_timestamp()", "make_timestamptz()", and the "from text" >> typecasts

Re: to_date() and to_timestamp() with negative years

2021-11-03 Thread Tom Lane
Bryn Llewellyn writes: > Is there any chance that you might be bold and simply make negative "year" > values illegal in "to_date()" and "to_timestamp()" — just as they already are > in "make_timestamp()", "make_timestamptz()", and the "from text" typecasts to > date-time moment values? Uh, wha

to_date() and to_timestamp() with negative years

2021-11-03 Thread Bryn Llewellyn
I'm quoting here from "Usage notes for date/time formatting" just below "Table 9.25. Template Pattern Modifiers for Date/Time Formatting" here: https://www.postgresql.org/docs/current/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIMEMOD-TABLE on the page "9.8. Data Type Formatting Function