functor (Thread : THREAD->
  sig
    type 'a t
    type 'a monad = 'Thread.t
    exception Error of string
    exception PostgreSQL_Error of string * (char * string) list
    val connect :
      ?host:string ->
      ?port:int ->
      ?user:string ->
      ?password:string ->
      ?database:string ->
      ?unix_domain_socket_dir:string -> unit -> 'a t monad
    val close : 'a t -> unit monad
    val ping : 'a t -> unit monad
    val begin_work : 'a t -> unit monad
    val commit : 'a t -> unit monad
    val rollback : 'a t -> unit monad
    val serial : 'a t -> string -> int64 monad
    val serial4 : 'a t -> string -> int32 monad
    val serial8 : 'a t -> string -> int64 monad
    val max_message_length : int ref
    val verbose : int ref
    val set_private_data : 'a t -> '-> unit
    val private_data : 'a t -> 'a
    type pa_pg_data = (string, bool) Hashtbl.t
    type oid = int32
    type param = string option
    type result = string option
    type row = result list
    val prepare :
      'a t ->
      query:string -> ?name:string -> ?types:oid list -> unit -> unit monad
    val execute_rev :
      'a t ->
      ?name:string ->
      ?portal:string -> params:param list -> unit -> row list monad
    val execute :
      'a t ->
      ?name:string ->
      ?portal:string -> params:param list -> unit -> row list monad
    val close_statement : 'a t -> ?name:string -> unit -> unit monad
    val close_portal : 'a t -> ?portal:string -> unit -> unit monad
    type row_description = result_description list
    and result_description = {
      name : string;
      table : oid option;
      column : int option;
      field_type : oid;
      length : int;
      modifier : int32;
    }
    type params_description = param_description list
    and param_description = { param_type : oid; }
    val describe_statement :
      'a t ->
      ?name:string ->
      unit -> (params_description * row_description option) monad
    val describe_portal :
      'a t -> ?portal:string -> unit -> row_description option monad
    val name_of_type : ?modifier:int32 -> oid -> string
    type timestamptz = CalendarLib.Calendar.t * CalendarLib.Time_Zone.t
    type int16 = int
    type bytea = string
    type point = float * float
    type int32_array = int32 array
    val string_of_oid : oid -> string
    val string_of_bool : bool -> string
    val string_of_int : int -> string
    val string_of_int16 : int16 -> string
    val string_of_int32 : int32 -> string
    val string_of_int64 : int64 -> string
    val string_of_float : float -> string
    val string_of_point : point -> string
    val string_of_timestamp : CalendarLib.Calendar.t -> string
    val string_of_timestamptz : timestamptz -> string
    val string_of_date : CalendarLib.Date.t -> string
    val string_of_time : CalendarLib.Time.t -> string
    val string_of_interval : CalendarLib.Calendar.Period.t -> string
    val string_of_int32_array : int32_array -> string
    val string_of_bytea : bytea -> string
    val string_of_string : string -> string
    val string_of_unit : unit -> string
    val bool_of_string : string -> bool
    val int_of_string : string -> int
    val int16_of_string : string -> int16
    val int32_of_string : string -> int32
    val int64_of_string : string -> int64
    val float_of_string : string -> float
    val point_of_string : string -> point
    val timestamp_of_string : string -> CalendarLib.Calendar.t
    val timestamptz_of_string : string -> timestamptz
    val date_of_string : string -> CalendarLib.Date.t
    val time_of_string : string -> CalendarLib.Time.t
    val interval_of_string : string -> CalendarLib.Calendar.Period.t
    val int32_array_of_string : string -> int32_array
    val bytea_of_string : string -> bytea
    val unit_of_string : string -> unit
    val bind : 'a monad -> ('-> 'b monad) -> 'b monad
    val return : '-> 'a monad
  end