protected ResultSet getResultSet(Set<String> requestedIds,
        String workflowId, String jobId, String taskAttemptId)
        throws SQLException {
      db = null;
      ps = null;
      db = connectionFactory.getConnection();
      if (taskAttemptId == null) {
        ps = db.prepareStatement("SELECT " + getDBFieldString(requestedIds)
            + " FROM " + TASK_ATTEMPT_TABLE_NAME + " WHERE "
            + TaskAttemptFields.JOBID + " = ? ");
        ps.setString(1, jobId);
      } else {
        ps = db.prepareStatement("SELECT " + getDBFieldString(requestedIds)
            + " FROM " + TASK_ATTEMPT_TABLE_NAME + " WHERE "
            + TaskAttemptFields.TASKATTEMPTID + " = ? ");
        ps.setString(1, taskAttemptId);
      }
      return ps.executeQuery();
    }
Create a postgres task attempt fetcher that uses a given connection
factory.

@param connectionFactory
         a connection factory
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProvider.java