Improvement for PostgreSQL database.

These changes come from [2.5 CMS' Postgresql pull request](https://github.com/joomla/joomla-cms/pull/166) to let CMS works on this database.