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-04-30 01:00:04
Message-ID: 20210430010004.GA23068@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Apr 27, 2021 at 10:44:15PM -0700, Noah Misch wrote:
> On Tue, Apr 27, 2021 at 04:10:19PM -0400, Bruce Momjian wrote:
> > Yes, I found the same like you did. Are you saying we should remove the
> > abs() calls here so we are consistent?
>
> No, I advise just reverting 5da9868. The output funcs should keep doing what
> they did in v13, inconsistency and all.
>
> I was asking the above question to see which of singular or plural was more
> common before $SUBJECT's commit. I count two examples of singular and seven
> examples of plural (one in EVALUATE_MESSAGE_PLURAL(), six modified in commit
> 5da9868). Given that, ...
>
> On Mon, Apr 26, 2021 at 01:06:16PM -0400, Bruce Momjian wrote:
> > Well, we should then add a comment that this is inconsistent but should
> > not be changed.
>
> ... adding comments to the two places that use abs() to achieve singular "-1"
> sounds fine.

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. :-)

--
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.

Attachment Content-Type Size
negative.diff text/x-diff 5.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message chenyanfei 2021-04-30 02:04:05 syslogger file descriptor question
Previous Message Alvaro Herrera 2021-04-29 23:02:28 Re: ALTER CONSTRAINT on a partitioned FK isn't working