title: How to do insert with array in SQL with JavaScript Node?
body: <p>i have a problem. I have an array and i want that each element to be a row from column;</p>
  
  <p>Example:</p>
  
  <p>My Array: const myArray = ['A', 'B', 'C', 'D'];</p>
  
  <p>and result is:</p>
  
  <pre><code>Column1 | 
  -----------------------------------------
      A   |  
      B   |  
      C   |  
      D   |  
  </code></pre>
  
  <p>I am using <code>Node.js</code> with library <code>node-postgres</code>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var queryString = "INSERT INTO test (id) VALUES (" + "'" + [myArray] + "'" + ") RETURNING *";
  
  pool.connect((err, client, done) =&gt; {
    if (err) {
      done();
      console.log(err)
      return res.status(500).json({
        success: false,
        data: err
      })
    }
    client.query(queryString, (err, result) =&gt; {
      done();
    });
  })</code></pre>
  </div>
  </div>
  </p>
  
  <p>But it goes like a bigger string;</p>
  
  <p>Someone could help me?</p>