Some postgresql provider and PostGIS-related processing improvements and fixes (v2)

This is a reworked version of https://github.com/qgis/QGIS/pull/1311 . This version implements a postgresql provider option for dropping length constraints of character fields.
It also omits the fix for quoting upper-case geometry fields, as this requires further investigation (looks like _quote in postgis_utils.py should be using a refined regular expression, and also test for reserved keywords). I'll tackle that in a separate pull request.