title: Does update change the order of records in a table in PostgreSQL?
body: <p>My code depends on the order of records in the table. My assumption was that a table can be considered a list so that the records maintain order. I have a small update code as shown below that will update a record at a particular index in the table. </p>
  
  <pre><code>p = pieces[index]
  
  p.position = 0
  
  p.save
  </code></pre>
  
  <p>I check the order of records before this update and after this update then i see that after the update the record that is updated is moved to the last of the list. I print Piece.all to print the list. The order is maintained in mysql but when i deploy it to heroku which uses postgre the order was not  maintained so this was a surprising find for me.</p>
  
  <p>Is there no guarantee of order in tables and one should not depend on the order? Please correct my misunderstanding and thanks for the clarification.</p>