title: PostgreSQL filter and order by array
body: <p>I have a table with an arrays that I want to match against. The matching works by using the <code>&amp;&amp;</code> operator:</p>
  
  <pre><code>SELECT * FROM table WHERE data &amp;&amp; ARRAY['foo','bar'];
  id | data
  ---+----------
   1 | {foo}
   2 | {bar}
   6 | {bar,foo}
  </code></pre>
  
  <p>The next thing I want now, is also to sort them in the order they are in that array, something like:</p>
  
  <pre><code>SELECT * FROM table WHERE data &amp;&amp; ARRAY['foo','bar'] ORDER BY data &amp;&amp; ARRAY['foo','bar'];
  id | data
  ---+----------
   1 | {foo}
   6 | {bar,foo}
   2 | {bar}
  </code></pre>
  
  <p>Is this possible?</p>