BUG #16939: Plural interval for negative singular

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: neverov(dot)max(at)gmail(dot)com
Subject: BUG #16939: Plural interval for negative singular
Date: 2021-03-23 05:21:30
Message-ID: 16939-cceeb03fb72736ee@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16939
Logged by: Max Neverov
Email address: neverov(dot)max(at)gmail(dot)com
PostgreSQL version: 13.2
Operating system: alpine
Description:

Execute the query:
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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ярослав Пашинский 2021-03-23 09:49:32 Re: BUG #16927: Postgres can`t access WAL files
Previous Message Tom Lane 2021-03-23 01:49:44 Re: BUG #16936: psql: \c service= not working