Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL); - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
Date
Msg-id 476283.1715177448@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);  (jian he <jian.universality@gmail.com>)
Responses Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
List pgsql-bugs
jian he <jian.universality@gmail.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/



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18348: Inconsistency with EXTRACT([field] from INTERVAL);
Next
From: Sandeep Thakkar
Date:
Subject: Re: Re: edb installation failed for pgadmin when username is Chinese under c;\user #7432