# Reference

## `postgresql`

py-postgresql is a Python package for using PostgreSQL. This includes low-level protocol tools, a driver(PG-API and DB-API 2.0), and cluster management tools.

See <http://postgresql.org> for more information about PostgreSQL and <http://python.org> for information about Python.

postgresql.version = '1.2.1'

  The version string of py-postgresql.

postgresql.version_info = (1, 2, 1)

  The version triple of py-postgresql: (major, minor, patch).

postgresql.open(iri=None, prompt_title=None, **kw)

  Create a postgresql.api.Connection to the server referenced by the given iri:

      >>> import postgresql
      # General Format:
      >>> db = postgresql.open('pq://user:password@host:port/database')

      # Connect to 'postgres' at localhost.
      >>> db = postgresql.open('localhost/postgres')

  Connection keywords can also be used with open. See the narratives for more information.

  The prompt_title keyword is ignored. open will never prompt for the password unless it is explicitly instructed to do so.

  (Note: “pq” is the name of the protocol used to communicate with PostgreSQL)

## `postgresql.api`

Application Programmer Interfaces for PostgreSQL.

`postgresql.api` is a collection of Python APIs for the PostgreSQL DBMS. It is designed to take full advantage of PostgreSQL’s features to provide the Python programmer with substantial convenience.

This module is used to define “PG-API”. It creates a set of ABCs that makes up the basic interfaces used to work with a PostgreSQL server.

class postgresql.api.Category

  Bases: `Element`

  A category is an object that initializes the subject connection for a specific purpose.

  Arguably, a runtime class for use with connections.

class postgresql.api.Chunks

  Bases: `Result`

class postgresql.api.Cluster

  Bases: `Element`

  Interface to a PostgreSQL cluster–a data directory. An implementation of this provides a means to control a server.

  abstract property data_directory: str

    The path to the data directory of the cluster.

  abstract drop()

    Kill the server and completely remove the data directory.

  abstract init(initdb=None, user=None, password=None, encoding=None, locale=None, collate=None, ctype=None, monetary=None, numeric=None, time=None, text_search_config=None, xlogdir=None)

    Create the cluster at the data_directory associated with the Cluster instance.

  abstract property installation: Installation

    The installation used by the cluster.

  abstract kill()

    Kill the server.

  abstract restart()

    Restart the cluster.

  abstract property settings

    A Settings interface to the `postgresql.conf` file associated with the cluster.

  abstract start()

    Start the cluster.

  abstract stop()

    Signal the server to shutdown.

  abstract wait_until_started(timeout=10)

    After the start() method is ran, the database may not be ready for use. This method provides a mechanism to block until the cluster is ready for use.

    If the timeout is reached, the method must throw a postgresql.exceptions.ClusterTimeoutError.

  abstract wait_until_stopped(timeout=10)

    After the stop() method is ran, the database may still be running. This method provides a mechanism to block until the cluster is completely shutdown.

    If the timeout is reached, the method must throw a postgresql.exceptions.ClusterTimeoutError.

class postgresql.api.Connection

  Bases: `Database`

  The interface to a connection to a PostgreSQL database. This is a Database interface with the additional connection management tools that are particular to using a remote database.

  abstract clone() → Connection

    Create another connection using the same factors as self. The returned object should be open and ready for use.

  abstract close() → None

    Close the connection.

    Does nothing if the connection is already closed.

  abstract property closed: bool

    True if the Connection is closed, False if the Connection is open.

        >>> db.closed
        True

  abstract connect() → None

    Establish the connection to the server and initialize the category.

    Does nothing if the connection is already established.

  abstract property connector: Connector

    The `Connector` instance facilitating the Connection object’s communication and initialization.

class postgresql.api.Connector(user: str = None, password: str = None, database: str = None, settings: (<class 'dict'>, [(<class 'str'>, <class 'str'>)]) = None, category: ~postgresql.api.Category = None)

  Bases: `Element`

  A connector is an object providing the necessary information to establish a connection. This includes credentials, database settings, and many times addressing information.

class postgresql.api.Cursor

  Bases: `Result`

  A Cursor object is an interface to a sequence of tuples(rows). A result set. Cursors publish a file-like interface for reading tuples from a cursor declared on the database.

  Cursor objects are created by invoking the Statement.declare method or by opening a cursor using an identifier via the Database.cursor_from_id method.

  abstract clone() → Cursor

    Create a new cursor using the same factors as self.

  abstract property direction: bool

    The default direction argument for read().

    When True reads are FORWARD. When False reads are BACKWARD.

    Cursor operation option.

  abstract read(quantity=None, direction=None) → ['Row']

    Read, fetch, the specified number of rows and return them in a list. If quantity is None, all records will be fetched.

    direction can be used to override the default configured direction.

    This alters the cursor’s position.

    Read does not directly correlate to FETCH. If zero is given as the quantity, an empty sequence must be returned.

  abstract seek(offset, whence='ABSOLUTE')

    Set the cursor’s position to the given offset with respect to the whence parameter and the configured direction.

    Whence values:

    > `0` or `"ABSOLUTE"`

    >   Absolute.

    > `1` or `"RELATIVE"`

    >   Relative.

    > `2` or `"FROM_END"`

    >   Absolute from end.

    > `3` or `"FORWARD"`

    >   Relative forward.

    > `4` or `"BACKWARD"`

    >   Relative backward.

    Direction effects whence. If direction is BACKWARD, ABSOLUTE positioning will effectively be FROM_END, RELATIVE’s position will be negated, and FROM_END will effectively be ABSOLUTE.

class postgresql.api.Database

  Bases: `Element`

  The interface to an individual database. Connection objects inherit from this

  abstract property backend_id: (<class 'int'>, None)

    The backend’s process identifier.

  abstract property client_address: (<class 'str'>, None)

    The client address that the server sees. This is obtainable by querying the `pg_catalog.pg_stat_activity` relation.

    None if unavailable.

  abstract property client_port: (<class 'int'>, None)

    The client port that the server sees. This is obtainable by querying the `pg_catalog.pg_stat_activity` relation.

    None if unavailable.

  abstract cursor_from_id(cursor_id) → Cursor

    Create a Cursor object from the given cursor_id that was already declared on the server.

    Cursor objects created this way must not be closed when the object is garbage collected. Rather, the user must explicitly close it for the server resources to be released. This is in contrast to Cursor objects that are created by invoking a Statement or a SRF StoredProcedure.

  abstract do(source) → None

    Execute a DO statement using the given language and source. Always returns None.

    Likely to be a function of Connection.execute.

  abstract execute() → None

    Execute an arbitrary block of SQL. Always returns None and raise an exception on error.

  abstract iternotifies(timeout=None) → Iterator

    Return an iterator to the notifications received by the connection. The iterator must produce triples in the form `(channel, payload, pid)`.

    If timeout is not None, None must be emitted at the specified timeout interval. If the timeout is zero, all the pending notifications must be yielded by the iterator and then StopIteration must be raised.

    If the connection is closed for any reason, the iterator must silently stop by raising StopIteration. Further error control is then the responsibility of the user.

  abstract listen(*channels) → None

    Start listening to the given channels.

    Equivalent to issuing “LISTEN <x>” for x in channels.

  abstract listening_channels() → ['channel name', Ellipsis]

    Return an iterator to all the channels currently being listened to.

  abstract notify(*channels, **channel_and_payload) → int

    NOTIFY the channels with the given payload.

    Equivalent to issuing “NOTIFY <channel>” or “NOTIFY <channel>, <payload>” for each item in channels and channel_and_payload. All NOTIFYs issued must occur in the same transaction.

    The items in channels can either be a string or a tuple. If a string, no payload is given, but if an item is a builtins.tuple, the second item will be given as the payload. channels offers a means to issue NOTIFYs in guaranteed order.

    The items in channel_and_payload are all payloaded NOTIFYs where the keys are the channels and the values are the payloads. Order is undefined.

  abstract prepare(sql: str) → Statement

    Create a new Statement instance bound to the connection using the given SQL.

        >>> s = db.prepare("SELECT 1")
        >>> c = s()
        >>> c.next()
        (1,)

  abstract proc(procedure_id) → StoredProcedure

    Create a StoredProcedure instance using the given identifier.

    The proc_id given can be either an `Oid`, or a `regprocedure` that identifies the stored procedure to create the interface for.

        >>> p = db.proc('version()')
        >>> p()
        'PostgreSQL 8.3.0'
        >>> qstr = "select oid from pg_proc where proname = 'generate_series'"
        >>> db.prepare(qstr).first()
        1069
        >>> generate_series = db.proc(1069)
        >>> list(generate_series(1,5))
        [1, 2, 3, 4, 5]

  abstract query(sql: str, *args) → Execution

    Prepare and execute the statement, sql, with the given arguments. Equivalent to `db.prepare(sql)(*args)`.

  abstract reset() → None

    Reset the connection into it’s original state.

    Issues a `RESET ALL` to the database. If the database supports removing temporary tables created in the session, then remove them. Reapply initial configuration settings such as path.

    The purpose behind this method is to provide a soft-reconnect method that re-initializes the connection into its original state. One obvious use of this would be in a connection pool where the connection is being recycled.

  abstract property settings: Settings

    A Settings instance bound to the Database.

  abstract statement_from_id(statement_id) → Statement

    Create a Statement object that was already prepared on the server. The distinction between this and a regular query is that it must be explicitly closed if it is no longer desired, and it is instantiated using the statement identifier as opposed to the SQL statement itself.

  abstract unlisten(*channels) → None

    Stop listening to the given channels.

    Equivalent to issuing “UNLISTEN <x>” for x in channels.

  abstract property version_info: tuple

    A version tuple of the database software similar Python’s sys.version_info.

        >>> db.version_info
        (8, 1, 3, '', 0)

  abstract property xact: Transaction

    Create a Transaction object using the given keyword arguments as its configuration.

class postgresql.api.Driver

  Bases: `Element`

  The Driver element provides the Connector and other information pertaining to the implementation of the driver. Information about what the driver supports is available in instances.

  abstract connect()

    Create a connection using the given parameters for the Connector.

class postgresql.api.Installation

  Bases: `Element`

  Interface to a PostgreSQL installation. Instances would provide various information about an installation of PostgreSQL accessible by the Python

  abstract property ssl: bool

    Whether the installation supports SSL.

  abstract property type

    The “type” of PostgreSQL. Normally, the first component of the string returned by pg_config.

  abstract property version

    A version string consistent with what SELECT version() would output.

  abstract property version_info

    A tuple specifying the version in a form similar to Python’s sys.version_info. (8, 3, 3, ‘final’, 0)

    See postgresql.versionstring.

class postgresql.api.Message

  Bases: `Element`

  A message emitted by PostgreSQL. A message being a NOTICE, WARNING, INFO, etc.

  abstract property code: str

    The SQL state code of the message.

  abstract property details: dict

    The additional details given with the message. Common keys should be the following:

    > - ‘severity’

    > - ‘context’

    > - ‘detail’

    > - ‘hint’

    > - ‘file’

    > - ‘line’

    > - ‘function’

    > - ‘position’

    > - ‘internal_position’

    > - ‘internal_query’

  abstract isconsistent(other) → bool

    Whether the fields of the other Message object is consistent with the fields of self.

    This must return the result of the comparison of code, source, message, and details.

    This method is provided as the alternative to overriding equality; often, pointer equality is the desirable means for comparison, but equality of the fields is also necessary.

  abstract property message: str

    The primary message string.

  abstract property source: str

    Where the message originated from. Normally, ‘SERVER’, but sometimes ‘CLIENT’.

class postgresql.api.Settings

  Bases: `Element`

  A mapping interface to the session’s settings. This provides a direct interface to `SHOW` or `SET` commands. Identifiers and values need not be quoted specially as the implementation must do that work for the user.

  abstract get(key, default=None)

    Get the setting with the corresponding key. If the setting does not exist, return the default.

  abstract getset(keys)

    Return a dictionary containing the key-value pairs of the requested settings. If any of the keys do not exist, a KeyError must be raised with the set of keys that did not exist.

  abstract items()

    Return an iterator to all of the setting value pairs.

  abstract keys()

    Return an iterator to all of the settings’ keys.

  abstract update(mapping)

    For each key-value pair, incur the effect of the __setitem__ method.

  abstract values()

    Return an iterator to all of the settings’ values.

class postgresql.api.Statement

  Bases: `Element`

  Instances of Statement are returned by the prepare method of Database instances.

  A Statement is an Iterable as well as Callable.

  The Iterable interface is supported for queries that take no arguments at all. It allows the syntax:

      >>> for x in db.prepare('select * FROM table'):
      ...  pass

  abstract clone() → Statement

    Create a new statement object using the same factors as self.

    When used for refreshing plans, the new clone should replace references to the original.

  abstract close() → None

    Close the prepared statement releasing resources associated with it.

  abstract property column_names: [<class 'str'>]

    The attribute names of the columns produced by the statement.

    A sequence of str objects stating the column name:

        ['column1', 'column2', 'emp_name']

  abstract property column_types: [<class 'type'>]

    The Python types of the columns produced by the statement.

    A sequence of type objects:

        [<class 'int'>, <class 'str'>]

  abstract property parameter_types: [<class 'type'>]

    The Python types expected of parameters given to the statement.

    A sequence of type objects:

        [<class 'int'>, <class 'str'>]

  abstract property pg_column_types: [<class 'int'>]

    The type Oids of the columns produced by the statement.

    A sequence of int objects stating the SQL type name:

        [27, 28]

  abstract property pg_parameter_types: [<class 'int'>]

    The type Oids of the parameters required by the statement.

    A sequence of int objects stating the PostgreSQL type Oid:

        [27, 28]

  abstract property sql_column_types: [<class 'str'>]

    The type of the columns produced by the statement.

    A sequence of str objects stating the SQL type name:

        ['INTEGER', 'VARCHAR', 'INTERVAL']

  abstract property sql_parameter_types: [<class 'str'>]

    The type of the parameters required by the statement.

    A sequence of str objects stating the SQL type name:

        ['INTEGER', 'VARCHAR', 'INTERVAL']

  abstract property statement_id: str

    The statment’s identifier.

  abstract property string: object

    The SQL string of the prepared statement.

    None if not available. This can happen in cases where a statement is prepared on the server and a reference to the statement is sent to the client which subsequently uses the statement via the Database’s statement constructor.

class postgresql.api.StoredProcedure

  Bases: `Element`

  A function stored on the database.

class postgresql.api.Transaction

  Bases: `Element`

  A Tranaction is an element that represents a transaction in the session. Once created, it’s ready to be started, and subsequently committed or rolled back.

  Read-only transaction:

      >>> with db.xact(mode = 'read only'):
      ...  ...

  Read committed isolation:

      >>> with db.xact(isolation = 'READ COMMITTED'):
      ...  ...

  Savepoints are created if inside a transaction block:

      >>> with db.xact():
      ...  with db.xact():
      ...   ...

  abstract abort() → None

    Abort the transaction.

    If the transaction is a savepoint, ROLLBACK TO the savepoint identifier.

    If the transaction is a transaction block, issue an ABORT.

    If the transaction has already been aborted, do nothing.

  abstract begin() → None

    Start the transaction.

    If the database is in a transaction block, the transaction should be configured as a savepoint. If any transaction block configuration was applied to the transaction, raise a postgresql.exceptions.OperationError.

    If the database is not in a transaction block, start one using the configuration where:

    self.isolation specifies the `ISOLATION LEVEL`. Normally, `READ COMMITTED`, `SERIALIZABLE`, or `READ UNCOMMITTED`.

    self.mode specifies the mode of the transaction. Normally, `READ ONLY` or `READ WRITE`.

    If the transaction is already open, do nothing.

    If the transaction has been committed or aborted, raise an postgresql.exceptions.OperationError.

  abstract commit() → None

    Commit the transaction.

    If the transaction is a block, issue a COMMIT statement.

    If the transaction was started inside a transaction block, it should be identified as a savepoint, and the savepoint should be released.

    If the transaction has already been committed, do nothing.

  abstract property isolation: (None, <class 'str'>)

    The isolation level of the transaction block:

    > START TRANSACTION <isolation> [MODE];

    The isolation property is a string and will be directly interpolated into the START TRANSACTION statement.

  abstract property mode: (None, <class 'str'>)

    The mode of the transaction block:

    > START TRANSACTION [ISOLATION] <mode>;

    The mode property is a string and will be directly interpolated into the START TRANSACTION statement.

  abstract rollback() → None

    Abort the transaction.

    If the transaction is a savepoint, ROLLBACK TO the savepoint identifier.

    If the transaction is a transaction block, issue an ABORT.

    If the transaction has already been aborted, do nothing.

  abstract start() → None

    Start the transaction.

    If the database is in a transaction block, the transaction should be configured as a savepoint. If any transaction block configuration was applied to the transaction, raise a postgresql.exceptions.OperationError.

    If the database is not in a transaction block, start one using the configuration where:

    self.isolation specifies the `ISOLATION LEVEL`. Normally, `READ COMMITTED`, `SERIALIZABLE`, or `READ UNCOMMITTED`.

    self.mode specifies the mode of the transaction. Normally, `READ ONLY` or `READ WRITE`.

    If the transaction is already open, do nothing.

    If the transaction has been committed or aborted, raise an postgresql.exceptions.OperationError.

class postgresql.api.TypeIO

  Bases: `Element`

## `postgresql.sys`

py-postgresql system functions and data.

### Data

> `libpath`

>   The local file system paths that contain query libraries.

### Overridable Functions

> excformat

>   Information that makes up an exception’s displayed “body”. Effectively, the implementation of postgresql.exception.Error.__str__

> msghook

>   Display a message.

postgresql.sys.default_errformat(val)

  Built-in error formatter. DON’T TOUCH!

postgresql.sys.default_msghook(msg, format_message=<function format_element>)

  Built-in message hook. DON’T TOUCH!

postgresql.sys.errformat(*args, **kw)

  Raised Database Error formatter pointing to default_excformat.

  Override if you like. All postgresql.exceptions.Error’s are formatted using this function.

postgresql.sys.msghook(*args, **kw)

  Message hook pointing to default_msghook.

  Override if you like. All untrapped messages raised by driver connections come here to be printed to stderr.

postgresql.sys.reset_errformat(with_func=<function errformat>)

  restore the original excformat function

postgresql.sys.reset_msghook(with_func=<function msghook>)

  restore the original msghook function

## `postgresql.string`

String split and join operations for dealing with literals and identifiers.

Notably, the functions in this module are intended to be used for simple use-cases. It attempts to stay away from “real” parsing and simply provides functions for common needs, like the ability to identify unquoted portions of a query string so that logic or transformations can be applied to only unquoted portions. Scanning for statement terminators, or safely interpolating identifiers.

All functions deal with strict quoting rules.

postgresql.string.escape_ident(text)

  Replace every instance of “ with “”

postgresql.string.escape_literal(text)

  Replace every instance of ‘ with ‘’

postgresql.string.qname(*args)

  Quote the identifiers and join them using ‘.’

postgresql.string.quote_ident(text)

  Replace every instance of ‘ with and place ‘ on each end

postgresql.string.quote_ident_if_needed(text)

  If needed, replace every instance of ‘”’ with ‘””’ and place ‘”’ on each end. Otherwise, just return the text.

postgresql.string.quote_literal(text)

  Escape the literal and wrap it in [single] quotations

postgresql.string.split(text)

  split the string up by into non-quoted and quoted portions. Zero and even numbered indexes are unquoted portions, while odd indexes are quoted portions.

  Unquoted portions are regular strings, whereas quoted portions are pair-tuples specifying the quotation mechanism and the content thereof.

      >>> list(split("select $$foobar$$"))
      ['select ', ('$$', 'foobar'), '']

  If the split ends on a quoted section, it means the string’s quote was not terminated. Subsequently, there will be an even number of objects in the list.

  Quotation errors are detected, but never raised. Rather it’s up to the user to identify the best course of action for the given split.

postgresql.string.split_ident(text, sep=',', quote='"', maxsplit=-1)

  Split a series of identifiers using the specified separator.

postgresql.string.split_qname(text, maxsplit=-1)

  Call to .split_ident() with a ‘.’ sep parameter.

postgresql.string.split_sql(sql, sep=';')

  Given SQL, safely split using the given separator. Notably, this yields fully split text. This should be used instead of split_sql_str() when quoted sections need be still be isolated.

      >>> list(split_sql('select $$1$$ AS "foo;"; select 2;'))
      [['select ', ('$$', '1'), ' AS ', ('"', 'foo;'), ''], (' select 2',), ['']]

postgresql.string.split_sql_str(sql, sep=';')

  Identical to split_sql but yields unsplit text.

      >>> list(split_sql_str('select $$1$$ AS "foo;"; select 2;'))
      ['select $$1$$ AS "foo;"', ' select 2', '']

postgresql.string.split_using(text, quote, sep='.', maxsplit=-1)

  split the string on the seperator ignoring the separator in quoted areas.

  This is only useful for simple quoted strings. Dollar quotes, and backslash escapes are not supported.

postgresql.string.unsplit(splitted_iter)

  catenate a split string. This is needed to handle the special cases created by pg.string.split(). (Run-away quotations, primarily)

## `postgresql.exceptions`

PostgreSQL exceptions and warnings with associated state codes.

The primary entry points of this module is the ErrorLookup function and the WarningLookup function. Given an SQL state code, they give back the most appropriate Error or Warning subclass.

For more information on error codes see:

  http://www.postgresql.org/docs/current/static/errcodes-appendix.html

This module is executable via -m: python -m postgresql.exceptions. It provides a convenient way to look up the exception object mapped to by the given error code:

    $ python -m postgresql.exceptions XX000
    postgresql.exceptions.InternalError [XX000]

If the exact error code is not found, it will try to find the error class’s exception(The first two characters of the error code make up the class identity):

    $ python -m postgresql.exceptions XX400
    postgresql.exceptions.InternalError [XX000]

If that fails, it will return postgresql.exceptions.Error

exception postgresql.exceptions.ActiveTransactionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

exception postgresql.exceptions.AdminShutdownError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `OIError`, `Disconnection`

exception postgresql.exceptions.AmbiguityError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.AmbiguousAliasError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `AmbiguityError`

exception postgresql.exceptions.AmbiguousColumnError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `AmbiguityError`

exception postgresql.exceptions.AmbiguousFunctionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `AmbiguityError`

exception postgresql.exceptions.AmbiguousParameterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `AmbiguityError`

exception postgresql.exceptions.ArgumentOverflowError

  Bases: `PLEError`

exception postgresql.exceptions.ArrayElementError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.AssignmentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.AuthenticationMethodError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverError`, `Disconnection`

  Server requested an authentication method that is not supported by the driver.

exception postgresql.exceptions.AuthenticationSpecificationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`, `Disconnection`

exception postgresql.exceptions.BadAccessModeForBranchError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

exception postgresql.exceptions.BadCopyError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.BadIsolationForBranchError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

exception postgresql.exceptions.BinaryRepresentationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.BranchAlreadyActiveError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

exception postgresql.exceptions.CFError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Configuration File Error

exception postgresql.exceptions.CardinalityError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Wrong number of rows returned

exception postgresql.exceptions.CaseNotFoundError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.CastCharacterValueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.CatalogNameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `NameError`

exception postgresql.exceptions.CheckError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ICVError`

exception postgresql.exceptions.ClientCannotConnectError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ConnectionError`

  Client was unable to establish a connection to the server.

exception postgresql.exceptions.CoercionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeError`

exception postgresql.exceptions.ColumnDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.ColumnError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeIOError`

exception postgresql.exceptions.ColumnOverflowError

  Bases: `PLEError`

exception postgresql.exceptions.ColumnReferenceError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.ComplexityOverflowError

  Bases: `PLEError`

exception postgresql.exceptions.CompositeError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeIOError`

exception postgresql.exceptions.ConnectTimeoutError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverError`, `Disconnection`

  Client was unable to esablish a connection in the given time

exception postgresql.exceptions.ConnectionDoesNotExistError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ConnectionError`

  The connection is closed or was never connected.

exception postgresql.exceptions.ConnectionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`, `Disconnection`

exception postgresql.exceptions.ConnectionFailureError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ConnectionError`

  Raised when a connection is dropped

exception postgresql.exceptions.ConnectionRejectionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ConnectionError`

exception postgresql.exceptions.ContainingSQLNotPermittedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `EREError`

exception postgresql.exceptions.CrashShutdownError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `OIError`, `Disconnection`

exception postgresql.exceptions.CursorDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.CursorNameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `NameError`

exception postgresql.exceptions.CursorStateError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.DPDSEError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Dependent Privilege Descriptors Still Exist

exception postgresql.exceptions.DPDSEObjectError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DPDSEError`

exception postgresql.exceptions.DataCorruptedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `InternalError`

exception postgresql.exceptions.DataError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.DataModificationProhibitedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SREError`

exception postgresql.exceptions.DatabaseDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.DateTimeFieldOverflowError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.DateTimeFormatError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.DeadlockError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TRError`

exception postgresql.exceptions.DefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

class postgresql.exceptions.DeprecationWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.Disconnection

  Bases: `Exception`

  Exception identifying errors that result in disconnection

exception postgresql.exceptions.DiskFullError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `IRError`

exception postgresql.exceptions.DriverError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Errors originating in the driver’s implementation.

class postgresql.exceptions.DriverWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.DuplicateAliasError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateColumnError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateCursorError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateDatabaseError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.DuplicateFileError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SIOError`

exception postgresql.exceptions.DuplicateFunctionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateObjectError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicatePreparedStatementError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateSchemaError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

exception postgresql.exceptions.DuplicateTableError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DuplicateError`

class postgresql.exceptions.DynamicResultSetsReturnedWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.EREError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  External Routine Exception

exception postgresql.exceptions.ERIEError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  External Routine Invocation Exception

exception postgresql.exceptions.EncodingError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.Error(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Message`, `Exception`

  A PostgreSQL Error

exception postgresql.exceptions.EscapeCharacterConflictError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.EscapeCharacterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

  Invalid escape character

exception postgresql.exceptions.EscapeOctetError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.EscapeSequenceError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.Exception

  Bases: `Exception`

  Base PostgreSQL exception class

exception postgresql.exceptions.FeatureError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Unsupported feature

exception postgresql.exceptions.FloatingPointError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.ForeignKeyCreationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.ForeignKeyError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ICVError`

exception postgresql.exceptions.FunctionDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.FunctionExecutedNoReturnStatementError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SREError`

exception postgresql.exceptions.GrantorError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.GrantorOperationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `GrantorError`

exception postgresql.exceptions.GroupingError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.ICVError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Integrity Contraint Violation

exception postgresql.exceptions.IRError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Insufficient Resource Error

exception postgresql.exceptions.ITSError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TransactionError`

  Invalid Transaction State

class postgresql.exceptions.IgnoredClientParameterWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverWarning`

  Warn the user of a valid, but ignored parameter.

exception postgresql.exceptions.ImmutableRuntimeParameterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ONIPSError`

class postgresql.exceptions.ImplicitZeroBitPaddingWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.InFailedTransactionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

  Occurs when an action occurs in a failed transaction.

exception postgresql.exceptions.InconsistentCursorIsolationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

  The held cursor requires the same isolation.

exception postgresql.exceptions.IndeterminateTypeError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeError`

exception postgresql.exceptions.IndexCorruptedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `InternalError`

exception postgresql.exceptions.IndicatorOverflowError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.IndicatorParameterValueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.InsecurityError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverError`, `Disconnection`

  Error signifying a secure channel to a server cannot be established.

exception postgresql.exceptions.InsufficientPrivilegeError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.IntegrityConstraintViolationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TRError`

exception postgresql.exceptions.InternalError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.IntervalFieldOverflowError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.InvalidSQLState(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ERIEError`

exception postgresql.exceptions.InvalidSavepointSpecificationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SavepointError`

exception postgresql.exceptions.LimitValueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.LoadError

  Bases: `Exception`

  Failed to load a library

exception postgresql.exceptions.LocatorError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.LocatorSpecificationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `LocatorError`

exception postgresql.exceptions.LockFileExistsError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `CFError`

exception postgresql.exceptions.LogArgumentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.MemoryError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `IRError`, `MemoryError`

exception postgresql.exceptions.ModifyingSQLDataNotPermittedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `EREError`

exception postgresql.exceptions.NameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.NameTooLongError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.NoActiveTransactionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

exception postgresql.exceptions.NoActiveTransactionForBranchError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

class postgresql.exceptions.NoDataWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

class postgresql.exceptions.NoMoreSetsReturned(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `NoDataWarning`

exception postgresql.exceptions.NonstandardUseOfEscapeCharacterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.NotNullError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ICVError`

exception postgresql.exceptions.NotXMLError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

class postgresql.exceptions.NullValueEliminatedInSetFunctionWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.NullValueNoIndicatorParameter(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.NullValueNotAllowed(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ERIEError`

exception postgresql.exceptions.NullValueNotAllowedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.NumericRangeError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.OIError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Operator Intervention

exception postgresql.exceptions.ONIPSError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Object Not In Prerequisite State

exception postgresql.exceptions.ObjectDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.ObjectInUseError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ONIPSError`

exception postgresql.exceptions.OffsetValueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.OperationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverError`

  An invalid operation on an interface element.

exception postgresql.exceptions.PLEError

  Bases: `OverflowError`

  Program Limit Exceeded

exception postgresql.exceptions.PLPGSQLError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Error raised by a PL/PgSQL procedural function

exception postgresql.exceptions.PLPGSQLNoDataFoundError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `PLPGSQLError`

exception postgresql.exceptions.PLPGSQLRaiseError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `PLPGSQLError`

  Error raised by a PL/PgSQL RAISE statement.

exception postgresql.exceptions.PLPGSQLTooManyRowsError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `PLPGSQLError`

exception postgresql.exceptions.ParameterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeIOError`

exception postgresql.exceptions.ParameterValueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.PowerFunctionArgumentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.PreparedStatementDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

class postgresql.exceptions.PrivilegeNotGrantedWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

class postgresql.exceptions.PrivilegeNotRevokedWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.ProhibitedSQLStatementError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `EREError`

exception postgresql.exceptions.ProtocolError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ConnectionError`

exception postgresql.exceptions.QueryCanceledError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `OIError`

exception postgresql.exceptions.ReadOnlyTransactionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

  Occurs when an alteration occurs in a read-only transaction.

exception postgresql.exceptions.ReadingDataProhibitedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SREError`

exception postgresql.exceptions.ReadingSQLDataNotPermittedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `EREError`

exception postgresql.exceptions.RecursionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.RegularExpressionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.ReservedNameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.RestrictError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ICVError`

exception postgresql.exceptions.RoleSpecificationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.SEARVError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  Syntax Error or Access Rule Violation

exception postgresql.exceptions.SEARVNameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.SIOError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  System I/O

exception postgresql.exceptions.SQLNotYetCompleteError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.SREError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  SQL Routine Exception

exception postgresql.exceptions.SRFProtocolError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ERIEError`

exception postgresql.exceptions.SavepointError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TransactionError`

  Classification error designating errors that relate to savepoints.

exception postgresql.exceptions.SchemaAndDataStatementsError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ITSError`

  Mixed schema and data statements not allowed.

exception postgresql.exceptions.SchemaDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.SchemaNameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `NameError`

exception postgresql.exceptions.SerializationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TRError`

exception postgresql.exceptions.ServerNotReadyError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `OIError`, `Disconnection`

  Thrown when a connection is established to a server that is still starting up.

exception postgresql.exceptions.SpecificTypeMismatch(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.StatementCompletionUnknownError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TRError`

exception postgresql.exceptions.StatementNameError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `NameError`

exception postgresql.exceptions.StatementProhibitedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SREError`

exception postgresql.exceptions.StringDataLengthError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

class postgresql.exceptions.StringDataRightTruncationWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

exception postgresql.exceptions.StringRightTruncationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.SubstringError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.SyntaxError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.TRError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TransactionError`

  Transaction Rollback

exception postgresql.exceptions.TableDefinitionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DefinitionError`

exception postgresql.exceptions.TextRepresentationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.TimeZoneDisplacementValueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.TooManyConnectionsError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `IRError`

exception postgresql.exceptions.TransactionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.TransactionInitiationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TransactionError`

exception postgresql.exceptions.TransactionResolutionUnknownError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ConnectionError`

exception postgresql.exceptions.TransactionTerminationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TransactionError`

exception postgresql.exceptions.TriggerProtocolError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ERIEError`

exception postgresql.exceptions.TriggeredActionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.TriggeredDataChangeViolation(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.TrimError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

class postgresql.exceptions.TypeConversionWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverWarning`

  Report a potential issue with a conversion.

exception postgresql.exceptions.TypeError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.TypeIOError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DriverError`

  Driver failed to pack or unpack a tuple.

exception postgresql.exceptions.TypeMismatchError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeError`

exception postgresql.exceptions.UnavailableLockError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ONIPSError`

exception postgresql.exceptions.UndefinedColumnError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `UndefinedError`

exception postgresql.exceptions.UndefinedError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.UndefinedFileError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SIOError`

exception postgresql.exceptions.UndefinedFunctionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `UndefinedError`

exception postgresql.exceptions.UndefinedObjectError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `UndefinedError`

exception postgresql.exceptions.UndefinedParameterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `UndefinedError`

exception postgresql.exceptions.UndefinedTableError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `UndefinedError`

exception postgresql.exceptions.UniqueError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ICVError`

exception postgresql.exceptions.UnterminatedCStringError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.UntranslatableCharacterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

class postgresql.exceptions.Warning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Message`

exception postgresql.exceptions.WidthBucketFunctionArgumentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.WindowError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `SEARVError`

exception postgresql.exceptions.WithCheckOptionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

exception postgresql.exceptions.WrongObjectTypeError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `TypeError`

exception postgresql.exceptions.XMLCommentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.XMLContentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.XMLDocumentError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.XMLProcessingInstructionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.ZeroDivisionError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

exception postgresql.exceptions.ZeroLengthString(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `DataError`

postgresql.exceptions.map_errors_and_warnings(objs: A iterable of `Warning`s and `Error`'s, error_container: apply the code to error association to this object = {'': <class 'postgresql.exceptions.Error'>, '--000': <class 'postgresql.exceptions.DriverError'>, '--AUT': <class 'postgresql.exceptions.AuthenticationMethodError'>, '--CIO': <class 'postgresql.exceptions.ColumnError'>, '--OPE': <class 'postgresql.exceptions.OperationError'>, '--PIO': <class 'postgresql.exceptions.ParameterError'>, '--SEC': <class 'postgresql.exceptions.InsecurityError'>, '--TIO': <class 'postgresql.exceptions.TypeIOError'>, '--TOE': <class 'postgresql.exceptions.ConnectTimeoutError'>, '--cIO': <class 'postgresql.exceptions.CompositeError'>, '03000': <class 'postgresql.exceptions.SQLNotYetCompleteError'>, '08000': <class 'postgresql.exceptions.ConnectionError'>, '08001': <class 'postgresql.exceptions.ClientCannotConnectError'>, '08003': <class 'postgresql.exceptions.ConnectionDoesNotExistError'>, '08004': <class 'postgresql.exceptions.ConnectionRejectionError'>, '08006': <class 'postgresql.exceptions.ConnectionFailureError'>, '08007': <class 'postgresql.exceptions.TransactionResolutionUnknownError'>, '08P01': <class 'postgresql.exceptions.ProtocolError'>, '09000': <class 'postgresql.exceptions.TriggeredActionError'>, '0A000': <class 'postgresql.exceptions.FeatureError'>, '0B000': <class 'postgresql.exceptions.TransactionInitiationError'>, '0F000': <class 'postgresql.exceptions.LocatorError'>, '0F001': <class 'postgresql.exceptions.LocatorSpecificationError'>, '0L000': <class 'postgresql.exceptions.GrantorError'>, '0LP01': <class 'postgresql.exceptions.GrantorOperationError'>, '0P000': <class 'postgresql.exceptions.RoleSpecificationError'>, '20000': <class 'postgresql.exceptions.CaseNotFoundError'>, '21000': <class 'postgresql.exceptions.CardinalityError'>, '22000': <class 'postgresql.exceptions.DataError'>, '22001': <class 'postgresql.exceptions.StringRightTruncationError'>, '22002': <class 'postgresql.exceptions.NullValueNoIndicatorParameter'>, '22003': <class 'postgresql.exceptions.NumericRangeError'>, '22004': <class 'postgresql.exceptions.NullValueNotAllowedError'>, '22005': <class 'postgresql.exceptions.AssignmentError'>, '22007': <class 'postgresql.exceptions.DateTimeFormatError'>, '22008': <class 'postgresql.exceptions.DateTimeFieldOverflowError'>, '22009': <class 'postgresql.exceptions.TimeZoneDisplacementValueError'>, '2200B': <class 'postgresql.exceptions.EscapeCharacterConflictError'>, '2200C': <class 'postgresql.exceptions.EscapeCharacterError'>, '2200D': <class 'postgresql.exceptions.EscapeOctetError'>, '2200F': <class 'postgresql.exceptions.ZeroLengthString'>, '2200G': <class 'postgresql.exceptions.SpecificTypeMismatch'>, '2200L': <class 'postgresql.exceptions.NotXMLError'>, '2200M': <class 'postgresql.exceptions.XMLDocumentError'>, '2200N': <class 'postgresql.exceptions.XMLContentError'>, '2200S': <class 'postgresql.exceptions.XMLCommentError'>, '2200T': <class 'postgresql.exceptions.XMLProcessingInstructionError'>, '22010': <class 'postgresql.exceptions.IndicatorParameterValueError'>, '22011': <class 'postgresql.exceptions.SubstringError'>, '22012': <class 'postgresql.exceptions.ZeroDivisionError'>, '22015': <class 'postgresql.exceptions.IntervalFieldOverflowError'>, '22018': <class 'postgresql.exceptions.CastCharacterValueError'>, '2201B': <class 'postgresql.exceptions.RegularExpressionError'>, '2201E': <class 'postgresql.exceptions.LogArgumentError'>, '2201F': <class 'postgresql.exceptions.PowerFunctionArgumentError'>, '2201G': <class 'postgresql.exceptions.WidthBucketFunctionArgumentError'>, '2201W': <class 'postgresql.exceptions.LimitValueError'>, '2201X': <class 'postgresql.exceptions.OffsetValueError'>, '22020': <class 'postgresql.exceptions.LimitValueError'>, '22021': <class 'postgresql.exceptions.EncodingError'>, '22022': <class 'postgresql.exceptions.IndicatorOverflowError'>, '22023': <class 'postgresql.exceptions.ParameterValueError'>, '22024': <class 'postgresql.exceptions.UnterminatedCStringError'>, '22025': <class 'postgresql.exceptions.EscapeSequenceError'>, '22026': <class 'postgresql.exceptions.StringDataLengthError'>, '22027': <class 'postgresql.exceptions.TrimError'>, '2202E': <class 'postgresql.exceptions.ArrayElementError'>, '22P01': <class 'postgresql.exceptions.FloatingPointError'>, '22P02': <class 'postgresql.exceptions.TextRepresentationError'>, '22P03': <class 'postgresql.exceptions.BinaryRepresentationError'>, '22P04': <class 'postgresql.exceptions.BadCopyError'>, '22P05': <class 'postgresql.exceptions.UntranslatableCharacterError'>, '22P06': <class 'postgresql.exceptions.NonstandardUseOfEscapeCharacterError'>, '23000': <class 'postgresql.exceptions.ICVError'>, '23001': <class 'postgresql.exceptions.RestrictError'>, '23502': <class 'postgresql.exceptions.NotNullError'>, '23503': <class 'postgresql.exceptions.ForeignKeyError'>, '23505': <class 'postgresql.exceptions.UniqueError'>, '23514': <class 'postgresql.exceptions.CheckError'>, '24000': <class 'postgresql.exceptions.CursorStateError'>, '25000': <class 'postgresql.exceptions.ITSError'>, '25001': <class 'postgresql.exceptions.ActiveTransactionError'>, '25002': <class 'postgresql.exceptions.BranchAlreadyActiveError'>, '25003': <class 'postgresql.exceptions.BadAccessModeForBranchError'>, '25004': <class 'postgresql.exceptions.BadIsolationForBranchError'>, '25005': <class 'postgresql.exceptions.NoActiveTransactionForBranchError'>, '25006': <class 'postgresql.exceptions.ReadOnlyTransactionError'>, '25007': <class 'postgresql.exceptions.SchemaAndDataStatementsError'>, '25008': <class 'postgresql.exceptions.InconsistentCursorIsolationError'>, '25P01': <class 'postgresql.exceptions.NoActiveTransactionError'>, '25P02': <class 'postgresql.exceptions.InFailedTransactionError'>, '26000': <class 'postgresql.exceptions.StatementNameError'>, '27000': <class 'postgresql.exceptions.TriggeredDataChangeViolation'>, '28000': <class 'postgresql.exceptions.AuthenticationSpecificationError'>, '2B000': <class 'postgresql.exceptions.DPDSEError'>, '2BP01': <class 'postgresql.exceptions.DPDSEObjectError'>, '2D000': <class 'postgresql.exceptions.TransactionTerminationError'>, '2F000': <class 'postgresql.exceptions.SREError'>, '2F002': <class 'postgresql.exceptions.DataModificationProhibitedError'>, '2F003': <class 'postgresql.exceptions.StatementProhibitedError'>, '2F004': <class 'postgresql.exceptions.ReadingDataProhibitedError'>, '2F005': <class 'postgresql.exceptions.FunctionExecutedNoReturnStatementError'>, '34000': <class 'postgresql.exceptions.CursorNameError'>, '38000': <class 'postgresql.exceptions.EREError'>, '38001': <class 'postgresql.exceptions.ContainingSQLNotPermittedError'>, '38002': <class 'postgresql.exceptions.ModifyingSQLDataNotPermittedError'>, '38003': <class 'postgresql.exceptions.ProhibitedSQLStatementError'>, '38004': <class 'postgresql.exceptions.ReadingSQLDataNotPermittedError'>, '39000': <class 'postgresql.exceptions.ERIEError'>, '39001': <class 'postgresql.exceptions.InvalidSQLState'>, '39004': <class 'postgresql.exceptions.NullValueNotAllowed'>, '39P01': <class 'postgresql.exceptions.TriggerProtocolError'>, '39P02': <class 'postgresql.exceptions.SRFProtocolError'>, '3B000': <class 'postgresql.exceptions.SavepointError'>, '3B001': <class 'postgresql.exceptions.InvalidSavepointSpecificationError'>, '3D000': <class 'postgresql.exceptions.CatalogNameError'>, '3F000': <class 'postgresql.exceptions.SchemaNameError'>, '40000': <class 'postgresql.exceptions.TRError'>, '40001': <class 'postgresql.exceptions.SerializationError'>, '40002': <class 'postgresql.exceptions.IntegrityConstraintViolationError'>, '40003': <class 'postgresql.exceptions.StatementCompletionUnknownError'>, '40P01': <class 'postgresql.exceptions.DeadlockError'>, '42000': <class 'postgresql.exceptions.SEARVError'>, '42501': <class 'postgresql.exceptions.InsufficientPrivilegeError'>, '42601': <class 'postgresql.exceptions.SyntaxError'>, '42602': <class 'postgresql.exceptions.SEARVNameError'>, '42611': <class 'postgresql.exceptions.ColumnDefinitionError'>, '42622': <class 'postgresql.exceptions.NameTooLongError'>, '42701': <class 'postgresql.exceptions.DuplicateColumnError'>, '42702': <class 'postgresql.exceptions.AmbiguousColumnError'>, '42703': <class 'postgresql.exceptions.UndefinedColumnError'>, '42704': <class 'postgresql.exceptions.UndefinedObjectError'>, '42710': <class 'postgresql.exceptions.DuplicateObjectError'>, '42712': <class 'postgresql.exceptions.DuplicateAliasError'>, '42723': <class 'postgresql.exceptions.DuplicateFunctionError'>, '42725': <class 'postgresql.exceptions.AmbiguousFunctionError'>, '42803': <class 'postgresql.exceptions.GroupingError'>, '42804': <class 'postgresql.exceptions.TypeMismatchError'>, '42809': <class 'postgresql.exceptions.WrongObjectTypeError'>, '42830': <class 'postgresql.exceptions.ForeignKeyCreationError'>, '42846': <class 'postgresql.exceptions.CoercionError'>, '42883': <class 'postgresql.exceptions.UndefinedFunctionError'>, '42939': <class 'postgresql.exceptions.ReservedNameError'>, '42P01': <class 'postgresql.exceptions.UndefinedTableError'>, '42P02': <class 'postgresql.exceptions.UndefinedParameterError'>, '42P03': <class 'postgresql.exceptions.DuplicateCursorError'>, '42P04': <class 'postgresql.exceptions.DuplicateDatabaseError'>, '42P05': <class 'postgresql.exceptions.DuplicatePreparedStatementError'>, '42P06': <class 'postgresql.exceptions.DuplicateSchemaError'>, '42P07': <class 'postgresql.exceptions.DuplicateTableError'>, '42P08': <class 'postgresql.exceptions.AmbiguousParameterError'>, '42P09': <class 'postgresql.exceptions.AmbiguousAliasError'>, '42P10': <class 'postgresql.exceptions.ColumnReferenceError'>, '42P11': <class 'postgresql.exceptions.CursorDefinitionError'>, '42P12': <class 'postgresql.exceptions.DatabaseDefinitionError'>, '42P13': <class 'postgresql.exceptions.FunctionDefinitionError'>, '42P14': <class 'postgresql.exceptions.PreparedStatementDefinitionError'>, '42P15': <class 'postgresql.exceptions.SchemaDefinitionError'>, '42P16': <class 'postgresql.exceptions.TableDefinitionError'>, '42P17': <class 'postgresql.exceptions.ObjectDefinitionError'>, '42P18': <class 'postgresql.exceptions.IndeterminateTypeError'>, '42P19': <class 'postgresql.exceptions.RecursionError'>, '42P20': <class 'postgresql.exceptions.WindowError'>, '44000': <class 'postgresql.exceptions.WithCheckOptionError'>, '53000': <class 'postgresql.exceptions.IRError'>, '53100': <class 'postgresql.exceptions.DiskFullError'>, '53200': <class 'postgresql.exceptions.MemoryError'>, '53300': <class 'postgresql.exceptions.TooManyConnectionsError'>, '55000': <class 'postgresql.exceptions.ONIPSError'>, '55006': <class 'postgresql.exceptions.ObjectInUseError'>, '55P02': <class 'postgresql.exceptions.ImmutableRuntimeParameterError'>, '55P03': <class 'postgresql.exceptions.UnavailableLockError'>, '57000': <class 'postgresql.exceptions.OIError'>, '57014': <class 'postgresql.exceptions.QueryCanceledError'>, '57P01': <class 'postgresql.exceptions.AdminShutdownError'>, '57P02': <class 'postgresql.exceptions.CrashShutdownError'>, '57P03': <class 'postgresql.exceptions.ServerNotReadyError'>, '58000': <class 'postgresql.exceptions.SIOError'>, '58P01': <class 'postgresql.exceptions.UndefinedFileError'>, '58P02': <class 'postgresql.exceptions.DuplicateFileError'>, 'F0000': <class 'postgresql.exceptions.CFError'>, 'F0001': <class 'postgresql.exceptions.LockFileExistsError'>, 'P0000': <class 'postgresql.exceptions.PLPGSQLError'>, 'P0001': <class 'postgresql.exceptions.PLPGSQLRaiseError'>, 'P0002': <class 'postgresql.exceptions.PLPGSQLNoDataFoundError'>, 'P0003': <class 'postgresql.exceptions.PLPGSQLTooManyRowsError'>, 'XX000': <class 'postgresql.exceptions.InternalError'>, 'XX001': <class 'postgresql.exceptions.DataCorruptedError'>, 'XX002': <class 'postgresql.exceptions.IndexCorruptedError'>}, warning_container: apply the code to warning association to this object = {'01-00': <class 'postgresql.exceptions.DriverWarning'>, '01-CP': <class 'postgresql.exceptions.IgnoredClientParameterWarning'>, '01-TP': <class 'postgresql.exceptions.TypeConversionWarning'>, '01000': <class 'postgresql.exceptions.Warning'>, '01003': <class 'postgresql.exceptions.NullValueEliminatedInSetFunctionWarning'>, '01004': <class 'postgresql.exceptions.StringDataRightTruncationWarning'>, '01006': <class 'postgresql.exceptions.PrivilegeNotRevokedWarning'>, '01007': <class 'postgresql.exceptions.PrivilegeNotGrantedWarning'>, '01008': <class 'postgresql.exceptions.ImplicitZeroBitPaddingWarning'>, '0100C': <class 'postgresql.exceptions.DynamicResultSetsReturnedWarning'>, '01P01': <class 'postgresql.exceptions.DeprecationWarning'>, '02000': <class 'postgresql.exceptions.NoDataWarning'>, '02001': <class 'postgresql.exceptions.NoMoreSetsReturned'>})

  Construct the code-to-error and code-to-warning associations.

## `postgresql.temporal`

Temporary PostgreSQL cluster for the process.

class postgresql.temporal.Temporal

  Bases: `object`

  Manages a temporary cluster for the duration of the process.

  Instances of this class reference a distinct cluster. These clusters are transient; they will only exist until the process exits.

  Usage:

      >>> from postgresql.temporal import pg_tmp
      >>> with pg_tmp:
      ...  ps = db.prepare('SELECT 1')
      ...  assert ps.first() == 1

  Or pg_tmp can decorate a method or function.

  cluster_dirname()

    Format the cluster directory name.

postgresql.temporal.pg_tmp = <postgresql.temporal.Temporal object>

  The process’ temporary cluster.

## `postgresql.installation`

Collect and access PostgreSQL installation information.

class postgresql.installation.Installation(info: dict)

  Bases: `Installation`

  Class providing a Python interface to PostgreSQL installation information.

  info = None

    The pg_config information dictionary.

  property ssl

    Whether the installation was compiled with SSL support.

  type = None
  version = None
  version_info = None

postgresql.installation.default(typ=<class 'postgresql.installation.Installation'>)

  Get the default Installation.

  Uses default_pg_config() to identify the executable.

postgresql.installation.default_pg_config(execname='pg_config', envkey='PGINSTALLATION')

  Get the default pg_config executable on the system.

  If ‘PGINSTALLATION’ is in the environment, use it. Otherwise, look through the system’s PATH environment.

postgresql.installation.pg_config_dictionary(*pg_config_path)

  Create a dictionary of the information available in the given pg_config_path. This provides a one-shot solution to fetching information from the pg_config binary. Returns a dictionary object.

## `postgresql.cluster`

Create, control, and destroy PostgreSQL clusters.

postgresql.cluster provides a programmer’s interface to controlling a PostgreSQL cluster. It provides direct access to proper signalling interfaces.

class postgresql.cluster.Cluster(installation: installation object, data_directory: path to the data directory)

  Bases: `Cluster`

  Interface to a PostgreSQL cluster.

  Provides mechanisms to start, stop, restart, kill, drop, and initalize a cluster(data directory).

  Cluster does not strive to be consistent with `pg_ctl`. This is considered to be a base class for managing a cluster, and is intended to be extended to accommodate for a particular purpose.

  address()

    Get the host-port pair from the configuration.

  connect(**kw)

    Create an established connection from the connector.

    Cluster must be running.

  connection(**kw)

    Create a connection object to the cluster, but do not connect.

  connector(**kw)

    Create a postgresql.driver connector based on the given keywords and listen_addresses and port configuration in settings.

  property daemon_path

    Path to the executable to use to startup the cluster.

  data_directory = None
  drop()

    Stop the cluster and remove it from the filesystem

  get_pid_from_file()

    The current pid from the postmaster.pid file.

  property hba_file

    The path to the HBA file of the cluster.

  init(password: Password to assign to the cluster's superuser(`user` keyword). = None, **kw)

    Create the cluster at the given data_directory using the provided keyword parameters as options to the command.

    command_option_map provides the mapping of keyword arguments to command options.

  initialized()

    Whether or not the data directory appears to be a valid cluster.

  installation = None
  kill()

    Stop the cluster immediately(SIGKILL).

    Does not wait for shutdown.

  property pid

    If we have the subprocess, use the pid on the object.

  ready_for_connections()

    If the daemon is running, and is not in startup mode.

    This only works for clusters configured for TCP/IP connections.

  reload()

    Signal the cluster to reload its configuration file.

  restart(logfile=None, settings=None, timeout=10)

    Restart the cluster gracefully.

    This provides a higher level interface to stopping then starting the cluster. It will perform the wait operations and block until the restart is complete.

    If waiting is not desired, .start() and .stop() should be used directly.

  running()

    Whether or not the postmaster is running.

    This does not mean the cluster is accepting connections.

  property settings

    A Settings interface to the `postgresql.conf` file associated with the cluster.

  shutdown()

    Shutdown the cluster as soon as possible, disconnecting clients.

  start(logfile: Where to send stderr = None, settings: Mapping of runtime parameters = None)

    Start the cluster.

  stop()

    Stop the cluster gracefully waiting for clients to disconnect(SIGTERM).

  wait_until_started(timeout: how long to wait before throwing a timeout exception = 10, delay: how long to sleep before re-testing = 0.05)

    After the start method is used, this can be ran in order to block until the cluster is ready for use.

    This method loops until ready_for_connections returns True in order to make sure that the cluster is actually up.

  wait_until_stopped(timeout: how long to wait before throwing a timeout exception = 10, delay: how long to sleep before re-testing = 0.05)

    After the stop method is used, this can be ran in order to block until the cluster is shutdown.

    Additionally, catching ClusterTimeoutError exceptions would be a starting point for making decisions about whether or not to issue a kill to the daemon.

exception postgresql.cluster.ClusterError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Error`

  General cluster error.

exception postgresql.cluster.ClusterInitializationError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ClusterError`

  General cluster initialization failure

exception postgresql.cluster.ClusterNotRunningError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ClusterError`

  Cluster is not running

exception postgresql.cluster.ClusterStartupError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ClusterError`

  Cluster startup failed

exception postgresql.cluster.ClusterTimeoutError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ClusterError`

  Cluster operation timed out

class postgresql.cluster.ClusterWarning(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `Warning`

  Warning issued by cluster operations

exception postgresql.cluster.InitDBError(message: The primary information of the message, code: Message code to attach (SQL state) = None, details: additional information associated with the message = {}, source: Which side generated the message(SERVER, CLIENT) = None, creator: The interface element that called for instantiation = None)

  Bases: `ClusterInitializationError`

  A non-zero result was returned by the initdb command

## `postgresql.copyman`

Manage complex COPY operations; one-to-many COPY streaming.

Primarily this module houses the CopyManager class, and the transfer function for a high-level interface to using the CopyManager.

class postgresql.copyman.CallReceiver(callable)

  Bases: `Receiver`

  Call the given object with a list of COPY lines.

  accept(lines)

    Take the data object to be processed.

  transmit()

    Finish the reception of the accepted data.

exception postgresql.copyman.CopyFail(manager, reason=None, receiver_faults=None, producer_fault=None)

  Bases: `Exception`

  Exception thrown by the CopyManager when the COPY operation failed.

  The ‘manager’ attribute the CopyManager that raised the CopyFail.

  The ‘reason’ attribute is a string indicating why it failed.

  The ‘receiver_faults’ attribute is a mapping of receivers to exceptions that were raised on exit.

  The ‘producer_fault’ attribute specifies if the producer raise an exception on exit.

class postgresql.copyman.CopyManager(producer, *receivers)

  Bases: `Element`, `Iterator`

  A class for managing COPY operations.

  Connects the producer to the receivers.

  reconcile(r)

    Reconcile a receiver that faulted.

    This method should be used to add back a receiver that failed to complete its write operation, but is capable of completing the operation at this time.

exception postgresql.copyman.Fault

  Bases: `Exception`

class postgresql.copyman.Fitting

  Bases: `Element`

  abstract property protocol

    The COPY data format produced or consumed.

class postgresql.copyman.IteratorProducer(iterator)

  Bases: `Producer`

  realign()

    Method implemented by producers that emit COPY data that is not guaranteed to be aligned.

    This is only necessary in failure cases where receivers still need more data to complete the message.

class postgresql.copyman.NullProducer

  Bases: `Producer`

  Produces no copy data.

  protocol = None
  realign()

    Method implemented by producers that emit COPY data that is not guaranteed to be aligned.

    This is only necessary in failure cases where receivers still need more data to complete the message.

class postgresql.copyman.NullReceiver

  Bases: `Receiver`

  accept(data)

    Take the data object to be processed.

  protocol = None
  transmit()

    Finish the reception of the accepted data.

class postgresql.copyman.Producer

  Bases: `Fitting`, `Iterator`

  abstract realign()

    Method implemented by producers that emit COPY data that is not guaranteed to be aligned.

    This is only necessary in failure cases where receivers still need more data to complete the message.

exception postgresql.copyman.ProducerFault(manager)

  Bases: `Fault`

  Exception raised when the Producer caused an exception.

  Normally, Producer faults are fatal.

class postgresql.copyman.ProtocolProducer(recv_into: callable taking writable buffer and size, buffer_size=10240)

  Bases: `Producer`

  Producer using a PQv3 data stream.

  Normally, this class needs to be subclassed as it assumes that the given recv_into function will write COPY messages.

  realign()

    Method implemented by producers that emit COPY data that is not guaranteed to be aligned.

    This is only necessary in failure cases where receivers still need more data to complete the message.

  abstract recover(view)

    Given a view containing data read from the wire, recover the controller’s state.

    This needs to be implemented by subclasses in order for the ProtocolReceiver to pass control back to the original state machine.

class postgresql.copyman.ProtocolReceiver(send)

  Bases: `Receiver`

  accept(data)

    Take the data object to be processed.

  transmit()

    Finish the reception of the accepted data.

class postgresql.copyman.Receiver

  Bases: `Fitting`

  abstract accept(data)

    Take the data object to be processed.

  abstract transmit()

    Finish the reception of the accepted data.

exception postgresql.copyman.ReceiverFault(manager, faults)

  Bases: `Fault`

  Exception raised when Receivers cause an exception.

  Faults should be trapped if recovery from an exception is possible, or if the failed receiver is optional to the succes of the operation.

  The ‘manager’ attribute is the CopyManager that raised the fault.

  The ‘faults’ attribute is a dictionary mapping the receiver to the exception instance raised.

class postgresql.copyman.StatementProducer(statement, *args, **kw)

  Bases: `ProtocolProducer`

  recover(view)

    Given a view containing data read from the wire, recover the controller’s state.

    This needs to be implemented by subclasses in order for the ProtocolReceiver to pass control back to the original state machine.

class postgresql.copyman.StatementReceiver(statement, *parameters)

  Bases: `ProtocolReceiver`

  exception WireReady

    Bases: `BaseException`

class postgresql.copyman.WireState(condition=<method-wrapper '__ne__' of int object at 0xb35608>)

  Bases: `object`

  Manages the state of the wire.

  This class manages three possible positions:

  > 1. Between wire messages

  > 2. Inside message header

  > 3. Inside message (with complete header)

  The wire state will become unusable when the configured condition is True.

  update(view, getlen=<function mk_pack.<locals>.unpack>, len=<built-in function len>)

    Given the state of the COPY and new data, advance the position on the COPY stream.

postgresql.copyman.default_buffer_size = 10240

  10KB buffer for COPY messages by default.

postgresql.copyman.transfer(producer, *receivers)

  Perform a COPY operation using the given statements:

      >>> import copyman
      >>> copyman.transfer(src.prepare("COPY table TO STDOUT"), dst.prepare("COPY table FROM STDIN"))

postgresql.copyman.ulong_pack()

  S.pack(v1, v2, …) -> bytes

  Return a bytes object containing values v1, v2, … packed according to the format string S.format. See help(struct) for more on format strings.

## `postgresql.alock`

Tools for Advisory Locks

class postgresql.alock.ALock(database, *identifiers)

  Bases: `Element`

  Advisory Lock class for managing the acquisition and release of a sequence of PostgreSQL advisory locks.

  ALock()’s are fairly consistent with threading.RLock()’s. They can be acquired multiple times, and they must be released the same number of times for the lock to actually be released.

  A notably difference is that ALock’s manage a sequence of lock identifiers. This means that a given ALock() may represent multiple advisory locks.

  acquire(blocking=True, len=<built-in function len>)

    Acquire the locks using the configured identifiers.

  locked()

    Whether the locks have been acquired. This method is sensitive to the connection’s state. If the connection is closed, it will return False.

  abstract property mode

    The mode of the lock class.

  release()

    Release the locks using the configured identifiers.

class postgresql.alock.ExclusiveLock(database, *identifiers)

  Bases: `ALock`

class postgresql.alock.ShareLock(database, *identifiers)

  Bases: `ALock`