PostgreSQL Tcl Interface Documentation
Prev | Fast Backward |  | Fast Forward | Next

# pg_dbinfo

## Name

pg_dbinfo -- returns data about the connection

## Synopsis

    pg_dbinfo command ?conn? ?paramname?

## Description

`pg_dbinfo` returns data about the connection. The first argument is a command, and the second and third argument depend on the command chosen.

## Arguments

`command`
  `connections`

    Return a list of connection handles.

  `results connHandle`

    Return a list of result handles for the named connection.

  `version connHandle`

    Return server version for the connection.

  `protocol connHandle`

    Return protocol version for the connection.

  `param connHandle name`

    Return connection's value for the named parameter.

  `backendpid connHandle`

    Return server process ID for the connection.

  `socket connHandle`

    Return socket file handle for the connection.

  `sql_count connHandle`

    Return number of SQL queries that have been made for the connection.

  `dbname connHandle`

    Return name of the connected database.

  `user connHandle`

    Return logged in user name.

  `password connHandle`

    Return logged in user's password.

  `host connHandle`

    Return address of the connected host.

  `port connHandle`

    Return host port for the connection.

  `options connHandle`

    Return command line options passed in the connection request.

  `status connHandle`

    Return connection status.

  `transaction_status connHandle`

    Return transaction status.

  `error_message connHandle`

    Return the most recent error message on the connection.

  `needs_password connHandle`

    Return true if the connection required a password but none was available.

    This function can be applied after a failed connection attempt to decide whether to prompt the user for a password.

  `used_password connHandle`

    Return true if the connection used a password.

    This function can be applied after either a failed or successful connection attempt to detect whether the server demanded a password.

  `used_ssl connHandle`

    Return true if the connection uses SSL.

`conn`

  The handle of the connection, when required.

`param`

  The connection parameter name, when the command "param" is provided.

## Return Value

A Tcl list of connection handle names

Prev | Home | Next
pg_connect | Up | pg_disconnect