input: Write a function to refresh a given table of data in a PostgreSQL database every 5 minutes. The function should connect to the database using the provided host, database, user, and password, and execute a query to refresh the specified table. The function should also schedule the refresh operation to run every 5 minutes. If the database connection is successful and the table is refreshed, return True; else return False. If no table name is provided, the function should return False.
  assert refresh_table("db", "user", "password", "TableName") == True
  assert refresh_table("wrong_db", "user", "password", "TableName") == False
  assert refresh_table("db", "user", "password", "") == False
output: import psycopg2
  import time
  import threading
  
  def refresh_table(host, database, user, password, table_name):
      if not table_name:
          return False
      
      def refresh_task():
          while True:
              try:
                  conn = psycopg2.connect(host=host, database=database, user=user, password=password)
                  cur = conn.cursor()
                  cur.execute(f"REFRESH MATERIALIZED VIEW {table_name};")
                  conn.commit()
                  cur.close()
                  conn.close()
              except Exception as e:
                  return False
              time.sleep(300)
      
      threading.Thread(target=refresh_task, daemon=True).start()
      return True