Ambiguous language in Table 8.13. Special Date/Time Inputs

Started by PG Bug reporting formalmost 7 years ago12 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/datatype-datetime.html
Description:

In Table 8.13. Special Date/Time Inputs, the description for the special
values 'today', 'tomorrow' and 'yesterday' uses the word 'midnight' e.g. the
special value 'today' is defined as 'midnight today'. I propose that the
word 'midnight' is ambiguous, because it can be interpreted either as
midnight at the start of the day in question, or midnight at the end of the
day. This ambiguity can be avoided if 'midnight' is replaced by '00:00:00',
or better, '00:00:00 local time'. Astronomers have deprecated the word
'midnight' for many years precisely to avoid this ambiguity.

David Harper

Senior DBA (and former astronomer)
Wellcome Sanger Institute
Cambridge, England

#2Bruce Momjian
bruce@momjian.us
In reply to: PG Bug reporting form (#1)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs

On Mon, Jul 8, 2019 at 10:07:59AM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/datatype-datetime.html
Description:

In Table 8.13. Special Date/Time Inputs, the description for the special
values 'today', 'tomorrow' and 'yesterday' uses the word 'midnight' e.g. the
special value 'today' is defined as 'midnight today'. I propose that the
word 'midnight' is ambiguous, because it can be interpreted either as
midnight at the start of the day in question, or midnight at the end of the
day. This ambiguity can be avoided if 'midnight' is replaced by '00:00:00',
or better, '00:00:00 local time'. Astronomers have deprecated the word
'midnight' for many years precisely to avoid this ambiguity.

Uh, I believe midnight is always the start of the day. I think
00:00:00 looks awkward.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +
#3David Harper
adh@sanger.ac.uk
In reply to: Bruce Momjian (#2)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

Uh, I believe midnight is always the start of the day.

The U.S. National Institute of Standards and Technology (NIST) deprecates the term “midnight” as ambiguous and recommmends the use of 24-hour clock notation:

===== BEGIN QUOTE =====
When someone refers to "midnight tonight" or "midnight last night" the reference of time is obvious. However, if a date/time is referred to as "at midnight on Friday, October 20th" the intention could be either midnight the beginning of the day or midnight at the end of the day.

To avoid ambiguity, specification of an event as occurring on a particular day at 11:59 p.m. or 12:01 a.m. is a good idea, especially legal documents such as contracts and insurance policies. Another option would be to use 24-hour clock, using the designation of 0000 to refer to midnight at the beginning of a given day (or date) and 2400 to designate the end of a given day (or date).
===== END QUOTE =====

Source:

https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs

I think 00:00:00 looks awkward.

Perhaps, but in technical documentation, accuracy should have priority over aesthetics, surely?

David Harper

Wellcome Sanger Institute, Cambridge, England

--
The Wellcome Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

#4Bruce Momjian
bruce@momjian.us
In reply to: David Harper (#3)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

On Tue, Jul 9, 2019 at 09:14:27AM +0100, David Harper wrote:

Uh, I believe midnight is always the start of the day.

The U.S. National Institute of Standards and Technology (NIST) deprecates the term “midnight” as ambiguous and recommmends the use of 24-hour clock notation:

===== BEGIN QUOTE =====
When someone refers to "midnight tonight" or "midnight last night" the reference of time is obvious. However, if a date/time is referred to as "at midnight on Friday, October 20th" the intention could be either midnight the beginning of the day or midnight at the end of the day.

To avoid ambiguity, specification of an event as occurring on a particular day at 11:59 p.m. or 12:01 a.m. is a good idea, especially legal documents such as contracts and insurance policies. Another option would be to use 24-hour clock, using the designation of 0000 to refer to midnight at the beginning of a given day (or date) and 2400 to designate the end of a given day (or date).
===== END QUOTE =====

Source:

https://www.nist.gov/pml/time-and-frequency-division/times-day-faqs

I think 00:00:00 looks awkward.

Perhaps, but in technical documentation, accuracy should have priority over aesthetics, surely?

Yes, I see what you mean now. How is this patch, which uses "zero
hour"?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

Attachments:

zero.difftext/x-diff; charset=us-asciiDownload+3-3
#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#4)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

Bruce Momjian <bruce@momjian.us> writes:

Yes, I see what you mean now. How is this patch, which uses "zero
hour"?

Ugh. Are we writing spy novels now?

I actually agree with your opinion that "midnight" is fine.
That text has been that way for over fifteen years[1]git blame dates the text to commit 1b342df00 of 2002-11-11, and apparently it was not new then, but I'm too lazy to dig further., and
nobody's complained before that it was ambiguous.

But, if we're going to change it, let's just s/midnight/00:00:00/
and be done. Making up fancy terminology doesn't improve matters.

regards, tom lane

[1]: git blame dates the text to commit 1b342df00 of 2002-11-11, and apparently it was not new then, but I'm too lazy to dig further.
apparently it was not new then, but I'm too lazy to dig further.

#6David Harper
adh@sanger.ac.uk
In reply to: Tom Lane (#5)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

I actually agree with your opinion that "midnight" is fine.
That text has been that way for over fifteen years[1], and
nobody's complained before that it was ambiguous.

Conversely, how many users over the past fifteen years have read that table, and then felt compelled (as I did) to run a query such as

select 'today'::timestamp,'yesterday'::timestamp,'tomorrow'::timestamp;

on their PostgreSQL cluster to clear the ambiguity for themselves?

Best regards

David Harper

Wellcome Sanger Institute, Cambridge, England

--
The Wellcome Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

#7Jonathan S. Katz
jkatz@postgresql.org
In reply to: David Harper (#6)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

On 7/10/19 6:13 AM, David Harper wrote:

I actually agree with your opinion that "midnight" is fine.
That text has been that way for over fifteen years[1], and
nobody's complained before that it was ambiguous.

Conversely, how many users over the past fifteen years have read that table, and then felt compelled (as I did) to run a query such as

select 'today'::timestamp,'yesterday'::timestamp,'tomorrow'::timestamp;

on their PostgreSQL cluster to clear the ambiguity for themselves?

I've heard of one, but only just recently :)

If we were to s/midnight/00:00:00/ we'd probably want to do it
everywhere midnight appears. This occurs in a few places in the docs:

https://www.postgresql.org/docs/current/functions-formatting.html (SSSS)
https://www.postgresql.org/docs/current/protocol-replication.html
(XlogData section)

and there are some various code comments as well.

Count me as a +0 vote, as I've always interpreted it the way Bruce & Tom
said upthread, but if we want to change it I can write a patch.

Jonathan

#8Bruce Momjian
bruce@momjian.us
In reply to: Jonathan S. Katz (#7)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

On Wed, Jul 10, 2019 at 01:32:31PM -0400, Jonathan Katz wrote:

On 7/10/19 6:13 AM, David Harper wrote:

I actually agree with your opinion that "midnight" is fine.
That text has been that way for over fifteen years[1], and
nobody's complained before that it was ambiguous.

Conversely, how many users over the past fifteen years have read that table, and then felt compelled (as I did) to run a query such as

select 'today'::timestamp,'yesterday'::timestamp,'tomorrow'::timestamp;

on their PostgreSQL cluster to clear the ambiguity for themselves?

I've heard of one, but only just recently :)

If we were to s/midnight/00:00:00/ we'd probably want to do it
everywhere midnight appears. This occurs in a few places in the docs:

https://www.postgresql.org/docs/current/functions-formatting.html (SSSS)
https://www.postgresql.org/docs/current/protocol-replication.html
(XlogData section)

and there are some various code comments as well.

Count me as a +0 vote, as I've always interpreted it the way Bruce & Tom
said upthread, but if we want to change it I can write a patch.

The thing I don't like about 00:00:00 is that it is a lot of information
to say "the start of the day", while I assumed midnight was clear on
that. If we can find a way to say "start of the day (midnight)", that
would work.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +
#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#8)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

Bruce Momjian <bruce@momjian.us> writes:

The thing I don't like about 00:00:00 is that it is a lot of information
to say "the start of the day", while I assumed midnight was clear on
that. If we can find a way to say "start of the day (midnight)", that
would work.

One really simple way to make it shorter is to say "00:00", leaving
out the seconds.

regards, tom lane

#10David Harper
adh@sanger.ac.uk
In reply to: Tom Lane (#9)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

One really simple way to make it shorter is to say "00:00", leaving
out the seconds.

That’s a good solution. It removes the long-standing ambiguity without looking too ugly.

Best regards

David Harper

Wellcome Sanger Institute, Cambridge, England

--
The Wellcome Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.

#11Bruce Momjian
bruce@momjian.us
In reply to: David Harper (#10)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

On Thu, Jul 11, 2019 at 09:34:58AM +0100, David Harper wrote:

One really simple way to make it shorter is to say "00:00", leaving
out the seconds.

That’s a good solution. It removes the long-standing ambiguity without looking too ugly.

OK, how is this patch?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +

Attachments:

midnight.difftext/x-diff; charset=us-asciiDownload+3-3
#12Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#11)
Re: Ambiguous language in Table 8.13. Special Date/Time Inputs [EXT]

On Thu, Jul 11, 2019 at 10:42:35AM -0400, Bruce Momjian wrote:

On Thu, Jul 11, 2019 at 09:34:58AM +0100, David Harper wrote:

One really simple way to make it shorter is to say "00:00", leaving
out the seconds.

That’s a good solution. It removes the long-standing ambiguity without looking too ugly.

OK, how is this patch?

Doc patch applied to all current branches. Thanks for the report.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +