Merge parameter substitution code
Fix postgres pooling, didn't implement parameter substitution