Re: BUG #16939: Plural interval for negative singular

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, neverov(dot)max(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16939: Plural interval for negative singular
Date: 2021-05-01 14:55:41
Message-ID: 20210501145541.GC23068@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Apr 29, 2021 at 09:00:04PM -0400, Bruce Momjian wrote:
> OK, first, I never realized that saying -1 plural was valid. Second,
> the two places you showed are actually using abs() properly since
> negative values are shown with an "ago" suffix, not a negative sign:
>
> SET intervalstyle = postgres_verbose;
>
> SELECT '2020-01-01 01:03:00'::timestamptz - '2020-01-01 02:02:01'::timestamptz;
> ?column?
> ---------------------
> @ 59 mins 1 sec ago
> (1 row)
>
> Attached is a patch which reverts 9ee7d533da and 5da9868ed9, and adds a
> comment about the "ago" usage. The good news is that we were already
> consistent in using plural -1. :-)

Here is a clearer example:

SET intervalstyle = postgres_verbose;

SELECT '2020-01-01 00:00:01'::timestamptz - '2020-01-01 00:00:00'::timestamptz;
?column?
----------
@ 1 sec

SELECT '2020-01-01 00:00:00'::timestamptz - '2020-01-01 00:00:01'::timestamptz;
?column?
-------------
@ 1 sec ago

Patch applied. Thanks for the research.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Brar Piening 2021-05-01 22:22:44 Re: BUG #16988: Spurious "SET LOCAL can only be used in transaction blocks" warning using implicit transaction block
Previous Message Andrey Borodin 2021-05-01 12:42:25 Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data