(PDB-950) Catch and express postgresql regexp failures as better errors

This commit adds a validation for regexps in queries as was proposed in PDB-950
The more I think about this case of checking the exception within the streaming thread, the more I think its not enough, and probably not massively useful in its current case. In that, the result is more or less the same with or without this code. What I mean is, at the end of the day the exception is still logged as an exception, and the user still receives a 200 regardless. What has changed? We've added some code, and added an extra log message. I'm not 100% certain this should go in as it stands.

Its a shame we don't have a decent way of expressing this exception back to the HTTP layer somehow, perhaps we need to do more work here to get the streaming code to achieve better messaging between the front & backend threads so exceptions can be expressed correctly - somehow.