PostgreSQL
Prev | Appendix A. Database Back-ends | Next

## PostgreSQL

### Libraries

The PostgreSQL back-end requires the PostgreSQL C client library (`libpq.so`). The location of this library is specified via *postgresql-so-load-path*, which defaults to `/usr/lib/libpq.so`. Additional flags to ld needed for linking are specified via *postgresql-so-libraries*, which defaults to ("-lcrypt" "-lc").

### Initialization

Use

    (asdf:operate 'asdf:load-op 'clsql-postgresql)

to load the PostgreSQL back-end. The database type for the PostgreSQL back-end is :postgresql.

### Connection Specification

#### Syntax of connection-spec

    	    (host db user password &optional port options tty)

#### Description of connection-spec

For every parameter in the connection-spec, nil indicates that the PostgreSQL default environment variables (see PostgreSQL documentation) will be used, or if those are unset, the compiled-in defaults of the C client library are used.

`host`

  String representing the hostname or IP address the PostgreSQL server resides on. Use the empty string to indicate a connection to localhost via Unix-Domain sockets instead of TCP/IP.

`db`

  String representing the name of the database on the server to connect to.

`user`

  String representing the user name to use for authentication.

`password`

  String representing the unencrypted password to use for authentication.

`port`

  String representing the port to use for communication with the PostgreSQL server.

`options`

  String representing further runtime options for the PostgreSQL server.

`tty`

  String representing the tty or file to use for debugging messages from the PostgreSQL server.

### Notes

None.

Prev | Up | Next
Appendix A. Database Back-ends | Home | PostgreSQL Socket