Getting the PostgreSQL Documentation as an epub

I wanted to have a look at the postgreSQL documentation but didn’t find it easy to read using their online version. So I went for the pdf, available on postgres’ website, but it renders very badly on my reader.

Going through the doc source code, I noticed there is a doc directory, with a Makefile in doc/src/sgml/. It has a epub target, but running ‘make epub’ I get the following error:

bin/sh ../../../config/missing dbtoepub -o postgres.epub postgres-full.xml
***
ERROR: `dbtoepub' is missing on your system.
***
make: *** [Makefile:171: postgres.epub] Error 1

Unfortunately, no package provides dbtoepub on my distrib (Manjaro, based on ArchLinux). Thankfully, I’ve come across this post describing the same problem and they recommend using pandoc as follows (it has to be installed of course):

pandoc -f docbook -t epub -o postgres.epub postgres-full.xml 

And now I can read this postgres.epub on my reader, and it’s great!