Support INTERVAL column type

Final Release Note

Description

#845 tracks the implementation of a basic INTERVAL support. This issue tracks a more complete INTERVAL type support in Octo. We expect interval data type and operations and functions which make use of it to be implemented with this issue.

(Following is copied from #845 (comment 1672186007))

What INTERVAL data type means is having the ability to have columns of INTERVAL type and usage of INTERVAL type literal and columns at all facilities of SQL.

Example

names=> select interval '1' year;
 interval 
----------
 1 year
(1 row)

names=> create table test (admin_time INTERVAL YEAR TO MONTH);
CREATE TABLE

names=> insert into test values(interval '1-2' YEAR TO MONTH);
INSERT 0 1
names=> select * from test;
  admin_time   
---------------
 1 year 2 mons
(1 row)

This issue tracks the implementation of such a type.

Also, #845 (comment 1458109890) has a list of interval operations that will be possible with this type implementation. Ones that are not implemented by !1496 and !1518 in that list is mentioned below

  • avg ( interval ) → interval
  • sum ( interval ) → interval
  • interval + interval → interval
  • - interval → interval
  • time - time → interval
  • interval - interval → interval
  • timestamp - timestamp → interval
  • interval * double precision → interval
  • interval / double precision → interval
  • age ( timestamp, timestamp ) → interval
  • age ( timestamp ) → interval
  • date_bin ( interval, timestamp, timestamp ) → timestamp
  • date_part ( text, interval ) → double precision
  • date_trunc ( text, interval ) → interval
  • isfinite ( interval ) → boolean
  • justify_days ( interval ) → interval
  • justify_hours ( interval ) → interval
  • justify_interval ( interval ) → interval
  • make_interval ( [ years int [, months int [, weeks int [, days int [, hours int [, mins int [, secs double precision ]]]]]]] ) → interval
  • varchar :: interval

Features mentioned above needs to be reviewed and those found to be most useful needs to be implemented.

Draft Release Note

Edited by Ganesh Mahesh