improve postgres errors and error formatting in general