PostgreSql utils: fix result check

An exception should only be raised if the result was not okay.