class PostgreSQLAdapter
Ruby on Rails 8.0.4
Since v2.2.3Active Record PostgreSQL Adapter
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 username. -
: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_orderoption. -
:encoding- An optional client encoding that is used in aSET client_encoding TO <encoding>call on the connection. -
:min_messages- An optional client min messages that is used in aSET client_min_messages TO <min_messages>call on the connection. -
:variables- An optional hash of additional parameters that will be used inSET SESSION key = valcalls on the connection. -
:insert_returning- An optional boolean to control the use ofRETURNINGforINSERTstatements 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 .
Inherits from
Includes
Constants
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::ADAPTER_NAME
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::DEADLOCK_DETECTED
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::DUPLICATE_DATABASE
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::FEATURE_NOT_SUPPORTED
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::FOREIGN_KEY_VIOLATION
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::LOCK_NOT_AVAILABLE
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NOT_NULL_VIOLATION
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NUMERIC_VALUE_OUT_OF_RANGE
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::QUERY_CANCELED
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::SERIALIZATION_FAILURE
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::UNIQUE_VIOLATION
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::VALUE_LIMIT_VIOLATION
Attributes
Methods (defined here)
- # active?
- # add_enum_value
- # connected?
- # create_enum
- # disable_extension
- # disconnect!
- # drop_enum
- # enable_extension
- # enum_types
- # extension_available?
- # extension_enabled?
- # extensions
- # index_algorithms
- # max_identifier_length
- # rename_enum
- # rename_enum_value
- # reset!
- # session_auth=
- # set_standard_conforming_strings
- # supports_advisory_locks?
- # supports_bulk_alter?
- # supports_check_constraints?
- # supports_comments?
- # supports_common_table_expressions?
- # supports_datetime_with_precision?
- # supports_ddl_transactions?
- # supports_deferrable_constraints?
- # supports_exclusion_constraints?
- # supports_explain?
- # supports_expression_index?
- # supports_extensions?
- # supports_foreign_keys?
- # supports_foreign_tables?
- # supports_index_include?
- # supports_index_sort_order?
- # supports_insert_conflict_target?
- # supports_insert_on_conflict?
- # supports_insert_on_duplicate_skip?
- # supports_insert_on_duplicate_update?
- # supports_insert_returning?
- # supports_json?
- # supports_lazy_transactions?
- # supports_materialized_views?
- # supports_nulls_not_distinct?
- # supports_optimizer_hints?
- # supports_partial_index?
- # supports_partitioned_indexes?
- # supports_pgcrypto_uuid?
- # supports_restart_db_transaction?
- # supports_savepoints?
- # supports_transaction_isolation?
- # supports_unique_constraints?
- # supports_validate_constraints?
- # supports_views?
- # supports_virtual_columns?
- # use_insert_returning?
- self. create_unlogged_tables
- self. datetime_type
- self. dbconsole
- self. decode_dates
- self. new
- self. new_client
Private methods
(25)
Implementation detail — not part of the public API.
- # add_pg_decoders
- # add_pg_encoders
- # arel_visitor
- # build_statement_pool
- # can_perform_case_insensitive_comparison_for?
- # column_definitions
- # configure_connection
- # connect
- # construct_coder
- # extract_default_function
- # extract_value_from_default
- # get_oid_type
- # has_default_function?
- # initialize_type_map
- # in_transaction?
- # is_cached_plan_failure?
- # load_additional_types
- # load_types_queries
- # prepare_statement
- # reconfigure_connection_timezone
- # reconnect
- # retryable_query_error?
- # sql_key
- # translate_exception
- # update_typemap_for_default_timezone
Methods (inherited)
From ActiveRecord::ConnectionAdapters::AbstractAdapter (82)
- # active?
- # adapter_name
- # check_all_foreign_keys_valid!
- # clear_cache!
- # close
- # connect!
- # connected?
- # connection_retries
- # database_exists?
- # default_timezone
- # disable_extension
- # disable_referential_integrity
- # discard!
- # disconnect!
- # enable_extension
- # expire
- # extensions
- # index_algorithms
- # lease
- # pool=
- # prefetch_primary_key?
- # prepared_statements
- # prepared_statements?
- # preventing_writes?
- # raw_connection
- # reconnect!
- # replica?
- # requires_reloading?
- # reset!
- # retry_deadline
- # role
- # savepoint_errors_invalidate_transactions?
- # schema_cache
- # schema_version
- # shard
- # supports_advisory_locks?
- # supports_bulk_alter?
- # supports_check_constraints?
- # supports_comments?
- # supports_comments_in_create?
- # supports_common_table_expressions?
- # supports_concurrent_connections?
- # supports_datetime_with_precision?
- # supports_ddl_transactions?
- # supports_deferrable_constraints?
- # supports_exclusion_constraints?
- # supports_explain?
- # supports_expression_index?
- # supports_extensions?
- # supports_foreign_keys?
- # supports_foreign_tables?
- # supports_index_include?
- # supports_index_sort_order?
- # supports_indexes_in_create?
- # supports_insert_conflict_target?
- # supports_insert_on_duplicate_skip?
- # supports_insert_on_duplicate_update?
- # supports_insert_returning?
- # supports_json?
- # supports_lazy_transactions?
- # supports_materialized_views?
- # supports_nulls_not_distinct?
- # supports_optimizer_hints?
- # supports_partial_index?
- # supports_partitioned_indexes?
- # supports_restart_db_transaction?
- # supports_savepoints?
- # supports_transaction_isolation?
- # supports_unique_constraints?
- # supports_validate_constraints?
- # supports_views?
- # supports_virtual_columns?
- # throw_away!
- # unprepared_statement
- # verify!
- # verify_timeout
- self. database_exists?
- self. dbconsole
- self. find_cmd_and_exec
- self. type_cast_config_to_boolean
- self. type_cast_config_to_integer
- self. validate_default_timezone
From ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements (31)
- # add_exclusion_constraint
- # add_foreign_key
- # add_unique_constraint
- # client_min_messages
- # client_min_messages=
- # collation
- # create_database
- # create_schema
- # ctype
- # current_database
- # current_schema
- # drop_schema
- # encoding
- # exclusion_constraints
- # foreign_keys
- # foreign_table_exists?
- # foreign_tables
- # index_name_exists?
- # remove_exclusion_constraint
- # remove_unique_constraint
- # rename_index
- # rename_table
- # schema_exists?
- # schema_names
- # schema_search_path
- # schema_search_path=
- # serial_sequence
- # unique_constraints
- # validate_check_constraint
- # validate_constraint
- # validate_foreign_key
From ActiveRecord::ConnectionAdapters::QueryCache (9)
- # cache
- # clear_query_cache
- # disable_query_cache!
- # enable_query_cache!
- # query_cache
- # query_cache_enabled
- # uncached
- self. dirties_query_cache
- self. new
From ActiveSupport::Callbacks (1)
From ActiveSupport::Concern (3)
- # class_methods
- # included
- # prepended
From Object (17)
- # acts_like?
- # blank?
- # deep_dup
- # duplicable?
- # html_safe?
- # in?
- # instance_values
- # instance_variable_names
- # presence
- # presence_in
- # present?
- # to_param
- # to_query
- # try
- # try!
- # with
- # with_options
From ActiveSupport::DescendantsTracker (3)
- # descendants
- self. descendants
- self. subclasses
From ActiveSupport::NumericWithFormat (2)
- # to_formatted_s
- # to_fs