pqr.sql: Generate QR Codes with Pure SQL in PostgreSQL
tanelpoder.com·18h

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...