title: Parallel unnest() and sort order in PostgreSQL
body: <p>I understand that using</p>
  
  <pre><code>SELECT unnest(ARRAY[5,3,9]) as id
  </code></pre>
  
  <p>without an <code>ORDER BY</code> clause, the order of the result set is not guaranteed. I could for example get:</p>
  
  <pre><code>id
  --
  3
  5
  9
  </code></pre>
  
  <p>But what about the following request:</p>
  
  <pre><code>SELECT
    unnest(ARRAY[5,3,9]) as id,
    unnest(ARRAY(select generate_series(1, array_length(ARRAY[5,3,9], 1)))) as idx
  ORDER BY idx ASC
  </code></pre>
  
  <p>Is it guaranteed that the 2 <code>unnest()</code> calls (which have the same length) will unroll in parallel and that the index <code>idx</code> will indeed match the position of the item in the array?</p>
  
  <p>I am using PostgreSQL 9.3.3.</p>