Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Francisco Olarte <folarte(at)peoplecall(dot)com>, Michael Bondarenko <work(dot)michael(dot)2956(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, dgrowleyml(at)gmail(dot)com, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
Date: 2024-05-08 14:10:48
Message-ID: 476283.1715177448@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

jian he <jian(dot)universality(at)gmail(dot)com> writes:
> but in real life, for week, we generally begin with 1?
> like "the first week", "second week"
> so should
> select extract(week from interval '1 day');
> return 1
> ?

Hmm, I read it as being "the number of (whole) weeks in the
interval". Starting with week 1 is what happens in the timestamp
case, true, but I don't find that appropriate for interval.
By analogy,

regression=# select extract(day from interval '23 hours');
extract
---------
0
(1 row)

There's no such thing as "day 0" in the timestamp case,
but that doesn't make this wrong.

In any case, I'm starting to wonder why this issue is on the v17
open items list. These are hardly new bugs in 17. If there's
still differences of opinion about what the definition should be,
I think cramming in a change post-feature-freeze is not appropriate.
Let's just queue the issue for the next commitfest (already done
at [1]) and take it off the open items list.

regards, tom lane

[1] https://commitfest.postgresql.org/48/4979/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sandeep Thakkar 2024-05-08 15:34:05 Re: Re: edb installation failed for pgadmin when username is Chinese under c;\user #7432
Previous Message Tom Lane 2024-05-08 13:55:50 Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2024-05-08 14:34:20 Re: CREATE DATABASE with filesystem cloning
Previous Message Robert Haas 2024-05-08 14:07:15 Re: bug: copy progress reporting of backends which run multiple COPYs