Original modifications for postgresql

Adapted classam/pierc, which was written to use MySQL, to instead use
PostgreSQL, because I much prefer the latter. This required modifying
the database-related code throughout the project.