title: How do I insert an array into database table?
body: <p>I have the following Ruby code:</p>
  
  <pre><code> 94   def open_connection(info)
   95     self.log "opening #{info.inspect}"
   96     db = Mysql.init
   97     db.options(Mysql::SET_CHARSET_NAME, 'utf8')
   98     db.real_connect(info.host, info.user, info.password, info.dbname, info.port)
   99     db.query("SET NAMES utf8")
  100 »···res = db.query("SELECT realname FROM profiles")
  101 
  102 »···conn = PGconn.connect("localhost", 5432, '', '', "dbname", "user", "pwd")
  </code></pre>
  
  <p>How do I take the <code>res</code> variable and loop through it to insert it into my Postgres database?</p>