fixing OTHER psql query