package caqti-driver-postgresql

  1. Overview
  2. Docs
On This Page
  1. Error Details
Legend:
Library
Module
Module type
Parameter
Class
Class type

PostgreSQL driver for Caqti (bindings).

This driver is implemented in terms of the postgresql OPAM package which provides bindings for the PostgreSQL C client library.

It handles URIs of the form

postgresql://<user>:<password>@<host>:<port>/<rest>

which are passed verbatim to Postgresql.connection, and URIs of the form postgresql://<query> which are first split into <key> = '<value>' form.

Additionally the query option notice_processing can be set to quiet (the default) to suppress notices or to stderr to emit notices to standard error. This option is interpreted by the Caqti driver and stripped off before passing the URI to libpq.

The interface provided by this module should normally not be used by applications, but provides access to some PostgreSQL specifics in case they are needed.

Error Details

The following gives access to diagnostics collected from the PostgreSQL connection and result objects.

type Caqti_error.msg +=
  1. | Connect_error_msg of {
    1. error : Postgresql.error;
      (*

      The exception raised by postgresql-ocaml.

      *)
    }
    (*

    An exception was raised while attempting to connect to the database.

    *)
  2. | Connection_error_msg of {
    1. error : Postgresql.error;
      (*

      The exception raised by postgresql-ocaml.

      *)
    2. connection_status : Postgresql.connection_status;
      (*

      The connection status reported by PQstatus.

      *)
    }
    (*

    An exception was raised while operating on the database connection.

    *)
  3. | Result_error_msg of {
    1. error_message : string;
      (*

      The error message from PQresultErrorMessage.

      *)
    2. sqlstate : string;
      (*

      The SQLSTATE error field.

      *)
    }
    (*

    An error was reported on the result from a database operation.

    *)