Обсуждение: Ambiguous language in Table 8.13. Special Date/Time Inputs
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
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 +
> 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 recommmendsthe 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/timeis referred to as "at midnight on Friday, October 20th" the intention could be either midnight the beginning ofthe 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, usingthe designation of 0000 to refer to midnight at the beginning of a given day (or date) and 2400 to designate the endof 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.
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 recommmendsthe 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/timeis referred to as "at midnight on Friday, October 20th" the intention could be either midnight the beginning ofthe 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, usingthe designation of 0000 to refer to midnight at the beginning of a given day (or date) and 2400 to designate the endof 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 +
Вложения
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], 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.
> 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 aquery 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.
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 runa 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
Вложения
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 runa 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 +
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
> 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.
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 +
Вложения
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 +