title: Is INSERT ... SELECT an atomic transaction?
body: <p>I use a query like this:</p>
  
  <pre><code>INSERT INTO table
       SELECT * FROM table2 t2
          JOIN ...
          ...
          WHERE table2.date &lt; now() - '1 day'::INTERVAL
       FOR UPDATE OF t2 SKIP LOCKED
  ON CONFLICT (...)
      DO UPDATE SET ...
  RETURNING *;
  </code></pre>
  
  <p>My question is about <code>FOR UPDATE t2 SKIP LOCKED</code>. Should I use it here? Or will Postgres lock these rows automatically with <code>INSERT SELECT ON CONFLICT</code> till the end of the transaction?</p>
  
  <p>My goal is to prevent other apps from (concurrently) capturing rows with the inner <code>SELECT</code> which are already captured by this one.</p>