title: Postgresql: Inserting values for each row returned by a select
body: <p>Hi I'm having trouble trying to figure out how to build the following query:</p>
  
  <pre><code>INSERT INTO role_permissions (role_id, permission)
  VALUES (
     (SELECT role_id
      FROM role_permissions
      WHERE permission = 'manage_admins'),
     'create_admins');
  
  INSERT INTO role_permissions (role_id, permission)
  VALUES (
     (SELECT role_id
      FROM role_permissions
      WHERE permission = 'manage_admins'),
     'edit_admins');
  </code></pre>
  
  <p>So basically some context, there is a permission called <code>manage_admins</code> that would allow users to edit/create, but now I need to separate this permission into 2 different permissions. The thing is I also have a <code>role_permissions</code> table where I store all of a role's permissions. </p>
  
  <p>So I need to insert the 2 new permissions for every role that had the old permission, the example I provided is failing because the <code>SELECT</code> query is returning multiple values. So this is what I'm having trouble with, so any help would be greatly appreciated. </p>