My question is sort of similar to this one
I want to check if a DELETE query will fail because of a constraint violation. I'd like to do this on database level because I think letting it fail and catching the error is ugly.
Another option is "manually" checking for it using SELECT queries to see if there are constraints, but this is rather tedious, imho.
Is there a "native" way to do this?