# lib/pq

Go PostgreSQL driver for database/sql

Repository: https://github.com/lib/pq
Canonical: https://ross.abutalabs.com/products/pq
Homepage: https://pkg.go.dev/github.com/lib/pq
Language: Go
License: NOASSERTION
License Family: other
Last push: 2026-08-20T22:27:53+00:00

## Health v2 (maintenance only)
Score: 91/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 98, release rhythm 77, longevity 100
- inputs: {"age_days": 5287, "days_push": 13, "days_rel": 152, "gap_med": 6.5, "n_releases_24m": 7}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 9950, forks 969 (observed 2026-08-28T04:10:38.941199+00:00)

## What it is
lib/pq is a pure Go PostgreSQL driver for the standard database/sql package. It supports all maintained PostgreSQL versions and libpq-compatible DSN connection strings.

## Use cases
- connect to postgresql from go
- go database/sql postgres driver
- run sql queries against postgres in go
- use postgres url connection strings in go
- handle postgres errors in go

## When to choose
- you use database/sql and need a mature, widely imported PostgreSQL driver
- you want libpq-style DSN support and run-time parameters in connection strings

## When to avoid
- you need high performance or binary protocol features - pgx is generally recommended instead
- you need PostgreSQL-specific types outside database/sql's generic interface

## Facets
- artifact type: library
- maturity: stable
- function: database-driver, database
- domain: databases, backend, developer-tools
- platform: go, cross-platform
- tags: postgresql, database-sql, sql-driver, libpq

## Member repositories
- lib/pq (main) score 91

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:38.941199+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:20:16.606600+00:00, confidence not recorded.
  - readme: https://github.com/lib/pq (fetched 2026-08-28T04:10:38.941199+00:00, sha 9282e72cd054)
  - homepage: https://pkg.go.dev/github.com/lib/pq (fetched 2026-08-29T08:19:56.324709+00:00, sha 1bd330f35db4)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T08:19:56.335856+00:00, sha 757852027879)
  - site_page: https://go.dev/project (fetched 2026-08-29T08:19:56.337917+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
