From the PostgreSQL home page (https://www.postgresql.org/), you can download the PostgreSQL source code, binaries (in a variety of formats) and documentation. One of the core PostgreSQL developers, Bruce Momjian, is working on a book about PostgreSQL, which is available at https://www.postgresql.org/docs/awbook.html.
Programming the Perl DBI, published by O'Reilly and Associates, describes how to use Perl to write for many different relational databases, including PostgreSQL and MySQL. It also describes the use of “eval” to trap for transactions, as demonstrated in Listing 9.
If you are interested in learning more about databases, transactions and SQL, I suggest reading LAN Times Guide to SQL, published by McGraw-Hill and written by James R. Groff and Paul N. Weinberg. Another good book (although more academic in nature) is Database, published by Morgan-Kaufmann and written by Patrick O'Neil.
The MySQL vs. PostgreSQL religious war has been raging for some time. At the risk of pouring more gasoline onto this fire, I encourage you to read “Why Not MySQL”, an article written by Ben Adida, one of the people behind the OpenACS project. You can read it on the Web at https://openacs.org/philosophy/why-not-mysql.html.