pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Noah Misch <noah@leadboat.com>
Cc: neverov.max@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16939: Plural interval for negative singular
Date: Mon, 26 Apr 2021 12:31:16 -0400
Message-ID: <20210426163116.GR7629@momjian.us> (raw)
In-Reply-To: <20210425115726.GA2353095@rfd.leadboat.com>
References: <16939-cceeb03fb72736ee@postgresql.org>
	<20210323160336.GE579@momjian.us>
	<20210425115726.GA2353095@rfd.leadboat.com>

On Sun, Apr 25, 2021 at 04:57:26AM -0700, Noah Misch wrote:
> On Tue, Mar 23, 2021 at 12:03:36PM -0400, Bruce Momjian wrote:
> > On Tue, Mar 23, 2021 at 05:21:30AM +0000, PG Bug reporting form wrote:
> > > postgres=# set intervalstyle='postgres';
> > > SET
> > > postgres=#  select interval '-1 year -1 day';
> > >      interval
> > > ------------------
> > >  -1 years -1 days
> > > (1 row)
> > > 
> > > Expected output:
> > > -1 year -1 day
> > > 
> > > The code
> > > (https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/datetime.c#L4193)
> > > pluralizes a time unit if the value is not 1, should check both -1 and 1.
> 
> >From the first several links at
> https://www.google.com/search?q=negative+one+singular+plural the choice is a
> matter of dispute among English grammar commentators.  Singular "-1" is
> popular, and plural "-1" is also popular.
> 
> > Wow, interesting.  Seems there were a few places in the code that
> > handled this properly, and several that didn't.  The attached patch
> > fixes these and updates the regression tests.  I will apply this for PG
> > 14 in the next few days.  This is too likely to break something to
> > backpatch.  Thanks for the report.
> 
> Let's not change from one popular spelling to another when doing so creates a
> compatibility hazard.  That is to say, I think PostgreSQL would be better with
> this patch reverted.
> 
> If we did want to standardize on singular for -1, EVALUATE_MESSAGE_PLURAL()
> would be a key bit of code to change.

Oh, good point.  I think we should just pick one and be consistent --- I
don't care which we choose.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

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






view thread (20+ messages)  latest in thread

Message-ID: <20210426163116.GR7629@momjian.us>
Permalink:  ../20210426163116.GR7629@momjian.us/
Also on:    postgresql.org/message-id/20210426163116.GR7629@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: bruce@momjian.us, noah@leadboat.com, neverov.max@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16939: Plural interval for negative singular
  In-Reply-To: <20210426163116.GR7629@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox