title: Insert table rows based on concatenated rows from a series
body: <p>Two tables, 'user' and 'tracks' and I want to create a user for each track that doesn't already have one (userid=0).</p>
  
  <p>We don't have the unique emails required for user so aim to create dummy emails using generate_series:</p>
  
  <pre><code>insert into users (username, email) 
  select artist, (
  select concat(generate_series(1, (SELECT COUNT(filename) 
                  FROM tracks where userid = 0)),'@domain.com')
                  ) as email
  from tracks 
  where userid = 0 
  group by artist; 
  </code></pre>
  
  <p>Of course getting the error:</p>
  
  <pre><code>'ERROR:  more than one row returned by a subquery used as an expression'
  </code></pre>
  
  <p>I could use two SQL calls and have the parent code (Python) perform the loop, but I imagine the right way to do it is just within the SQL statement.</p>
  
  <p>So how do I make the Insert statement sort of, 'loop' through the select?</p>
  
  <p>The expected output:</p>
  
  <pre><code> id  |                         username                          |         email         
  -----+-----------------------------------------------------------+-----------------------
    62 | Sam Jackson                                               | 1@infiniteglitch.net
    63 | (unknown person)                                          | 2@infiniteglitch.net
    64 | Howard Cocel J.                                           | 3@infiniteglitch.net
  </code></pre>