Order is not guaranteed unless you explicitly specify it with the ORDER BY
clause.
You might be getting data in the same order upon several executions in case there is no database activity, as PostgreSQL will just return rows in the order it finds them in the database pages. Do a small test:
- insert a number of rows keeping the desired order;
- query the table: you will get rows ordered;
- update the very first record in the set;
- query the table again;
- observe the results.
In short: You might be even getting rows in the desired order, but this is just a coincidence.