title: Example of a prepared INSERT statement using ruby pg gem
body: <p>Did some googling for about half a day and I can't find any sample of a prepared INSERT statement using the pg gem (postgresql ruby gem).</p>
  
  <p>I tried this (after looking at the gem docs):</p>
  
  <pre><code>def test2
      conn = PG.connect( dbname: 'db1' )
      conn.prepare("statement1", 'INSERT INTO table1 (id, name, profile) VALUES (?, ?, ?)')
  end
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <pre><code>pgtest.rb:19:in `prepare': ERROR:  syntax error at or near "," (PG::Error)
  LINE 1: INSERT INTO table1 (id, name, profile) VALUES (?, ?, ?)
                                                          ^
  from pgtest.rb:19:in `test2'
  from pgtest.rb:25:in `&lt;main&gt;'
  </code></pre>