title: Postgres: remember current ordering of entities, which is produced by doing SELECT without ORDER BY
body: <p>It is known, that Postgres doesn't guarantee any particular order for a query without ORDER BY. But in most cases it will be the same order in which entities were written into DB.</p>
  <p>It so happened, that in the project I'm now taking care of there is a lot of data (<code>Job</code> entities) written without any field denoting the their correct order. <code>Job</code>s are related to <code>Person</code>s and there is a need to understand which <code>Job</code> was the first created for a particular <code>Person</code> and which was the second.</p>
  <p>So, I decided to add an <code>order</code> or just <code>created_at</code> field to <code>Job</code> and <code>ORDER BY</code> this field. I can write simple script to fill <code>created_at</code> or <code>order</code>. So far so good. But I am curious, is there a way to fill this <code>order</code> field automatically by issuing one <code>UPDATE</code> query?</p>