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

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: work.michael.2956@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2024-02-17T01:47:58Z
Lists: pgsql-bugs, pgsql-hackers
in `9.9.1. EXTRACT, date_part`
EXTRACT(field FROM source)

I saw more inconsistencies with the doc when `source` is an interval.

the `minute` field
select extract(minute from interval '2011 year 16 month 35 day 48 hour
1005 min 71 sec 11 ms');
select extract(minute from interval '2011 year 16 month 35 day 48 hour
1005 min 2 sec 11 ms');
select extract(minute from interval '2011 year 16 month 35 day 48 hour
1005 min 2 sec 11 ms');

the `hour` field:
select extract(hour from interval '2011 year 16 month 35 day 48 hour
1005 min 71 sec 11 ms');
select extract(hour from interval '2011 year 16 month 35 day 48 hour
1005 min 2 sec 11 ms');
select extract(hour from interval '2011 year 16 month 35 day 48 hour
1005 min 71 sec 11111111111 ms');

the `quarter` field:
select extract(quarter from interval '2011 year 12 month 48 hour 1005
min 2 sec 11 ms');
SELECT EXTRACT(QUARTER FROM TIMESTAMP '2001-12-16 20:38:40');



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix extraction of week and quarter fields from intervals.

  2. Doc: improve explanation of type interval, especially extract().