Beta support for PostgreSQL

There are many changes but they *should not* break the existing behavior for MySQL. It adds (beta) support for PostgreSQL which can be used by some Drupal sites for instance (especially with sites using the Tripal module which requires PostgreSQL).

It has been tested on my local PostgreSQL Drupal sites with success.