aws / aws/aws-advanced-go-wrapper
Support for pq (lib/pq) PostgreSQL driver
- Dominant language
- Go
- Stars
- 78
- Forks
- 12
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 13
Description
### Describe the feature
Add a `pq-driver` module providing a `DriverDialect` implementation (plus error handler, row parser, and property resolver) for [`lib/pq`](https://github.com/lib/pq), alongside the existing `pgx-driver`, `mysql-driver`, and `bun-pg-driver` modules, so `sql.Open("awssql-pq", dsn)` works with the wrapper's failover, EFM, and IAM plugins.
### Use Case
Many existing Go codebases against Aurora PostgreSQL still use `lib/pq` rather than `pgx`, and migrating just to adopt this wrapper is a non-trivial undertaking, so those teams can't get failover/read-write-splitting/IAM auth without that migration first.
This is the same gap #428 raised for `bun` and #428 itself calls out `lib/pq` as another driver this would affect.
### Proposed Solution
I have a working prototype of a `pq-driver` module structured like `pgx-driver`/`bun-pg-driver`.
`PqDriverDialect` (dialect detection, `IsClosed` via lib/pq's `driver.Validator`, keyword-format `PrepareDsn` with failover host/port override), `PqErrorHandler` (SQLSTATE-based network/login classification), `PqRowParser` (handles lib/pq's raw `[]byte` for OIDs like `numeric`/`name` that it doesn't text-decode, unlike pgx), and `PqPropertyResolver` (`connect_timeout` ms→seconds).
### Other Information
Related: #428 (bun driver), same root cause and shape of fix.
The `DialectManager` check that blocked custom dialects in #428 has since been removed, so `lib/pq`'s dialect registers cleanly today. Before putting up a PR, I'd like to check whether maintainers are open to another PostgreSQL driver module and get early feedback on the approach.
### Acknowledgements
- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### The AWS Advanced Go Wrapper version used
v1.1.2 (pgx-driver) / latest release as of 2026-07-29
### Go version used
go version go1.26.5 darwin/arm64
### Operating System and version
macOS 26.5.2 (Darwin 25.5.0)
Contributor guide
Research direction
Start by comparing the existing pgx-driver and bun-pg-driver modules and the DialectManager registration path. Review the proposed PqDriverDialect, PqErrorHandler, PqRowParser, and PqPropertyResolver behavior, especially lib/pq SQLSTATE handling and connect_timeout conversion. Done means maintainers approve the approach and sql.Open("awssql-pq", dsn) works with the wrapper's failover, EFM, and IAM plugins.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100