fixing postgres issues for schema names and other queries.