handle not-null errors for postgres