Patched applied for psql query error