# Postgres defaults to ID DESC, MySQL defaults to ID ASC

**URL:** <https://discuss.rubyonrails.org/t/postgres-defaults-to-id-desc-mysql-defaults-to-id-asc/45272>\
**Category:** rubyonrails-talk\
**Created:** [August 19, 2009, 12:09am UTC](https://discuss.rubyonrails.org/t/postgres-defaults-to-id-desc-mysql-defaults-to-id-asc/45272 "2009-08-19T00:09:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitsweat](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bitsweat/32/591_2.png) [@bitsweat](https://discuss.rubyonrails.org/u/bitsweat)\
**Post date:** [August 19, 2009, 12:09am UTC](https://discuss.rubyonrails.org/t/postgres-defaults-to-id-desc-mysql-defaults-to-id-asc/45272/1 "2009-08-19T00:09:41Z")

</div>

The Rails tests use explicit ordering to work around this discrepancy.

User.first without an ordering is technically undefined. It could be any row.

Since you're usually doing account.users.first, you could :order =\> 'id asc' on the has\_many.

jeremy
