Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcr2B-0002lH-9U for pgsql-bugs@arkaria.postgresql.org; Sat, 01 May 2021 14:55:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lcr28-0001UT-LT for pgsql-bugs@arkaria.postgresql.org; Sat, 01 May 2021 14:55:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcr28-0001UM-FG for pgsql-bugs@lists.postgresql.org; Sat, 01 May 2021 14:55:52 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcr21-0006NU-Oh for pgsql-bugs@lists.postgresql.org; Sat, 01 May 2021 14:55:51 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lcr1x-0007Hn-5n; Sat, 01 May 2021 10:55:41 -0400 Date: Sat, 1 May 2021 10:55:41 -0400 From: Bruce Momjian To: Noah Misch Cc: Tom Lane , neverov.max@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16939: Plural interval for negative singular Message-ID: <20210501145541.GC23068@momjian.us> References: <20210425115726.GA2353095@rfd.leadboat.com> <20210426163116.GR7629@momjian.us> <2266336.1619455534@sss.pgh.pa.us> <20210426165435.GT7629@momjian.us> <2267469.1619456564@sss.pgh.pa.us> <20210426170616.GV7629@momjian.us> <20210427061329.GB2435607@rfd.leadboat.com> <20210427201019.GY7629@momjian.us> <20210428054415.GA2493304@rfd.leadboat.com> <20210430010004.GA23068@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210430010004.GA23068@momjian.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 https://momjian.us EDB https://enterprisedb.com If only the physical world exists, free will is an illusion.