class

ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

v6.1.7.7 - Show latest stable - Superclass: AbstractAdapter

The PostgreSQL adapter works with the native C (github.com/ged/ruby-pg) driver.

Options:

  • :host - Defaults to a Unix-domain socket in /tmp. On machines without Unix-domain sockets, the default is to connect to localhost.

  • :port - Defaults to 5432.

  • :username - Defaults to be the same as the operating system name of the user running the application.

  • :password - Password to be used if the server demands password authentication.

  • :database - Defaults to be the same as the user name.

  • :schema_search_path - An optional schema search path for the connection given as a string of comma-separated schema names. This is backward-compatible with the :schema_order option.

  • :encoding - An optional client encoding that is used in a SET client_encoding TO <encoding> call on the connection.

  • :min_messages - An optional client min messages that is used in a SET client_min_messages TO <min_messages> call on the connection.

  • :variables - An optional hash of additional parameters that will be used in SET SESSION key = val calls on the connection.

  • :insert_returning - An optional boolean to control the use of RETURNING for INSERT statements defaults to true.

Any further options are used as connection parameters to libpq. See www.postgresql.org/docs/current/static/libpq-connect.html for the list of parameters.

In addition, default connection parameters of libpq can be set per environment variables. See www.postgresql.org/docs/current/static/libpq-envars.html .

Included modules

  • ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements
  • ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting
  • ActiveRecord::ConnectionAdapters::PostgreSQL::ReferentialIntegrity
  • ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements

Constants

ADAPTER_NAME = "PostgreSQL"

DEADLOCK_DETECTED = "40P01"

DUPLICATE_DATABASE = "42P04"

FEATURE_NOT_SUPPORTED = "0A000"

FOREIGN_KEY_VIOLATION = "23503"

LOCK_NOT_AVAILABLE = "55P03"

NATIVE_DATABASE_TYPES = {\nprimary_key: "bigserial primary key",\nstring: { name: "character varying" },\ntext: { name: "text" },\ninteger: { name: "integer", limit: 4 },\nfloat: { name: "float" },\ndecimal: { name: "decimal" },\ndatetime: { name: "timestamp" },\ntime: { name: "time" },\ndate: { name: "date" },\ndaterange: { name: "daterange" },\nnumrange: { name: "numrange" },\ntsrange: { name: "tsrange" },\ntstzrange: { name: "tstzrange" },\nint4range: { name: "int4range" },\nint8range: { name: "int8range" },\nbinary: { name: "bytea" },\nboolean: { name: "boolean" },\nxml: { name: "xml" },\ntsvector: { name: "tsvector" },\nhstore: { name: "hstore" },\ninet: { name: "inet" },\ncidr: { name: "cidr" },\nmacaddr: { name: "macaddr" },\nuuid: { name: "uuid" },\njson: { name: "json" },\njsonb: { name: "jsonb" },\nltree: { name: "ltree" },\ncitext: { name: "citext" },\npoint: { name: "point" },\nline: { name: "line" },\nlseg: { name: "lseg" },\nbox: { name: "box" },\npath: { name: "path" },\npolygon: { name: "polygon" },\ncircle: { name: "circle" },\nbit: { name: "bit" },\nbit_varying: { name: "bit varying" },\nmoney: { name: "money" },\ninterval: { name: "interval" },\noid: { name: "oid" },\n}

NOT_NULL_VIOLATION = "23502"

NUMERIC_VALUE_OUT_OF_RANGE = "22003"

OID = PostgreSQL::OID #:nodoc:

QUERY_CANCELED = "57014"

SERIALIZATION_FAILURE = "40001"

UNIQUE_VIOLATION = "23505"

VALUE_LIMIT_VIOLATION = "22001"

Files

  • activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb