Any idea if it is feasible/plausible/possible for postgresql to return multiple errors instead of just one? The only reason I can see to have to do validation in the app now is so you can report 5 validation errors at once, rather than make the user submit the form and correct one field five times.
Not that I know, you get a single PGResult which may be in an error state and have a bunch of error fields set. I don't think there is a way to get multiple errors out of it.
But I'd suggest asking on the mailing list about the possibility of getting multiple errors in the future. Not sure that makes sense from the database's point of view though, they're not "validation" issues as far as it's concerned they're integrity errors, a query is putting the db in an invalid state and thus rejected. Because the state is invalid, I'm not sure how the db would progress to get more errors.
Lying about what they are doesn't change the underlying issue:
> they're integrity errors, a query is putting the db in an invalid state and thus rejected. Because the state is invalid, I'm not sure how the db would progress to get more errors.
I agree with you that it's logically insensible to consider them "errors" because the resolution of the current constraint may change the downstream interpretation.
However it's a tremendously useful development tool.