The pg_interval extension adds support for PostgreSQL's interval type.
This extension integrates with Sequel's native postgres adapter, so that when interval type values are retrieved, they are parsed and returned as instances of ActiveSupport::Duration.
In addition to the parser, this extension adds literalizers for ActiveSupport::Duration that use the standard Sequel literalization callbacks, so they work on all adapters.
If you would like to use interval columns in your model objects, you probably want to modify the typecasting so that it recognizes and correctly handles the interval columns, which you can do by:
DB.extension :pg_interval
If you are not using the native postgres adapter, you probably also want to use the pg_typecast_on_load plugin in the model, and set it to typecast the interval type column(s) on load.
This extension integrates with the pg_array extension. If you plan to use arrays of interval types, load the pg_array extension before the pg_interval extension:
DB.extension :pg_array, :pg_interval
The parser this extension uses requires that IntervalStyle for PostgreSQL is set to postgres (the default setting). If IntervalStyle is changed from the default setting, the parser will probably not work. The parser used is very simple, and is only designed to parse PostgreSQL's default output format, it is not designed to support all input formats that PostgreSQL supports.