Skip to content
A PostgreSQL client library for the Go programming language
Find file
Pull request Compare This branch is 45 commits behind lxn:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


About go-pgsql

go-pgsql is a PostgreSQL client library for the Go programming language.

It partially implements version 3.0 of the PostgreSQL frontend/backend protocol, so it should work with servers of version 7.4 and later.

Installing go-pgsql

  1. Make sure you have a working Go installation, see the installation guide at
  2. git clone
  3. cd go-pgsql/src/pkg/pgsql && gomake install

Alternatively you can use goinstall: goinstall

Using go-pgsql

There are some examples in the src/cmd/examples directory which should get you started.

Please open an issue on the bug tracker if you encounter a bug.

Missing Features

go-pgsql is currently missing support for some features, including:

  • authentication types other than MD5
  • SSL encrypted sessions
  • some data types like bytea, ...
  • canceling commands/queries
  • bulk copy
  • ...

go-pgsql is (at least for now) not thread-safe, so for every goroutine that must talk to the same database, a separate Conn is required.

Time/Timestamp resolution

Because the resolution of time.Time is seconds, fractions of seconds are silently dropped by *ResultSet.Time and *ResultSet.TimeSeconds.

Something went wrong with that request. Please try again.