pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedMysteries of the future
4+ messages / 3 participants
[nested] [flat]
* Mysteries of the future
@ 2024-04-10 15:00 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 4+ messages in thread
From: PG Doc comments form @ 2024-04-10 15:00 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: y.saburov@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/16/functions-formatting.html
Description:
I'm not sure that there will be 31 days in 11 months; although postgresql
probably knows better what will happen in 20000
For example (with the year 20000): to_date('200001131', 'YYYYMMDD') will be
interpreted as a 4-digit year; instead use a non-digit separator after the
year, like to_date('20000-1131', 'YYYY-MMDD') or to_date('20000Nov31',
'YYYYMonDD').
https://www.postgresql.org/docs/current/functions-formatting.html
```sql
SELECT to_date('20000-1131', 'YYYY-MMDD');
ERROR: 22008: date/time field value out of range: "20000-1131"
LOCATION: DateTimeParseError, datetime.c:4021
```
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Mysteries of the future
@ 2024-04-11 14:20 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2024-04-11 14:20 UTC (permalink / raw)
To: y.saburov@gmail.com; +Cc: pgsql-docs@lists.postgresql.org
PG Doc comments form <noreply@postgresql.org> writes:
> SELECT to_date('20000-1131', 'YYYY-MMDD');
> ERROR: 22008: date/time field value out of range: "20000-1131"
What exactly do you find wrong with that? November doesn't have
31 days.
Sure, we could have a discussion about the probability of the
Gregorian calendar still being in use 18000 years from now,
but it doesn't seem very profitable. What else do you want
to use?
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Mysteries of the future
@ 2024-04-11 14:34 David G. Johnston <david.g.johnston@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: David G. Johnston @ 2024-04-11 14:34 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: y.saburov@gmail.com; pgsql-docs@lists.postgresql.org
On Thu, Apr 11, 2024 at 7:20 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> PG Doc comments form <noreply@postgresql.org> writes:
> > SELECT to_date('20000-1131', 'YYYY-MMDD');
> > ERROR: 22008: date/time field value out of range: "20000-1131"
>
> What exactly do you find wrong with that? November doesn't have
> 31 days.
>
> Sure, we could have a discussion about the probability of the
> Gregorian calendar still being in use 18000 years from now,
> but it doesn't seem very profitable. What else do you want
> to use?
>
The request is to fix our documentation to use a valid date for the example
in the paragraph that describes the separator requirement for years greater
than 4 digits.
In to_timestamp and to_date, the YYYY conversion has a restriction when
processing years with more than 4 digits. You must use some non-digit
character or template after YYYY, otherwise the year is always interpreted
as 4 digits. For example (with the year 20000): to_date('200001131',
'YYYYMMDD') will be interpreted as a 4-digit year; instead use a non-digit
separator after the year, like to_date('20000-1131', 'YYYY-MMDD') or
to_date('20000Nov31', 'YYYYMonDD').
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Mysteries of the future
@ 2024-04-11 14:47 Tom Lane <tgl@sss.pgh.pa.us>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2024-04-11 14:47 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: y.saburov@gmail.com; pgsql-docs@lists.postgresql.org
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The request is to fix our documentation to use a valid date for the example
> in the paragraph that describes the separator requirement for years greater
> than 4 digits.
Oh! Got it, that should be fixed.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-04-11 14:47 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 15:00 Mysteries of the future PG Doc comments form <noreply@postgresql.org>
2024-04-11 14:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-04-11 14:34 ` David G. Johnston <david.g.johnston@gmail.com>
2024-04-11 14:47 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox