pgqr: a QR Code Generator

Related with my post: I have repackage the module and available on github:

This project adds 2 functionality to QR code generator from repository

  1. In-memory monochrome bitmap construction (1 bit per pixel).
  2. Wrap the whole package as PostgreSQL extension.

This project has been compiled successfully in Linux against PostgreSQL version 11.
$ make clean
$ make
$ make install

On successful compilation, install this extension in PostgreSQL environment
$ create extension pgqr

Function pgqr has 4 parameters:

  1. t text: text to be encoded.
  2. correction_level integer: 0 to 3.
  3. model_number integer: 0 to 2.
  4. scale integer: pixels for each dot.

Let us create a QR Code
$ select pgqr(‘QR Code with PostgreSQL’, 0, 0, 4);
The output is a monochrome bitmap ready for display.




  1. i test the extension in PG 10 and work fine!!!

  2. geom said:

    I tried to compile it on Ubuntu 18.04.3 with a running Postgresql-server 12.5, but I get the following errors:
    # make clean
    rm -f libpgqr.a libpgqr.pc
    rm -f pgqr.o QR_Encode.o pgqr.bc QR_Encode.bc
    # make
    gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -g -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fno-omit-frame-pointer -fPIC -I. -I./ -I/usr/include/postgresql/12/server -I/usr/include/postgresql/internal -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/mit-krb5 -c -o pgqr.o pgqr.c
    pgqr.c:1:10: fatal error: postgres.h: No such file or directory
    compilation terminated.
    : recipe for target ‘pgqr.o’ failed
    make: *** [pgqr.o] Error 1

    are these errors due to my Porstgresql version?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: