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 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 5:05:26 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

2 sources
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

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.