text is PostgreSQL’s recommended type for storage of text data, and is more similar to Ruby’s String type as it allows for unlimited length. With regard to common database types, please note that the generic String type is text on PostgreSQL and not varchar(255) as it is on some other databases. These extensions aren’t Database specific, they are global extensions, so you should load them via Sequel.extension, after loading support for the specific types into the Database instance: DB. Range-related functions and operators pg_row_ops Json-related functions and operators pg_range_ops Hstore-related functions and operators pg_json_ops These extensions are: pg_array_opsĪrray-related functions and operators pg_hstore_ops There are also type-specific extensions that make it easy to use database functions and operators related to the type. In general, these extensions just add support for Database objects to return retrieved column values as the appropriate type and support for literalizing the objects correctly for use in an SQL string, or using them as bound variable values ( postgres/pg and jdbc/postgres only). Row-valued/composite types, as a ruby Hash-like or Sequel::Model object Ranges (for any scalar type), as a ruby Range-like object pg_row Json, as either ruby Array-like or Hash-like objects pg_range Interval, as ActiveSupport::Duration objects pg_json Inet/cidr, as ruby IPAddr objects pg_interval Hstore, as a ruby Hash-like object pg_inet The following PostgreSQL-specific type extensions are available: pg_arrayĪrrays (single and multidimensional, for any scalar type), as a ruby Array-like object pg_hstore For example, to load support for arrays, you would do: DB. In general, you load these extensions via Database#extension. However, Sequel ships with support for many PostgreSQL-specific types via extensions. Sequel’s default support on PostgreSQL only includes common database types. PostgreSQL-specific Database Type Support ¶ ↑ not available when using the postgres-pr driver). postgres/pg only will denote support specific to the postgres adapter when pg is used as the underlying driver (i.e. not available when connecting to PostgreSQL via the jdbc adapter). Postgres only will denote support specific to the postgres adapter (i.e. Some of this this support depends on the specific adapter or underlying driver in use. There are additional rarely used PostgreSQL features that Sequel supports which are not mentioned here. Note that while this guide is extensive, it is not exhaustive. This support is roughly broken into the following areas: However, Sequel’s database adapters extend the core support to include support for database-specific features.īy far the most extensive database-specific support in Sequel is for PostgreSQL. Sequel’s core database and dataset functions are designed to support the features shared by most common SQL database implementations. PostgreSQL-specific Support in Sequel ¶ ↑
0 Comments
Leave a Reply. |