(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
Here the handling is kind of useful. But, it will only be expressed when `include-total` is passed as a parameter. So it only solves it for some queries, but not all.