Class/Module Index [+]

Quicksearch

Sequel::Postgres

Top level module for holding all PostgreSQL-related modules and classes for Sequel. There are a few module level accessors that are added via metaprogramming. These are:

Changes in these settings only affect future connections. To make sure that they are applied, they should generally be called right after the Database object is instantiated and before a connection is actually made. For example, to use whatever the server defaults are:

DB = Sequel.postgres(...)
Sequel::Postgres.client_min_messages = nil
Sequel::Postgres.force_standard_strings = false
Sequel::Postgres.use_iso_date_format = false
# A connection to the server is not made until here
DB[:t].all

The reason they can't be done earlier is that the Sequel::Postgres module is not loaded until a Database object which uses PostgreSQL is created.

Constants

CAST_JSON
CONVERTED_EXCEPTIONS

Array of exceptions that need to be converted. JDBC uses NativeExceptions, the native adapter uses PGError.

DASH_STR
MINUS_INFINITY
MINUS_INFINITY_STR
NAN
NAN_STR
PG_NAMED_TYPES

Hash with type name strings/symbols and callable values for converting PostgreSQL types. Non-builtin types that don't have fixed numbers should use this to register conversion procs.

PG_TYPES

Hash with integer keys and callable values for converting PostgreSQL types.

PLUS_INFINITY
PLUS_INFINITY_STR
STRING_TYPES

Type OIDs for string types used by PostgreSQL. These types don't have conversion procs associated with them (since the data is already in the form of a string).

TRUE_STR
TYPE_TRANSLATOR

Attributes

client_min_messages[RW]

By default, Sequel sets the minimum level of log messages sent to the client to WARNING, where PostgreSQL uses a default of NOTICE. This is to avoid a lot of mostly useless messages when running migrations, such as a couple of lines for every serial primary key field.

force_standard_strings[RW]

By default, Sequel forces the use of standard strings, so that '\' is interpreted as \ and not . While PostgreSQL <9.1 defaults to interpreting plain strings, newer versions use standard strings by default. Sequel assumes that SQL standard strings will be used. Setting this to false means Sequel will use the database's default.

use_iso_date_format[R]

As an optimization, Sequel sets the date style to ISO, so that PostgreSQL provides the date in a known format that Sequel can parse faster. This can be turned off if you require a date style other than ISO.

Public Class Methods

use_iso_date_format=(v) click to toggle source

Modify the type translator for the date type depending on the value given.

# File lib/sequel/adapters/utils/pg_types.rb, line 75
def self.use_iso_date_format=(v)
  PG_TYPES[1082] = v ? TYPE_TRANSLATOR.method(:date) : Sequel.method(:string_to_date)
  @use_iso_date_format = v
end

Public Instance Methods

bytea(s) click to toggle source
# File lib/sequel/adapters/postgres.rb, line 92
def bytea(s) ::Sequel::SQL::Blob.new(Adapter.unescape_bytea(s)) end

[Validate]

Generated with the Darkfish Rdoc Generator 2.