pqr.sql: Generate QR Codes with Pure SQL in PostgreSQL
tanelpoder.com·13w·
Discuss: Hacker News
💾Databases
Preview
Report Post

As my cat woke me up way too early for a Saturday morning, I decided to put all this extra time (and my ChatGPT Pro subscription) into good use and generated a QR-code generator for PostgreSQL, written as a single pure SQL statement. No external libraries or Postgres extension installation needed!

I did this purely for fun and learning, I don’t think this is going to be the best way for generating QR codes in production. But optimizing this SQL to run faster should be a fun learning exercise. PostgreSQL 17 ran it much faster than 16 in my lab, haven’t gotten to compare the execution plans yet.

The pqr.sql example usage is simple:

$ psql -qf pqr.sql -v payload='Hello, World!'

![An example QR code…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help