Fixed postgresql_db failing on Python 2.4 with --check

Fixed a minor bug where `postgresql_db` module fails with `--check`. This happens because on Python 2.4 (Centos 5) `module.exit_json` calls `sys.exit()` which throws an exception which is then caught by the try/except around it, so it reports an error.

This is just a minor change it the code, where I only put if/else instead of the exit_json() after the first if.