title: SELECT ... FOR UPDATE SKIP LOCKED in REPETABLE READ transactions
body: <p>I have the following statement in my  PostgreSQL 10.5 database, which I execute in a <code>repeatable read</code> transaction:</p>
  
  <pre><code>delete from task
    where task.task_id = (
      select task.task_id
      from task
      order by task.created_at asc
      limit 1
      for update skip locked
    )
    returning
      task.task_id,
      task.created_at
  </code></pre>
  
  <p>Unfortunately, when I run it, I sometimes get:</p>
  
  <pre><code>[67] ERROR:  could not serialize access due to concurrent update
  [67] STATEMENT:  delete from task
    where task.task_id = (
      select task.task_id
      from task
      order by task.created_at asc
      limit $1
      for update skip locked
    )
    returning
      task.task_id,
      task.created_at
  </code></pre>
  
  <p>which means the transaction rolled back because some other transaction modified the record in the meantime. (I think?)</p>
  
  <p>I don't quite understand this. How could a different transaction modify a record that was selected with <code>for update skip locked</code>, and deleted?</p>