input: Write a function to create a Python script that refreshes a given table of data in a PostgreSQL database every 5 minutes. The script should establish a connection to the database, define a function to refresh the table data, and schedule the refresh function to run every 5 minutes. If the table is successfully refreshed, it should return a message indicating the successful refresh. If there is an issue connecting to the database or refreshing the table, it should return an error message.
  
  assert refresh_table('host="localhost", database="db", user="user", password="password", table="TableName"') == "Table refreshed successfully"
  assert refresh_table('host="localhost", database="db", user="user", password="password", table="NonExistentTable"') == "Error refreshing table"
  assert refresh_table('host="wronghost", database="db", user="user", password="password", table="TableName"') == "Error connecting to database"
output: import psycopg2
  import time
  
  def refresh_table(connection_string):
      try:
          conn = psycopg2.connect(connection_string)
          cursor = conn.cursor()
          cursor.execute(f"REFRESH MATERIALIZED VIEW {connection_string.split('table="')[1].split('"')[0]};")
          conn.commit()
          cursor.close()
          conn.close()
          return "Table refreshed successfully"
      except psycopg2.OperationalError:
          return "Error connecting to database"
      except Exception:
          return "Error refreshing table"