HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
lib
pq
Go2013–2025
lib / pq

pq

Go PostgreSQL driver for database/sql

19Distinct people
19Mentions
0Explicit recommenders
10KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Go PostgreSQL driver for database/sql

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year19 dated mentions

Observed mentions: 2013-03-12 23:07:21 UTC to 2025-12-13 02:16:15 UTC.

012342013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC303
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC413
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC101
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC303
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC211

What Hacker News says

19 sources

Show HN: Pgdbtemplate – fast PostgreSQL test databases in Go using templates

Dear community, I have heard that appropriate self-promotion is allowed on this forum, so I want to welcome `pgdbtemplate`. It is the Go library for creating PostgreSQL test databases using template databases for lightning-fast test execution. Have you ever used PostgreSQL in your tests and been frustrated by how long it takes to spin up the database and run its migrations? `pgdbtemplate` offers... - Proven benchmarks showing 1.2x-1.6x faster performance than the traditional approach - Seamless integration with your projects by supporting both "github.com/lib/pq" and "github.com/jackc/pgx/v5" PostgreSQL drivers, as well as configurable connection pooling - Built-in migration handling - Full `testcontainers-go` support - Robust security implementation: safe against SQL injections, fully thread-safe operations - Production-ready
Read the rest
quality: SOLID principles enabling custom connectors and migration runners, >98% test coverage, and comprehensive documentation Ready to see how it works? Follow [this](https://github.com/andrei-polukhin/pgdbtemplate?tab=readme-o...) link and see the "Quick Start" example on how easily you can integrate `pdbtemplate` into your Go tests. I welcome feedback and questions about code abstractions, implementation details, security considerations, and documentation improvements. Thank you for reading this post. Let's explore how I can help you.
2 points · Open discussion
I'd love to hear if anyone has other alternatives. I'm finding myself in a similar place as you do. I found on the About and Terms pages a few software projects listed, which the author claims are what powers Slimvoice: - https://www.blender.org - https://www.gimp.org - https://golang.org General tech ^ and libraries: - https://github.com/aymerick/douceur - https://github.com/jung-kurt/gofpdf - https://github.com/lib/pq - https://github.com/qiangxue/fasthttp-routing - https://github.com/valyala/fasthttp - https://github.com/valyala/quicktemplate - https://github.com/bamiaux/rez - https://github.com/MithrilJS/mithril.js And lastly, fonts: - https://github.com/rsms/inter - https://github.com/IBM/plex - https://github.com/weiweihuanghuang/Work-Sans Aggregated from from: - https://slimvoice.co/about - https:
Read the rest
//slimvoice.co/terms Copied URLs just in case those pages go kaput.
In Ask HN: Slimvoice Alternative?
This thing is crazy. This may seem simple to some but I asked it to write a signup endpoint for signing up to a website: ``` package main import ( "database/sql" "fmt" "log" "net/http" "time" "golang.org/x/crypto/bcrypt" _ "github.com/lib/pq" ) const ( host = "localhost" port = 5432 user = "postgres" password = "password" dbname = "mydb" ) func main() { // Create a new HTTP server http.HandleFunc("/signup", signupHandler) log.Fatal(http.ListenAndServe(":8080", nil)) } // signupHandler handles the signup request. func signupHandler(w http.ResponseWriter, r *http.Request) { // Parse the request body username := r.FormValue("username") password := r.FormValue("password") // Hash the password hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) if err != nil { http.Error(w, "Error ha
Read the rest
shing password: "+err.Error(), http.StatusInternalServerError) return } // Connect to the database psqlInfo := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", host, port, user, password, dbname) db, err := sql.Open("postgres", psqlInfo) if err != nil { http.Error(w, "Error connecting to database: "+err.Error(), http.StatusInternalServerError) return } defer db.Close() // Insert the username and hashed password into the database _, err = db.Exec("INSERT INTO users (username, password) VALUES ($1, $2)", username, hash) if err != nil { http.Error(w, "Error inserting into database: "+err.Error(), http.StatusInternalServerError) return } // Send the response w.Write([]byte("User successfully signed up!")) } ``` Along with this, it included: ``` This program uses the database/sql package to connect to a PostgreSQL database and insert the username and hashed password into the users table. It also uses the golang.org/x/crypto/bcrypt package to hash the password using the bcrypt.GenerateFromPassword function. To run this program, you will need to have a PostgreSQL database running and a users table with a username and password column. You can create the table using the following SQL statement: CREATE TABLE users ( username text NOT NULL, password bytea NOT NULL ); This program is a simple example of how to handle signup requests and store user data in a database. In a real-world application, you should also validate the input data and handle any potential errors more grace ``` Not only is this doing what the prompt asks, it's going above and beyond, and giving tips on other things that you might miss. As a teaching prompt alone, this is absolutely incredible.
In Building a Virtual Machine Inside ChatGPT
Thanks for this question! Back in early 2020, Meilisearch did not have a Rust client library, but it did have a Go client library[1], and there was nothing comparable to lib/pq[1] in the Rust ecosystem which would allow me to create a listener on a table.[3] Go is generally my "fallback language" when something would not be practical to do in Rust; it has a very nice, mature ecosystem, and as long as you aren't condemning yourself to interface{} hell, it remains in my eyes a perfectly capable and reasonably ergonomic alternative for well-defined use cases. [1] https://github.com/meilisearch/meilisearch-go [2] https://github.com/lib/pq [3] https://pkg.go.dev/github.com/lib/pq#NewListener
In How Fly.io and Tailscale Saved Notado
This just adds to my impression that Go is a very poorly designed language. So. The compiler knows that the package is not used. How can you tell the compiler that the package is imported for side-effects? Oh, you have to explicitly tell it to the compiler by, you know, actually using the import, right. By doing something stupid like import ( _ "github.com/lib/pq" _ "image/png" ... ) Oh. Look. Problem solved. You mark a package as "I imported this specifically for its side effects". So the compiler can go ahead and include it. Why does it need to include any other unused module?
In Darker Corners of Go
As a very opinionated user of Go for ~6 years now... interface{} is almost always a code smell. I can judge a book by its cover with a grep and line count for interface{} and reflect. If it's more than 20~30 for just about any small-medium size code base I dig deeper and look at why. Usually it is people being lazy and refusing to accept what is my twist on "idiomatic Go": a little bit of copying is better than a whole lot of abstraction[0]. Also devs telling me interface{} and type switches make it polymorphic are the ones who will always complain yet not leave the Go ecosystem. Hopefully generics in 2 solve this for everyone. panic is great when you really want to crash. There are times to do this. I have only used it once in a batch job runner. init() is a sin ESPECIALLY when you combine init() with the `.` (dot) imports. Pulling packa
Read the rest
ges around for their magic side effects suck. Also the lack of some library maintainers to acknowledge init() can be poisonous... [1] [0] https://go-proverbs.github.io/ [1] https://github.com/lib/pq/pull/455
In Go’s Features of Last Resort
Not including an ORM layer does not decrease "value" of this framework, because you can attach such lib on your own. In Go the you are very flexible to set up a "a place where data will be stored/queried" - there is fabulous database/sql (or additional layers like lib/pq [1]) which is great for many use cases; also orm-like solutions like gocraft/dbr [2]; oh, I also should mention Gorm [3] or Bolt [4]. Setting them up is really easy in any Go web frameworks because (almost) all database modules rely on abstraction from stdlib. [1] https://github.com/lib/pq [2] https://github.com/gocraft/dbr [3] https://github.com/jinzhu/gorm [4] https://github.com/boltdb/bolt
In Iris: Fast back-end web framework for Go
# ---------------------------------- # general layout of the land # ---------------------------------- $GOPATH/src/.go $GOPATH/src/.go/config $GOPATH/src/.go/vendors # for all projects # ---------------------------------- # $GOPATH/.go/vendors sketch # ---------------------------------- lib/mq = github.com/lib/pq@master mgo = labix.org/v2/mgo ... etc # ---------------------------------- # specific project 1 # uses the global version of package labix.org/mgo # uses a project specific package hotness # ---------------------------------- $GOPATH/src/mygofoo $GOPATH/src/mygofoo/foo.go $GOPATH/src/mygofoo/.go $GOPATH/src/mygofoo/.go/vendors # ---------------------------------- # foo.go fragment # -------------------------------
Read the rest
--- package mygofoo import ( "mgo" // version spec'd in global .go "lib/pq" // version spec'd in project specific .go "hotness" // version spec'd in project specific .go ... ) ... # ---------------------------------- # $GOPATH/src/mygofoo/.go/vendors sketch # ---------------------------------- lib/mq = github.com/lib/pq@experimental // lets pretend hotness = bitbucket.org/wiz/hotness@master ... etc # go tool > cd $GOPATH/src/mygofoo > go build -vendors using: mgo -> labix.org/v2/mgo lib/pq -> github.com/lib/pq@experimental hotness -> bitbucket.org/wiz/hotness@master > # go tool can obviously allow for command line mods of the .go
In Reproducible Builds in Go

Showing the 15 most recent of 19 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.