Add unit test for enhanced error reporting

Add a test to check for a useful response for a SQL
query that cannot be executed due to a constraint failure