code: private List<String> listIndexesOnTables(List<String> tables)
    {
      String sql
        = ""
        + "SELECT indexname "
        + "FROM pg_indexes "
        + "WHERE tablename IN (" + StringUtils.repeat("?", ",", tables.size())
        + ") "
        + "AND lower(indexname) NOT IN "
        + "	(SELECT lower(conname) FROM pg_constraint WHERE contype in ('p', 'u'))";
  
      return getJdbcTemplate().query(sql, tables.toArray(), stringRowMapper());
    }
docs: exploits the fact that the index has the same name as the constraint