The pg_interval extension adds support for PostgreSQL's interval type.
This extension integrates with Sequel's native postgres and jdbc/postgresql adapters, 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:
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.
See the schema modification guide for details on using interval columns in CREATE/ALTER TABLE statements.
Related module: Sequel::Postgres::IntervalDatabaseMethods